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

Liam Condron-Farnos 23liam at googlemail.com
Sat May 25 15:18:14 CEST 2013

On 25 May 2013 13:45, Tom Horsley <horsley1953 at gmail.com> wrote:
>> 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?
> I don't know about using ffmpeg itself, but I fiddle with audio
> sync problems all the time and I use sox to generate silence
> when I need it. For example:

To generate silence with ffmpeg, use the aevalsrc audio filter


Then, you can use either the concat demuxer (for which you'll have to
generate the sound separately, ad then prepend it to your existing
audio in two distinct commands) or the concat filter (requires
re-encoding, but will allow you to work with a single ffmpeg command).

ffmpeg -filter_complex 'aevalsrc=0:d=2' silence.aac
ffmpeg -f concat -i <(for f in silence.aac audio.aac; do echo file
"'$f'"; done) -c copy out-audio.aac


ffmpeg -i audio.aac  -filter_complex
'aevalsrc=0:d=2[slug];[slug][0]concat=n=2:v=0:a=1[out]' -map '[out]'
-c:a libfdk_aac -vbr 3 out-audio.aac

(change depending on the AAC encoder you have)

http://ffmpeg.org/trac/ffmpeg/wiki/How to concatenate (join, merge) media files

More information about the ffmpeg-user mailing list