FFmpeg adelay: Pad Audio with Silence at Beginning

Padding an audio track with silence at the beginning is a common task in audio and video editing. This article provides a straightforward guide on how to use the FFmpeg adelay filter to insert a specific duration of silence at the start of an audio file, detailing the exact command-line syntax for both stereo and multi-channel audio tracks.

The Basic Command Syntax

The adelay filter works by delaying the start of the audio channels. When you delay an audio stream, FFmpeg automatically fills the resulting gap at the beginning with silence.

The simplest way to apply this filter to all audio channels is by using the all=1 option.

ffmpeg -i input.mp3 -af "adelay=3000:all=1" output.mp3

Explaining the Parameters

Specifying Delay in Seconds

If you prefer not to calculate milliseconds, you can append s to the number to specify the delay in seconds:

ffmpeg -i input.wav -af "adelay=5s:all=1" output.wav

This command inserts exactly 5 seconds of silence at the start of the audio file.

Delaying Channels Individually (Alternative Method)

If you are using an older version of FFmpeg that does not support the all=1 parameter, or if you want to delay channels by different amounts, you must specify the delay for each channel individually, separated by a pipe (|) character.

For a standard stereo (2-channel) file:

ffmpeg -i input.mp3 -af "adelay=3000|3000" output.mp3

For a 5.1 surround sound (6-channel) file:

ffmpeg -i input.wav -af "adelay=3000|3000|3000|3000|3000|3000" output.wav

Note: If you do not specify a delay for every channel in the stream, the unmapped channels will not be delayed, resulting in desynchronized audio.