[FFmpeg-user] ffmpeg doubles play time converting 48K to 44.1K

Ian! D. Allen idallen at idallen.ca
Mon Oct 14 13:36:12 EEST 2024


Why does ffmpeg double the play time in a conversion from 48K to 44.1K?
If I turn off the Xing header in the conversion, the play time is correct.
See the eyeD3 times below.  VLC shows these times as well.

Ubuntu 24.04.1 LTS - ffmpeg version 6.1.1-3ubuntu5+esm2
(also true for Ubunto 20.04.6 LTS - ffmpeg version 4.2.7-0ubuntu0.1+esm6)

$ ffmpeg -i i.mp3 -ar 44100 bad.mp3
ffmpeg version 6.1.1-3ubuntu5+esm2 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13 (Ubuntu 13.2.0-23ubuntu4)
  configuration: --prefix=/usr --extra-version=3ubuntu5+esm2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --disable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, mp3, from 'i.mp3':
  Metadata:
    encoder         : Lavf58.16.100
  Duration: 00:08:31.56, start: 0.023021, bitrate: 256 kb/s
  Stream #0:0: Audio: mp3, 48000 Hz, stereo, fltp, 256 kb/s
    Metadata:
      encoder         : Lavc58.19
Stream mapping:
  Stream #0:0 -> #0:0 (mp3 (mp3float) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, mp3, to 'bad.mp3':
  Metadata:
    TSSE            : Lavf60.16.100
  Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp
    Metadata:
      encoder         : Lavc60.31.102 libmp3lame
[libmp3lame @ 0x58d8c740ec80] Trying to remove 1152 samples, but the queue is empty
[out#0/mp3 @ 0x58d8c740be40] video:0kB audio:7993kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.003091%
size=    7994kB time=00:08:31.53 bitrate= 128.0kbits/s speed=22.8x


$ ffmpeg -i i.mp3 -ar 44100 -write_xing 0 good.mp3
[...] same verbose output as above


$ eyeD3 i.mp3 bad.mp3 good.mp3
/xxxxxxxxxxxx/test_mp3/i.mp3                                       [ 15.61 MB ]
Time: 08:32     MPEG1, Layer III        [ 256 kb/s @ 48000 Hz - Stereo ]

/xxxxxxxxxxxx/test_mp3/bad.mp3                                      [ 7.81 MB ]
Time: 17:08     MPEG1, Layer III        [ 64 kb/s @ 44100 Hz - Stereo ]

/xxxxxxxxxxxx/test_mp3/good.mp3                                     [ 7.81 MB ]
Time: 08:33     MPEG1, Layer III        [ 128 kb/s @ 44100 Hz - Joint stereo ]


Why is the Time doubled unless I suppress the Xing header?

Strangely, eyeD3 claims there is no Xing (LAME) header anywhere:


$ eyeD3 -P xing i.mp3 bad.mp3 good.mp3
/xxxxxxxxxxxx/test_mp3/i.mp3                                       [ 15.61 MB ]
No LAME Tag

/xxxxxxxxxxxx/test_mp3/bad.mp3                                      [ 7.81 MB ]
No LAME Tag

/xxxxxxxxxxxx/test_mp3/good.mp3                                     [ 7.81 MB ]
No LAME Tag

(All output of eyeD3 edited to remove unnecessary/irrelevant lines.)

-- 
| Ian! D. Allen, BA-Psych, MMath-CompSci  idallen at idallen.ca Ottawa CANADA
| Home: www.idallen.com  Contact Improvisation Dance: www.contactimprov.ca
| Former college professor of Free/Libre GNU+Linux @ teaching.idallen.com
| Improve democracy www.fairvote.ca and defend digital freedom www.eff.org


More information about the ffmpeg-user mailing list