Reputation: 8058
I've noticed that when I convert an mp3 file to flac, the duration reported in the flac file will often differ from that of the source mp3 file. Mostly this difference is negligible and can be ignored (perhaps a fraction of a second).
However, there are times when the timing is off by several seconds, and this causes my processing pipeline quite a bit of problem.
For instance, take this podcast episode for example. If I run it through ffmpeg, I can see that it has a duration of:
Duration: 00:52:38.39, start: 0.000000, bitrate: 128 kb/s
If I then convert it to flac using the following command:
ffmpeg -i startups-for-the-rest-of-us-448.mp3 -ac 1 -ar 16000 -f flac output.flac
I can see that the duration of the flac file is:
Duration: 00:52:45.65, start: 0.000000, bitrate: 133 kb/s
Note there is an error message during conversion that states:
[mp3 @ 0x7fffd16d6780] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
Does the difference in duration have have to do with the bitrate difference? When I listen to the file it sounds identical, I'm assuming the flac version must be ever so slightly slower as to gain the extra 7 seconds over the course of the podcast.
Upvotes: 0
Views: 500
Reputation: 92928
You should see this near the top of the ffmpeg log
Estimating duration from bitrate, this may be inaccurate
MP3s may not have an index so ffmpeg has to estimate duration, which it does using bitrate. Depending on bitrate variance, this estimate can be off.
Run ffmpeg -i in.mp3 -vn -f null -
and check the end of the log for an accurate estimate
size=N/A time=00:52:45.67 bitrate=N/A speed= 761x
Upvotes: 1