Delay Right Channel of Stereo Audio in FFmpeg
This article explains how to delay only the right channel of a stereo audio file using FFmpeg. You will learn the exact command-line syntax and filters required to apply a precise time delay to the right channel while leaving the left channel untouched, resulting in a modified stereo output file.
To delay only the right channel of a stereo audio file, you can use
FFmpeg’s built-in adelay filter. This filter allows you to
specify distinct delay times for each individual audio channel,
separated by a pipe (|) character.
The Basic Command
To delay the right channel by a specific number of milliseconds, use the following command structure:
ffmpeg -i input.mp3 -af "adelay=0|500" output.mp3How It Works
-i input.mp3: Specifies the input audio file.-af: Applies an audio filter."adelay=0|500": This is the delay filter argument.- The first value (
0) represents the delay for the first channel (Left) in milliseconds. - The second value (
500) represents the delay for the second channel (Right) in milliseconds.
- The first value (
output.mp3: The name of the resulting output file.
Delaying by Samples
If you require sample-accurate delays instead of milliseconds, you
can append an S to the delay values. For example, to delay
the right channel by 22,050 samples:
ffmpeg -i input.wav -af "adelay=0|22050S" output.wavApplying to Video Files
If your audio is part of a video file and you want to delay the right audio channel while copying the video stream without re-encoding it, use this command:
ffmpeg -i input.mp4 -af "adelay=0|500" -c:v copy output.mp4