How to Use the FFmpeg Flanger Filter

This article provides a quick guide on how to apply a flanger effect to audio files using the powerful FFmpeg command-line tool. You will learn the basic syntax of the flanger filter, understand its key parameters for adjusting the modulation, depth, and feedback, and see practical examples of how to customize the effect for different audio results.

The flanger filter in FFmpeg works by splitting the audio signal, delaying one part by a continuously varying amount controlled by a Low-Frequency Oscillator (LFO), and mixing it back with the original, unaffected signal. This creates the classic sweeping, metallic sound often heard in music production.

Basic Syntax

To apply the default flanger effect to an audio file, use the -af (audio filter) flag followed by flanger:

ffmpeg -i input.mp3 -af "flanger" output.mp3

Key Parameters

You can customize the flanger effect by passing specific parameters as key-value pairs separated by colons. Here are the most commonly used options:

  • delay: Sets the base delay in milliseconds. The range is 0 to 30 (default is 0).
  • depth: Sets the sweep depth in milliseconds (how far the delay fluctuates). The range is 0 to 10 (default is 2).
  • regen: Sets the percentage of regeneration (feedback). Increasing this value makes the effect sound more intense and metallic. The range is -95 to 95 (default is 0).
  • width: Sets the percentage of the delayed signal mixed back with the original signal. The range is 0 to 100 (default is 71).
  • speed: Sets the LFO sweep speed in Hz (sweeps per second). The range is 0.1 to 10 (default is 0.5).
  • shape: Sets the LFO wave shape. Use sinusoidal (default) for a smooth sweep, or triangular for a more linear sweep.
  • phase: Sets the LFO phase shift in percentage for multi-channel audio to create a stereo widening effect. The range is 0 to 100 (default is 25).

Practical Examples

1. Standard Stereo Flanger

This configuration creates a classic, noticeable flanger sweep suitable for guitars or synthesizers:

ffmpeg -i input.wav -af "flanger=delay=2:depth=4:regen=50:width=71:speed=0.5:shape=sinusoidal" output.wav

2. Heavy Metallic Flanger

To get a harsh, robotic sound, increase the regeneration (regen) and set a shorter delay:

ffmpeg -i input.wav -af "flanger=delay=1:depth=2:regen=85:width=80:speed=1.5" output.wav

3. Slow and Subtle Jet-Plane Sweep

For a slow, dramatic "jet-plane" phase effect, lower the LFO speed and increase the sweep depth:

ffmpeg -i input.wav -af "flanger=delay=8:depth=8:regen=30:width=60:speed=0.1" output.wav