Exporting to mp3 adds silence at the beginning of the file and truncates the sound at the end
Both LAME and FFmpeg add about 54ms of silence to the beginning of the mp3 file, which makes for a noticeable pause. The file length is increased to 46,080 samples instead of 44,100. The sound is truncated at the end, and not at a zero crossing, so there is an audible pop. Changing the bit rate mode makes no difference
Is there a problem with the encoders?
Have also exported to ogg, which behaves itself and produces an exact copy of the original
LAME library version 3.99.3
FFmpeg library version F(55.33.100),C(55.52.102),U(52.66.100)
Yes, it’s a limitation of the MP3 format. It’s because the MP3 format does not define the overall encoder/decoder delay. (https://en.wikipedia.org/wiki/MP3)
Some other formats have this problem, but fortunately there’s a good selection of formats that don’t.
For lossless formats, WAV, AIFF and FLAC will give the exact length.
For lossy compressed audio, OGG Vorbis does not have this issue.
Thanks for the quick reply Steve
Thought as much. Unfortunately I need both ogg and mp3 files and for them to be the same length for a project Im working on. Looks like the only solution is to add silence at the end of the ogg file. Time for some experimenting