[FFmpeg-user] Problem about duration value of converted mp3 file

Edward Park kumowoon1025 at gmail.com
Wed Sep 2 02:07:55 EEST 2020


> When converting a wav file to MP3 using the default option, an error occurs
> in the length.
> Converted using the following command
> ffmpeg.exe -i 1.wav 1.mp3
> The duration of the original wav is 1:09:30, but the length of the
> converted MP3 is 1:07:16.
> The length of the file was checked through Windows Explorer and Windows
> Media Player.
> However, when checking with ocen audio and other software, it is normally
> displayed as 1:09:30.

That's more of a compromise than an error, encoder is most likely lame, and in ffmpeg would use vbr by default with a command like that. So to get accurate duration you pretty much need to decode, and it appears windows media player estimates instead. If there is a difference when you playback with a stopwatch in one hand that would be strange.

> When I tested using the -b:a option, 64k and 96k are converted to the same
> length, but there is a problem with 32k and 48k.
> ffmpeg.exe -i sample_2.wav -b:a 96k sample_2_96.mp3
> In addition, when converting m4a files to MP3, a problem occurs also in 96k.
> Please help me on what to fix or give options.

I think setting the bitrate makes it encode at cbr and that makes it possible to determine the duration more accurately but not sure why different bitrates gives different results.

Actually how confident are you about the accuracy of the input file duration that you are making these comparisons to?

Ted Park

More information about the ffmpeg-user mailing list