[FFmpeg-user] Transcoding with different codec (libfdk_aac) alters duration, how to fix?

frafart at free.fr frafart at free.fr
Mon Dec 30 15:17:48 CET 2013

----- Mail original -----
> De: "Soeren Balko" <soeren at zfaas.com>
> À: "FFmpeg user questions" <ffmpeg-user at ffmpeg.org>
> Envoyé: Dimanche 29 Décembre 2013 13:19:02
> Objet: Re: [FFmpeg-user] Transcoding with different codec (libfdk_aac) alters duration, how to fix?
> I figured that FFmpeg prefixes and suffixes transcoded audio streams
> with
> "mute" intervals for other codecs too.

Yes, AAC is not the only one.

> In the same audio, I found that the
> prefix/suffix lengths are libfdk_aac: 0.01024/0.01179 sec; libfaac:
> 0.0/0.01182 sec; mp2: 0.0044/0.00148 sec; ac3: 0.00257/0.00414 sec.

Prefix must be fixed. Suffixes is the padding of the last audio fragment, so must be variable.

> I wonder if there is a way to stop the
> encoders from introducing these mute intervals? Will at the least
> look into the libfdk_aac source.

I don't think it's possible, priming seems to be needed by protocol.

In my case and maybe your, I don't think the problem be priming but the fact that audio streams are a bit shorter than video.
In this case, most of "tool to concat" like MP4Box, the concat complex filter of ffmpeg, ... pad the end of audio stream to match with the video length.

For the moment, I try to play with select/aselect to give ffmpeg an audio stream a little bit longer than video (last audio frame pts+duration >last video frame pts+duration).


More information about the ffmpeg-user mailing list