How to Create a Comb Filter Effect in FFmpeg

This guide explains how to apply a comb filter effect to an audio stream using FFmpeg. You will learn the specific command-line arguments and audio filters required to mix a delayed version of a signal with the original, creating the distinct metallic, hollow sound characteristic of comb filtering.

To create a comb filter effect in FFmpeg, you use the aecho (audio echo) filter. A comb filter is physically achieved by adding a delayed version of a signal to itself. When the delay time is very short—typically between 1 and 15 milliseconds—the human ear hears spectral coloration (the comb filter effect) rather than a distinct, separate echo.

The FFmpeg Command

Run the following command in your terminal to apply the effect:

ffmpeg -i input.mp3 -af "aecho=0.8:0.8:6:0.7" output.mp3

Parameter Breakdown

The aecho filter uses the syntax aecho=in_gain:out_gain:delays:decays. To achieve a comb filter, the parameters should be configured as follows:

Creating a Flanging Effect (Modulated Comb Filter)

If you want a dynamic, moving comb filter (known as a flanger), you can use FFmpeg’s aphaser filter instead. This modulates the delay time automatically:

ffmpeg -i input.mp3 -af "aphaser=type=t:decay=0.6:speed=0.5:delay=3" output.mp3

In this command, delay=3 sets a 3-millisecond base delay, while speed=0.5 modulates the sweep of the comb filter at 0.5 Hz, creating a classic sweeping psychedelic effect.