[FFmpeg-trac] #289(undetermined:new): Regression: mp3 duration estimated from bitrate wrong (bitrate guess wrong)

FFmpeg trac at avcodec.org
Mon Jun 20 19:10:00 CEST 2011


#289: Regression: mp3 duration estimated from bitrate wrong (bitrate guess wrong)
-------------------------------------------------+-------------------------
 Reporter:  hjr                                  |        Type:  defect
   Status:  new                                  |    Priority:  normal
Component:  undetermined                         |     Version:  git
 Keywords:  regression mp3 duration bitrate      |  Blocked By:
  estimate                                       |  Reproduced:  0
 Blocking:                                       |
 Analyzed:  0                                    |
-------------------------------------------------+-------------------------
 Bitrate is analyzed wrong and mp3 duration is way off then.

 == Recent win32 build ==

 {{{
 >ffmpeg -v 9 -loglevel 99 -i duration-problem.mp3
 ffmpeg version git-N-30698-g39dbe9b, Copyright (c) 2000-2011 the FFmpeg
 developers
   built on Jun 10 2011 22:10:00 with gcc 4.5.3
   configuration: --enable-gpl --enable-version3 --enable-memalign-hack
 --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-
 frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-
 libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg
 --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-
 libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-
 libxavs --enable-libxvid --enable-zlib --disable-outdev=sdl --pkg-config
 =pkg-config
   libavutil    51.  8. 0 / 51.  8. 0
   libavcodec   53.  7. 0 / 53.  7. 0
   libavformat  53.  3. 0 / 53.  3. 0
   libavdevice  53.  1. 1 / 53.  1. 1
   libavfilter   2. 15. 0 /  2. 15. 0
   libswscale    0. 14. 1 /  0. 14. 1
   libpostproc  51.  2. 0 / 51.  2. 0
 [NULL @ 01DDA180] Format mp3 probed with size=2048 and score=51
 [mp3 @ 01DDA180] max_analyze_duration 5000000 reached at 5015510
 [mp3 @ 01DDA180] Estimating duration from bitrate, this may be inaccurate
 Input #0, mp3, from 'duration-problem.mp3':
   Metadata:
     encoder         : Lavf52.39.2
   Duration: 00:14:44.44, start: 0.000000, bitrate: 32 kb/s
     Stream #0.0, 194, 1/14112000: Audio: mp3, 44100 Hz, stereo, s16, 32
 kb/s
 At least one output file must be specified
 }}}

 Duration and bitrate is incorrect, the file is actually 192 kb/s, duration
 00:02:27.40, as shown below:

 == Old ffmpeg on FreeBSD box (hence the regression) ==

 (unfortunately I don't have root on our servers, so I cannot test various
 builds on BSD)

 {{{
 >ffmpeg -v 9 -i duration-problem.mp3
 FFmpeg version 0.5.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
   configuration: --prefix=/usr/local --mandir=/usr/local/man --enable-
 shared --enable-gpl --enable-swscale --enable-postproc --enable-avfilter
 --enable-avfilter-lavf --enable-pthreads --enable-memalign-hack --cc=cc
 --extra-cflags=-I/usr/local/include/vorbis -I/usr/local/include --extra-
 ldflags=-L/usr/local/lib  --extra-libs=-pthread --disable-debug --disable-
 mmx --enable-libamr-nb --enable-nonfree --enable-libamr-wb --enable-
 nonfree --disable-libdirac --disable-libfaac --enable-libfaad --enable-
 libfaadbin --enable-libgsm --disable-vhook --disable-ipv6 --enable-
 libmp3lame --disable-libopenjpeg --enable-libschroedinger --disable-ffplay
 --disable-libspeex --enable-libtheora --enable-libvorbis --disable-x11grab
 --enable-libx264 --disable-libxvid
   libavutil     49.15. 0 / 49.15. 0
   libavcodec    52.20. 1 / 52.20. 1
   libavformat   52.31. 0 / 52.31. 0
   libavdevice   52. 1. 0 / 52. 1. 0
   libavfilter    0. 4. 0 /  0. 4. 0
   libswscale     0. 7. 1 /  0. 7. 1
   libpostproc   51. 2. 0 / 51. 2. 0
   built on Mar 11 2010 14:16:57, gcc: 4.2.1 20070719  [FreeBSD]
 Input #0, mp3, from 'duration-problem.mp3':
   Duration: 00:02:27.40, start: 0.000000, bitrate: 192 kb/s
     Stream #0.0, 1/90000: Audio: mp3, 44100 Hz, stereo, s16, 192 kb/s
 At least one output file must be specified
 }}}

 My guess is that this is related to https://roundup.libav.org/issue1954
 (at least the build that introduces the problem is the same)

 You can find the original file at http://usr.bandzone.cz/test/mp3
 /duration-problem.mp3 (~3.5MB)
 I can provide much more files that are affected, if needed.

 When I cut and/or recode the file, ie.

 {{{
 ffmpeg -i duration-problem.mp3 -acodec copy -t 5 ffmpeg-copy.mp3
 }}}

 and

 {{{
 ffmpeg -i duration-problem.mp3 -acodec libmp3lame -aq 2 -t 5 ffmpeg-
 recode.mp3
 }}}

 everything gets guessed alright, for lengths up to the original file.

 Interesting thing to note, when I cut and/or recode the file with recent
 libav build, ffmpeg produces this bug again (and so does libav). I used
 the same commands as above, but with the libav binary. I'm attaching these
 files as well as ffmpeg output, the duration reported should be 5 seconds:

 {{{
 >ffmpeg -v 9 -loglevel 99 -i libav-copy.mp3
 ffmpeg version git-N-30698-g39dbe9b, Copyright (c) 2000-2011 the FFmpeg
 developers
   built on Jun 10 2011 22:10:00 with gcc 4.5.3
   configuration: --enable-gpl --enable-version3 --enable-memalign-hack
 --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-
 frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-
 libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg
 --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-
 libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-
 libxavs --enable-libxvid --enable-zlib --disable-outdev=sdl --pkg-config
 =pkg-config
   libavutil    51.  8. 0 / 51.  8. 0
   libavcodec   53.  7. 0 / 53.  7. 0
   libavformat  53.  3. 0 / 53.  3. 0
   libavdevice  53.  1. 1 / 53.  1. 1
   libavfilter   2. 15. 0 /  2. 15. 0
   libswscale    0. 14. 1 /  0. 14. 1
   libpostproc  51.  2. 0 / 51.  2. 0
 [NULL @ 002FA160] Format mp3 probed with size=2048 and score=51
 [mp3 @ 002FA160] Estimating duration from bitrate, this may be inaccurate
 Input #0, mp3, from 'libav-copy.mp3':
   Metadata:
     encoder         : Lavf53.2.0
   Duration: 00:00:26.28, start: 0.000000, bitrate: 32 kb/s
     Stream #0.0, 192, 1/14112000: Audio: mp3, 44100 Hz, stereo, s16, 32
 kb/s
 At least one output file must be specified
 }}}

 {{{
 >ffmpeg -v 9 -loglevel 99 -i libav-recode.mp3
 ffmpeg version git-N-30698-g39dbe9b, Copyright (c) 2000-2011 the FFmpeg
 developers
   built on Jun 10 2011 22:10:00 with gcc 4.5.3
   configuration: --enable-gpl --enable-version3 --enable-memalign-hack
 --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-
 frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-
 libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg
 --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-
 libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-
 libxavs --enable-libxvid --enable-zlib --disable-outdev=sdl --pkg-config
 =pkg-config
   libavutil    51.  8. 0 / 51.  8. 0
   libavcodec   53.  7. 0 / 53.  7. 0
   libavformat  53.  3. 0 / 53.  3. 0
   libavdevice  53.  1. 1 / 53.  1. 1
   libavfilter   2. 15. 0 /  2. 15. 0
   libswscale    0. 14. 1 /  0. 14. 1
   libpostproc  51.  2. 0 / 51.  2. 0
 [NULL @ 002DA160] Format mp3 probed with size=2048 and score=51
 [mp3 @ 002DA160] Estimating duration from bitrate, this may be inaccurate
 Input #0, mp3, from 'libav-recode.mp3':
   Metadata:
     encoder         : Lavf53.2.0
   Duration: 00:00:27.37, start: 0.000000, bitrate: 32 kb/s
     Stream #0.0, 193, 1/14112000: Audio: mp3, 44100 Hz, stereo, s16, 32
 kb/s
 At least one output file must be specified
 }}}

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/289>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list