[FFmpeg-user] How to add padding silence for MP4 container?

Francois Visagie francois.visagie at gmail.com
Sun May 26 11:13:32 CEST 2013


> -----Original Message-----
> From: ffmpeg-user-bounces at ffmpeg.org [mailto:ffmpeg-user-
> bounces at ffmpeg.org] On Behalf Of Paul B Mahol
> Sent: 25 May 2013 15:28
> To: FFmpeg user questions
> Subject: Re: [FFmpeg-user] How to add padding silence for MP4 container?
> 
> On 5/25/13, Paul B Mahol <onemda at gmail.com> wrote:
> > On 5/25/13, Francois Visagie <francois.visagie at gmail.com> wrote:
> >> Hi All,
> >>
> >>
> >>
> >> I'm trying to help someone who needs to delay his audio stream by 2s:
he
> >> got
> >> given a .mp4 file containing only video and a .aac file with audio
which
> >> he
> >> needs to mux together delaying the audio by 2s.
> >>
> >>
> >>
> >> This works perfectly for MKV:
> >>
> >>
> >>
> >>                 ffmpeg -i invideo.mp4 -itsoffset 00:00:02.000 -i
> >> inaudio.aac
> >> -codec:v copy -codec:a copy out.mkv
> >>
> >>
> >>
> >> However, he'd prefer the MP4 container format. Although the ffmpeg
> >> command
> >> completes perfectly, no player on my machine respects the MP4
> timestamps
> >> and
> >> I've seen this reported elsewhere also.
> >>
> >>
> >>
> >> So instead of using timestamps with MP4, is there a way to tell ffmpeg
to
> >> insert 2s of silence at the beginning of the audio?
> >
> > ffmpeg -i input -af aresample=firts_pts=X
> >
> > where X is 2 * sample_rate of your audio stream.
> >
> > you can't use -codec:a copy to insert real silence.
> 
> Well, you actually can, and that is "complicated" way, that others
> have mentioned.
> 
> Note that in such case: creating silence, encoding silence into aac,
> and than concatenating
> silence and audio into another stream without transcoding, you can not
> have always exact
> precision, so 2s delay may be possible or may not (i never tried so
dunno).

Thanks for all the inputs, much appreciated!

> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user



More information about the ffmpeg-user mailing list