Hey,
Shall I file a bug report or is this to be treated as a known limitation
of the MP3 seeking algorithm?
Adding a bug report is always good even more if you already have a
testcase and the full backstory.
Carl Eugen asked me off-list whether the problem is reproducible with
the latest FFmpeg, and how to reproduce it. (I've put Carl in Bcc for
this email.) So I did the following:
# download/prepare audio file
cd /tmp
mkdir seek_bug && cd seek_bug
wget --no-check-certificate
https://jobim.ofai.at/downloads/libav_seek_bug.tgz
tar -xzf libav_seek_bug.tgz
# nightly FFmpeg build
wget http://johnvansickle.com/ffmpeg/builds/ffmpeg-git-64bit-static.tar.xz
tar -xJf ffmpeg-git-64bit-static.tar.xz
./ffmpeg-git-20150709-64bit-static/ffmpeg -y -v debug -ss 48 -i
libav_seek_bug/bug.mp3 -t 30 foo.wav 2> ffmpeg.txt
# nightly libav build
wget http://johnvansickle.com/libav/builds/libav-git-64bit-static.tar.xz
tar -xJf libav-git-64bit-static.tar.xz
./libav-git-20150709-64bit-static/avconv -y -v debug -ss 48 -i
libav_seek_bug/bug.mp3 -t 30 foo.wav 2> libav.txt
I'm attaching the two output files. The problem still persists in the
nightly libav build (as well as the latest release), and it does not
seem to exist in the nightly ffmpeg build (as well as the latest
release), or maybe the output is just different.
Figuring out how to avoid the problem is, on the other hand, annoying
since the seek step assumes something that is actually wrong for that file.
What does it assume then? My naive interpretation was that it figures
out from the bitrate where about to jump to and then searches for
something looking like an MP3 frame, failing here because there's a
frame-lookalike around second 48. (However, the problem also occurs when
seeking to 49, 50, 51, it does not occur for 48 or 52.)
Best, Jan
ffmpeg version N-47964-g07ae8fa-static http://johnvansickle.com/ffmpeg/
Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.3 (Debian 4.9.3-1)
configuration: --enable-gpl --enable-version3 --disable-shared
--disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264
--enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis
--enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora
--enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray
--enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls
--enable-libvidstab --enable-libsoxr --cc=gcc-4.9
libavutil 54. 28.100 / 54. 28.100
libavcodec 56. 46.102 / 56. 46.102
libavformat 56. 40.100 / 56. 40.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 21.100 / 5. 21.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with
argument '1'.
Reading option '-v' ... matched as option 'v' (set logging level) with argument
'debug'.
Reading option '-ss' ... matched as option 'ss' (set the start time offset)
with argument '48'.
Reading option '-i' ... matched as input file with argument
'libav_seek_bug/bug.mp3'.
Reading option '-t' ... matched as option 't' (record or transcode "duration"
seconds of audio/video) with argument '30'.
Reading option 'foo.wav' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option v (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file libav_seek_bug/bug.mp3.
Applying option ss (set the start time offset) with argument 48.
Successfully parsed a group of options.
Opening an input file: libav_seek_bug/bug.mp3.
[mp3 @ 0x4326260] Format mp3 probed with size=4096 and score=51
[mp3 @ 0x4326260] id3v2 ver:3 flags:00 len:2038
[mp3 @ 0x4326260] pad 576 1152
[mp3 @ 0x4326260] Skipping 0 bytes of junk at 2674.
[mp3 @ 0x4326260] Before avformat_find_stream_info() pos: 2674 bytes read:32768
seeks:0
[mp3 @ 0x4326260] demuxer injecting skip 1105 / discard 0
[mp3 @ 0x4326cc0] skip 1105 / discard 0 samples due to side data
[mp3 @ 0x4326cc0] skip 1105/1152 samples
[mp3 @ 0x4326260] All info found
[mp3 @ 0x4326260] After avformat_find_stream_info() pos: 34418 bytes read:65536
seeks:0 frames:50
[mp3 @ 0x4326260] demuxer injecting skip 1105 / discard 0
Input #0, mp3, from 'libav_seek_bug/bug.mp3':
Metadata:
artist : Ja'Quay
title : Reasoning
genre : 159
Duration: 00:06:06.68, start: 0.025057, bitrate: 192 kb/s
Stream #0:0, 50, 1/14112000: Audio: mp3, 44100 Hz, stereo, s16p, 192 kb/s
Metadata:
encoder : LAME3.93
Successfully opened the file.
Parsing a group of options: output file foo.wav.
Applying option t (record or transcode "duration" seconds of audio/video) with
argument 30.
Successfully parsed a group of options.
Opening an output file: foo.wav.
Successfully opened the file.
detected 8 logical cores
[graph 0 input from stream 0:0 @ 0x4326160] Setting 'time_base' to value
'1/44100'
[graph 0 input from stream 0:0 @ 0x4326160] Setting 'sample_rate' to value
'44100'
[graph 0 input from stream 0:0 @ 0x4326160] Setting 'sample_fmt' to value 's16p'
[graph 0 input from stream 0:0 @ 0x4326160] Setting 'channel_layout' to value
'0x3'
[graph 0 input from stream 0:0 @ 0x4326160] tb:1/44100 samplefmt:s16p
samplerate:44100 chlayout:0x3
[audio format for output stream 0:0 @ 0x4329f40] Setting 'sample_fmts' to value
's16'
[audio format for output stream 0:0 @ 0x4329f40] auto-inserting filter
'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the filter
'audio format for output stream 0:0'
[AVFilterGraph @ 0x4311bc0] query_formats: 6 queried, 12 merged, 3 already
done, 0 delayed
[auto-inserted resampler 0 @ 0x432cd00] [SWR @ 0x4312120] Using s16p internally
between filters
[auto-inserted resampler 0 @ 0x432cd00] ch:2 chl:stereo fmt:s16p r:44100Hz ->
ch:2 chl:stereo fmt:s16 r:44100Hz
Output #0, wav, to 'foo.wav':
Metadata:
IART : Ja'Quay
INAM : Reasoning
IGNR : 159
ISFT : Lavf56.40.100
Stream #0:0, 0, 1/44100: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100
Hz, stereo, s16, 1411 kb/s
Metadata:
encoder : Lavc56.46.102 pcm_s16le
Stream mapping:
Stream #0:0 -> #0:0 (mp3 (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[output stream 0:0 @ 0x431b740] EOF on sink link output stream 0:0:default.
No more output streams to write to, finishing.
size= 5168kB time=00:00:30.00 bitrate=1411.2kbits/s
video:0kB audio:5168kB subtitle:0kB other streams:0kB global headers:0kB muxing
overhead: 0.002343%
Input file #0 (libav_seek_bug/bug.mp3):
Input stream #0:0 (audio): 1150 packets read (720980 bytes); 1150 frames
decoded (1324800 samples);
Total: 1150 packets (720980 bytes) demuxed
Output file #0 (foo.wav):
Output stream #0:0 (audio): 1149 frames encoded (1323000 samples); 1149
packets muxed (5292000 bytes);
Total: 1149 packets (5292000 bytes) muxed
1150 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x4328ec0] Statistics: 4 seeks, 1152 writeouts
[AVIOContext @ 0x4325640] Statistics: 1966080 bytes read, 1 seeks
avconv version 84b223c-static http://johnvansickle.com/libav/ , Copyright (c)
2000-2015 the Libav developers
built on Jul 9 2015 00:55:02 with gcc 4.9.3 (Debian 4.9.3-1)
configuration: --disable-debug --disable-shared --enable-gpl
--enable-version3 --enable-runtime-cpudetect --enable-libmp3lame
--enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex
--enable-libvorbis --enable-libvpx --enable-libfreetype --enable-libxvid
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora
--enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray
--enable-libopenjpeg --enable-libopus --enable-gnutls --disable-avserver
--cc=gcc-4.9
libavutil 54. 15. 0 / 54. 15. 0
libavcodec 56. 32. 0 / 56. 32. 0
libavformat 56. 21. 0 / 56. 21. 0
libavdevice 55. 2. 0 / 55. 2. 0
libavfilter 5. 1. 0 / 5. 1. 0
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 0. 0 / 3. 0. 0
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with
argument '1'.
Reading option '-v' ... matched as option 'v' (set libav* logging level) with
argument 'debug'.
Reading option '-ss' ... matched as option 'ss' (set the start time offset)
with argument '48'.
Reading option '-i' ... matched as input file with argument
'libav_seek_bug/bug.mp3'.
Reading option '-t' ... matched as option 't' (record or transcode "duration"
seconds of audio/video) with argument '30'.
Reading option 'foo.wav' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option v (set libav* logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file libav_seek_bug/bug.mp3.
Applying option ss (set the start time offset) with argument 48.
Successfully parsed a group of options.
Opening an input file: libav_seek_bug/bug.mp3.
[mp3 @ 0x3244100] Probed with size=4096 and score=51
[mp3 @ 0x3244100] Invalid size in frame com, skipping the rest of tag.
[mp3 @ 0x3244100] All info found
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, mp3, from 'libav_seek_bug/bug.mp3':
Metadata:
artist : Ja'Quay
title : Reasoning
genre : 159
Duration: 00:06:06.68, start: 0.000000, bitrate: 192 kb/s
Stream #0:0, 50, 1/14112000: Audio: mp3
44100 Hz, 2 channels, s16p, 192 kb/s
Metadata:
encoder : LAME3.93
Successfully opened the file.
Parsing a group of options: output file foo.wav.
Applying option t (record or transcode "duration" seconds of audio/video) with
argument 30.
Successfully parsed a group of options.
Opening an output file: foo.wav.
Successfully opened the file.
Detected 8 logical cores.
[abuffer @ 0x326d320] tb:1/44100 samplefmt:s16p samplerate: 44100 ch layout:0x3
[abuffersink @ 0x326ebc0] auto-inserting filter 'auto-inserted fifo 0' between
the filter 'trim for output stream 0:0' and the filter 'output stream 0:0'
[aformat @ 0x326eca0] auto-inserting filter 'auto-inserted resampler 0' between
the filter 'Parsed filter 0 anull' and the filter 'audio format for output
stream 0:0'
[AVAudioResampleContext @ 0x3256da0] audio_convert: found function: s16p to s16
(C)
[AVAudioResampleContext @ 0x3256da0] audio_convert: found function: s16p to s16
(SSE2)
[AVAudioResampleContext @ 0x3256da0] audio_convert: found function: s16p to s16
(AVX)
[resample @ 0x3270ec0] fmt:s16p srate:44100 cl:stereo -> fmt:s16 srate:44100
cl:stereo
Output #0, wav, to 'foo.wav':
Metadata:
IART : Ja'Quay
INAM : Reasoning
IGNR : 159
ISFT : Lavf56.21.0
Stream #0:0, 0, 1/44100: Audio: pcm_s16le [[1][0][0][0] / 0x0001]
44100 Hz, stereo, s16, 1411 kb/s
Metadata:
encoder : LAME3.93
Stream mapping:
Stream #0:0 -> #0:0 (mp3 (native) -> pcm_s16le (native))
Press ctrl-c to stop encoding
Input stream #0:0 frame changed from rate:44100 fmt:s16p ch:2 chl:stereo to
rate:44100 fmt:s16 ch:1 chl:mono
Detected 8 logical cores.
[abuffer @ 0x3271340] tb:1/32000 samplefmt:s16 samplerate: 32000 ch layout:0x4
[abuffersink @ 0x3270840] auto-inserting filter 'auto-inserted fifo 0' between
the filter 'trim for output stream 0:0' and the filter 'output stream 0:0'
[aformat @ 0x326e0c0] auto-inserting filter 'auto-inserted resampler 0' between
the filter 'Parsed filter 0 anull' and the filter 'audio format for output
stream 0:0'
[AVAudioResampleContext @ 0x32598e0] Using s16p as internal sample format
[AVAudioResampleContext @ 0x32598e0] audio_convert: found function: s16 to
s16p (C)
[AVAudioResampleContext @ 0x32598e0] audio_convert: found function: s16p to s16
(C)
[AVAudioResampleContext @ 0x32598e0] audio_convert: found function: s16p to s16
(SSE2)
[AVAudioResampleContext @ 0x32598e0] audio_convert: found function: s16p to s16
(AVX)
[AVAudioResampleContext @ 0x32598e0] resample: s16p from 32000 Hz to 44100 Hz
[AVAudioResampleContext @ 0x32598e0] audio_mix: found function: [fmt=s16p]
[c=flt] [any to any] (C)
[AVAudioResampleContext @ 0x32598e0] audio_mix: found function: [fmt=s16p]
[c=flt] [1 to 2] (SSE2)
[AVAudioResampleContext @ 0x32598e0] audio_mix: found function: [fmt=s16p]
[c=flt] [1 to 2] (SSE4)
[AVAudioResampleContext @ 0x32598e0] audio_mix: found function: [fmt=s16p]
[c=flt] [1 to 2] (AVX)
[AVAudioResampleContext @ 0x32598e0] audio_mix: mono to stereo
[AVAudioResampleContext @ 0x32598e0] matrix size: 1 x 2
[AVAudioResampleContext @ 0x32598e0] 0.707
[AVAudioResampleContext @ 0x32598e0] 0.707
[resample @ 0x3257720] fmt:s16 srate:32000 cl:mono -> fmt:s16 srate:44100
cl:stereo
[abuffer @ 0x3271340] Changing frame properties on the fly is not supported.
Error while decoding stream #0:0
[mp3 @ 0x3255800] Header missing
Error while decoding stream #0:0
Input stream #0:0 frame changed from rate:44100 fmt:s16 ch:1 chl:mono to
rate:32000 fmt:s16 ch:2 chl:stereo
Detected 8 logical cores.
[abuffer @ 0x3270e60] tb:1/44100 samplefmt:s16 samplerate: 44100 ch layout:0x3
[abuffersink @ 0x3271280] auto-inserting filter 'auto-inserted fifo 0' between
the filter 'trim for output stream 0:0' and the filter 'output stream 0:0'
[abuffer @ 0x3270e60] Changing frame properties on the fly is not supported.
Error while decoding stream #0:0
Input stream #0:0 frame changed from rate:32000 fmt:s16 ch:2 chl:stereo to
rate:44100 fmt:s16 ch:2 chl:stereo
Detected 8 logical cores.
[abuffer @ 0x326d560] tb:1/44100 samplefmt:s16 samplerate: 44100 ch layout:0x3
[abuffersink @ 0x32707a0] auto-inserting filter 'auto-inserted fifo 0' between
the filter 'trim for output stream 0:0' and the filter 'output stream 0:0'
No more output streams to write to, finishing.
size= 5168kB time=29.98 bitrate=1412.0kbits/s
video:0kB audio:5168kB other streams:0kB global headers:0kB muxing overhead:
0.002343%
Input file #0 (libav_seek_bug/bug.mp3):
Input stream #0:0 (audio): 1161 packets read (728838 bytes); 1160 frames
decoded (1336320 samples);
Total: 1161 packets (728838 bytes) demuxed
Output file #0 (foo.wav):
Output stream #0:0 (audio): 1149 frames encoded (1323000 samples); 1149
packets muxed (5292000 bytes);
Total: 1149 packets (5292000 bytes) muxed
_______________________________________________
libav-api mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-api