I used Audacity 3.2.5 to create a two-track audio file for testing purposes and exported it to FLAC and mp3 within Audacity. The FLAC file has the wrong duration, it is too short. The mp3 file is the correct duration. I would like to know how to fix this or if it is a bug.
EDIT: See later posts. In fact both exported files are the correct length (4 seconds) but the FLAC file suffers an audible glitch, which is not present in the mp3 output file. My apologies for the error in the original post.
I can’t reproduce this.
- import a stereo audio file
- cut it to exactly 3 minutes
- export as MP3
- export as FLAC
- import the two exported files back into the same project
The imported FLAC file is exactly 3 minutes long.
The imported MP3 file is 3:00.036 long.
I would post the example project and output files but I am prohibited as a ‘new user’.
How far off is it?
How are you measuring/comparing the durations?
What’s the original format? Sometimes compressed audio/video files have “timing problems” and the timing changes when you convert the audio or when you demultiplex the audio & video.
MP3 is lossy compression… The data is changed… As part of the process it adds a tiny amount of silence to the beginning and end.
FLAC is lossless. At a fixed-known sample rate (i.e. 44.100 samples per second, etc.) the FLAC has EXACTLY the same number of samples as the original and therefore the exact same duration as the original (unless the sample rate is somehow changed).
The actual-analog playback duration depends on the clock (oscillator) in the soundcard/device and no clock is perfect.
I should explain and clarify my problem. I used Audacity to create a two-track project with a tone in each channel for audio testing purposes. In the first channel it is 2 seconds long followed by a 2 second silence. In the second channel it is the same, but the 2 second silence precedes the tone. The intent is to test a stereo output (one channel being assigned left, the other right).
I checked again and I was wrong to say the mp3 and FLAC output files are of different durations. They are both 4 seconds long (as expected) according to VLC. However the FLAC output has a glitch that I mistook for a shortening of the file. The mp3 on the other hand is glitch free and sounds as expected.
Unfortunately I cannot upload the files as evidence.