Using FFmpeg anequalizer for Parametric Audio EQ

The anequalizer filter in FFmpeg provides a flexible way to shape audio by applying custom second-order parametric IIR (Infinite Impulse Response) filters across independent or combined audio channels. This article covers the fundamental syntax of anequalizer, breaks down its key parameters—such as center frequency, bandwidth, gain, and filter types—and provides practical command-line examples for creating single-band and multi-band parametric equalization profiles.


Understanding the anequalizer Syntax

The anequalizer filter works by configuring individual second-order filter bands separated by the vertical bar (|) delimiter. Each specification targets a specific channel and defines how the parametric curve behaves.

The basic syntax inside an FFmpeg command looks like this:

ffmpeg -i input.wav -af "anequalizer=params='c0 f=1000 w=200 g=3 t=0'" output.wav

Filter Parameters Explained

Each filter section requires four core parameters:

  • Channel (c0, c1, ...): Specifies the zero-indexed audio channel to apply the filter to. c0 corresponds to the left channel (or mono), and c1 corresponds to the right channel in standard stereo audio.
  • Frequency (f): Sets the center frequency of the parametric band in Hertz (Hz). For example, f=1000 targets 1 kHz.
  • Bandwidth (w): Sets the width or bandwidth of the filter in Hertz (Hz). A lower value creates a sharp, narrow notch or peak, while a higher value creates a broad, smooth adjustment.
  • Gain (g): Specifies the boost or cut applied at the center frequency, measured in decibels (dB). Positive values (e.g., g=6) boost the frequency, while negative values (e.g., g=-6) attenuate it.
  • Filter Type (t): Selects the underlying second-order filter approximation algorithm:
    • t=0: Butterworth (flat passband response, smooth roll-off)
    • t=1: Chebyshev Type 1 (steeper roll-off with ripple in the passband)
    • t=2: Chebyshev Type 2 (flat passband with ripple in the stopband)

Common Usage Examples

1. Applying a Single Parametric Boost to Both Channels

To boost 2.5 kHz by 4 dB with a 500 Hz bandwidth on both channels of a stereo file using a Butterworth profile:

ffmpeg -i input.wav -af "anequalizer=params='c0 f=2500 w=500 g=4 t=0 | c1 f=2500 w=500 g=4 t=0'" output.wav

2. Creating a Narrow Notch Filter to Remove Hum

To remove a 60 Hz electrical hum without affecting nearby low-end frequencies, set a high attenuation and a very narrow bandwidth:

ffmpeg -i input.mp3 -af "anequalizer=params='c0 f=60 w=10 g=-24 t=0 | c1 f=60 w=10 g=-24 t=0'" output.mp3

3. Building a Multi-Band Equalizer Profile

You can chain multiple bands for each channel by adding additional filter definitions separated by the pipe character. The following example applies a low cut, a mid scoop, and a high-frequency presence boost:

ffmpeg -i input.wav -af "anequalizer=params='\
c0 f=120 w=50 g=-6 t=0 | c1 f=120 w=50 g=-6 t=0 | \
c0 f=800 w=300 g=-3 t=0 | c1 f=800 w=300 g=-3 t=0 | \
c0 f=8000 w=2000 g=5 t=0 | c1 f=8000 w=2000 g=5 t=0'" output.wav

4. Independent Left/Right Channel Processing

Because each band explicitly declares its target channel, you can equalize channels independently. This is useful for balancing asymmetric stereo recordings:

ffmpeg -i input.wav -af "anequalizer=params='c0 f=1500 w=400 g=3 t=0 | c1 f=3000 w=600 g=-2 t=0'" output.wav

Managing Clipping and Gain

Applying positive gain values (g > 0) can push audio levels beyond 0 dBFS, causing digital distortion and clipping. When significantly boosting frequencies with anequalizer, it is best practice to pair the filter with the volume filter to add negative preamp gain:

ffmpeg -i input.wav -af "volume=-3dB,anequalizer=params='c0 f=1000 w=200 g=6 t=0 | c1 f=1000 w=200 g=6 t=0'" output.wav