[FFmpeg-user] converting to AAC audio duration changes

Mark Himsley mark.himsley at gmail.com
Tue Sep 17 17:25:35 CEST 2013


Hi Jeanne,

On 16 September 2013 22:44, Jeanne Rich <jrich at laika.com> wrote:
> Hi.
>
> I'm trying to create an H.264 with AAC audio quicktime movie from an DNxHD quicktime movie with PCM audio. What I am noticing is that the AAC audio ends up having a longer duration than the original PCM audio and starts at a negative timestamp. This is causing me problems since my tools think the resulting movie is longer than it actually should be.


I've had this discussion before.

The thing is, AAC compressed audio has a frame size that is different
from the frame size of of the video (as you can see in your ffprobe
output)

[STREAM]
index=0
codec_name=h264
...
nb_frames=3099
...
[STREAM]
index=1
codec_name=aac
...
nb_frames=6054
...

They are not even multiples of each other. So it is inevitable that in
order to not lose any audio the AAC compressed audio must be longer
than the PCM audio.

I believe the other interesting thing about AAC compressed audio is
that the audio frames overlap and the output audio is the sum of two
overlapping two half frames. That gives a problem at the start (and
the end) of the audio where the AAC has to be extended (backwards, for
the start) by half a frame such that the start (and end) of the audio
is at the right audio level.


The real answer is - you have to live with it, because that's how
compressed audio works.

I hope this explanation helps.

-- 
Mark Himsley


More information about the ffmpeg-user mailing list