[FFmpeg-devel] mp3 seeking issue.

Dale Curtis dalecurtis at chromium.org
Sun Oct 21 00:49:07 CEST 2012


On HEAD I'm seeing an issue where the sample rate is changing during seeks
in an mp3 file. Is this expected? Sample file:

http://commondatastorage.googleapis.com/dalecurtis-shared/ironman2.mp3

git bisect seems to think it has something to do
with 5864ce13d188260998bbf49a2a774fa9bd445c10, but reverting that issue
doesn't seem to help. Patching ffplay to print out the sample rate:

diff --git a/ffplay.c b/ffplay.c
index 4223102..7ebbdc5 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1983,6 +1983,9 @@ static int audio_decode_frame(VideoState *is, double
*pts_ptr)
                 is->frame->channel_layout :
av_get_default_channel_layout(is->frame->channels);
             wanted_nb_samples = synchronize_audio(is,
is->frame->nb_samples);

+if (is->frame->sample_rate != dec->sample_rate)
+  printf("sample rate: %d -> %d\n", is->frame->sample_rate,
dec->sample_rate);
+
             if (is->frame->format        != is->audio_src.fmt            ||
                 dec_channel_layout       != is->audio_src.channel_layout ||
                 is->frame->sample_rate   != is->audio_src.freq           ||

and then seeking around yields:

Input #0, mp3, from '/var/www/ironman2.mp3':
  Duration: 00:00:35.13, start: 0.000000, bitrate: 141 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16, 224 kb/s
Seek to 34% ( 0:00:11) of total duration ( 0:00:35)       B f=0/0
Seek to 62% ( 0:00:21) of total duration ( 0:00:35)       B f=0/0
sample rate: 44100 -> 32000
[mp3 @ 0x7f1d58000ad0] Header missing
sample rate: 32000 -> 44100

LibAV doesn't seem to have this problem, but I haven't been able to figure
out the difference yet.

- dale


More information about the ffmpeg-devel mailing list