Add Echo Effects with FFmpeg aecho Filter
This article explains how to use the aecho filter in
FFmpeg to apply professional audio echo effects to your media files. You
will learn the basic syntax of the filter, understand what each
parameter does, and see practical command-line examples for creating
both simple and multiple echo effects.
The aecho filter in FFmpeg works by mixing the original
audio signal with one or more delayed copies of itself. The syntax for
the filter is structured as follows:
aecho=in_gain:out_gain:delays:decaysUnderstanding the Parameters
To customize your echo effect, you need to adjust four key parameters:
in_gain: Sets the input volume of the original audio. A value of0.8is commonly used to prevent clipping (distortion) when the echo is added.out_gain: Sets the volume of the final output signal.delays: A list of delay times in milliseconds (ms), separated by a pipe character (|). For example,1000creates a 1-second delay.decays: A list of decay factors for each corresponding delay, separated by a pipe character (|). This determines how loud each echo is relative to the original sound (e.g.,0.5means the echo is half as loud as the original).
Example 1: Creating a Simple, Single Echo
To add a single, clean echo that occurs 1 second (1000 milliseconds) after the original sound with half the original volume, use the following command:
ffmpeg -i input.mp3 -af "aecho=0.8:0.8:1000:0.5" output.mp3In this command: * in_gain and out_gain are
set to 0.8 to avoid digital clipping. * The delay is set to
1000 ms. * The decay is set to 0.5, meaning
the echo fades out by 50%.
Example 2: Creating Multiple Echoes (Canyon Effect)
You can chain multiple delays to create a richer, “canyon-like” echo
effect. This is done by adding multiple values to the
delays and decays parameters, separated by
pipes (|):
ffmpeg -i input.wav -af "aecho=0.8:0.9:1000|1800|2500:0.4|0.25|0.1" output.wavIn this example: * The first echo occurs at 1000 ms with
a decay of 0.4. * The second echo occurs at
1800 ms with a decay of 0.25. * The third echo
occurs at 2500 ms with a decay of 0.1.
Tips for Best Results
- Avoid Clipping: If the output audio sounds
distorted, lower both the
in_gainandout_gainvalues (e.g., to0.6or0.5). - Match Delays and Decays: Ensure the number of delay values matches the number of decay values. If you specify three delays, you must specify three decays.