How to Use FFmpeg aecho Filter for Delay Effects

This guide explains how to use the aecho filter in FFmpeg to apply audio delay and echo effects to your media files. You will learn the basic syntax of the filter, understand how its key parameters function, and see practical command-line examples to create customized echo effects for your audio and video projects.

Understanding the aecho Syntax

The aecho filter works by mixing the original audio signal with delayed copies of itself. The basic syntax for the filter is:

-af "aecho=in_gain:out_gain:delays:decays"

Each parameter plays a specific role in shaping the delay effect:

  • in_gain: Sets the input volume of the original signal (reflected as a value between 0.0 and 1.0).
  • out_gain: Sets the overall output volume of the processed signal (between 0.0 and 1.0).
  • delays: A list of delay times in milliseconds, separated by the pipe character (|). For example, 1000 represents a 1-second delay.
  • decays: A list of decay factors (volume reduction) for each corresponding delay, separated by the pipe character (|). A decay of 0.5 means the echo is half as loud as the original signal.

Note: The number of decay values must match the number of delay values.


Practical Examples

1. Basic Single Delay (Simple Echo)

To add a single, clear echo that occurs 1 second (1000 milliseconds) after the original sound with a 50% volume drop:

ffmpeg -i input.mp3 -af "aecho=0.8:0.8:1000:0.5" output.mp3

In this command:

  • in_gain and out_gain are set to 0.8 to prevent audio clipping.
  • The sound delays by 1000 ms.
  • The delayed sound decays to 0.5 of its volume.

2. Multi-Echo (Canyon Effect)

You can create multiple successive echoes by specifying multiple delay and decay values. The following command creates two distinct echoes:

ffmpeg -i input.mp3 -af "aecho=0.8:0.88:1000|1800:0.4|0.25" output.mp3

In this command:

  • 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.

3. Short Delay (Reverb/Robotic Effect)

Using very short delay times (under 100 milliseconds) creates a metallic, robotic, or small-room reverb effect instead of a distinct echo:

ffmpeg -i input.mp3 -af "aecho=0.8:0.8:50|100:0.5|0.3" output.mp3

Here, the delays are set to 50 ms and 100 ms, creating a rapid doubling effect that alters the timbre of the audio.