Configure Channel Delay in FFmpeg adelay Filter
This guide explains how to use the FFmpeg adelay filter
to configure independent delay times for individual audio channels. You
will learn the syntax structure, how to specify delays in milliseconds
or samples, and how to apply these delays to specific channels in stereo
or multi-channel audio files.
The Basic Syntax of
adelay
The adelay filter applies a delay to each audio channel
individually. The delays are specified as a list of times separated by a
pipe character (|).
The basic syntax is:
-af "adelay=delay_channel_1|delay_channel_2|delay_channel_3..."By default, the delay values are mapped to the audio channels in their standard order (for example, Left then Right in a stereo track). If you provide fewer delay values than there are channels in the input, the remaining channels will not be delayed.
Specifying Delay Units
You can specify the delay time using two different units:
- Milliseconds (Default): Use plain integers to
define the delay in milliseconds.
- Example:
1000results in a 1-second (1000ms) delay.
- Example:
- Samples: Append the letter
S(ors) to the number to specify the delay in audio samples.- Example:
44100Sresults in a 1-second delay if the audio sample rate is 44.1 kHz.
- Example:
Practical Examples
1. Delaying Stereo Channels Separately
To delay the Left channel by 500 milliseconds and the Right channel by 1500 milliseconds, use the following command:
ffmpeg -i input.wav -af "adelay=500|1500" output.wav2. Delaying Only the Right Channel
To keep the Left channel playing instantly but delay the Right
channel by 2000 milliseconds, set the first channel’s delay to
0 or leave it empty:
ffmpeg -i input.wav -af "adelay=0|2000" output.wav(Alternatively, you can write adelay=|2000)
3. Delaying Using Samples
To delay the Left channel by 22,050 samples and the Right channel by 44,100 samples:
ffmpeg -i input.wav -af "adelay=22050S|44100S" output.wav4. Multi-Channel (5.1 Surround) Delay
For a 5.1 surround sound layout (typically ordered as Front Left, Front Right, Center, LFE, Back Left, Back Right), you can delay specific channels by mapping them in order.
To delay only the Center (3rd) and LFE (4th) channels by 1000 milliseconds:
ffmpeg -i input.wav -af "adelay=0|0|1000|1000" output.wav