How to Use FFmpeg adelay Filter to Delay Audio
This guide explains how to use the FFmpeg adelay filter
to delay audio tracks and fix synchronization issues between audio and
video. You will learn the basic syntax of the filter, how to apply
delays in both milliseconds and seconds, and how to target specific
audio channels using practical command-line examples.
Understanding the adelay Filter Syntax
The adelay filter allows you to delay individual audio
channels independently. The basic syntax is:
adelay=delays=delay_channel1|delay_channel2|...
Key points to remember when using this filter: * Channel
Specificity: Delays are mapped to audio channels in order. For
a standard stereo track, the first value applies to the Left channel,
and the second value applies to the Right channel. * Time
Units: By default, the delay is calculated in milliseconds. To
specify the delay in seconds, append an s to the number
(e.g., 2s or 1.5s). * Zero
Delay: If you want to leave a channel untouched, use
0 as its value.
Practical Examples
Example 1: Delaying a Stereo Track by 1.5 Seconds
To delay both the left and right channels of a stereo audio track by 1.5 seconds (1500 milliseconds), use the following command:
ffmpeg -i input.mp4 -af "adelay=1500|1500" -c:v copy output.mp4-af "adelay=1500|1500": Applies a 1500ms delay to both audio channels.-c:v copy: Copies the video stream without re-encoding to save processing time and preserve quality.
Alternatively, you can write the same command using the seconds unit
(s):
ffmpeg -i input.mp4 -af "adelay=1.5s|1.5s" -c:v copy output.mp4Example 2: Delaying Only One Channel
If you only need to delay the left channel by 500 milliseconds while leaving the right channel untouched:
ffmpeg -i input.wav -af "adelay=500|0" output.wavExample 3: Delaying a Specific Audio Stream in Multi-Track Files
If your input file has multiple audio streams and you only want to
apply the delay to the second audio stream (index 1), use
filter_complex to target and map the streams:
ffmpeg -i input.mp4 -filter_complex "[0:a:1]adelay=2s|2s[delayed]" -map 0:v -map "[delayed]" -c:v copy output.mp4[0:a:1]: Selects the second audio stream of the first input file.[delayed]: Labels the output of the filter, which is then mapped to the output file using-map "[delayed]".