Add Flanger Effect to Audio Using FFmpeg
This article provides a quick guide on how to apply a flanger effect to an audio file using FFmpeg. You will learn the basic command to apply the effect instantly, as well as how to customize various parameters—such as delay, depth, feedback, and speed—to achieve the exact sound you want.
The Basic Flanger Command
To apply a default flanger effect to an audio file, use the
-af (audio filter) flag followed by the
flanger filter. Run the following command in your
terminal:
ffmpeg -i input.mp3 -af flanger output.mp3This command takes your input file (input.mp3), applies
the default flanger settings, and exports the processed audio to
output.mp3.
Customizing Flanger Parameters
The FFmpeg flanger filter allows you to fine-tune the
effect by adjusting several parameters. The syntax for adding parameters
is flanger=parameter1=value1:parameter2=value2.
Here are the most common parameters you can adjust:
delay: Sets the base delay in milliseconds. The range is 0 to 30 (default is 0).depth: Sets the sweep depth in milliseconds. The range is 0 to 10 (default is 2).regen: Sets the regeneration (feedback) percentage. The range is -95 to 95 (default is 0).width: Sets the sweep width percentage. The range is 0 to 100 (default is 71).speed: Sets the sweep speed in Hz (LFO frequency). The range is 0.1 to 10 (default is 0.5).shape: Sets the LFO sweeping waveform shape. Options aresine(default) ortriangular.phase: Sets the swept phase shift percentage in stereo. The range is 0 to 100 (default is 25).
Practical Examples
1. Subtle, Slow Flanger
For a gentle sweeping effect that is not too distracting, use a slow speed and moderate depth:
ffmpeg -i input.wav -af "flanger=delay=10:depth=2:regen=20:speed=0.2" output.wav2. Intense “Jet-Plane” Flanger
To achieve the classic dramatic, metallic “whoosh” sound associated with jet engines, increase the regeneration (feedback) and depth:
ffmpeg -i input.wav -af "flanger=delay=20:depth=4:regen=80:width=90:speed=0.8" output.wav3. Fast, Vibrato-like Flanger
For a rapid, warbling flanger effect, increase the LFO speed parameter:
ffmpeg -i input.wav -af "flanger=delay=5:depth=3:regen=50:speed=4.0:shape=triangular" output.wav