Configure FFmpeg Equalizer Frequency Bandwidth Gain

This article provides a quick guide on how to use the FFmpeg equalizer audio filter to adjust specific sound frequencies. You will learn the exact syntax and parameters required to configure the center frequency, bandwidth, and gain to boost or cut targeted frequencies in your audio files.

To configure the equalizer filter in FFmpeg, you apply the -af (audio filter) flag followed by the equalizer filter name and its three primary parameters: f (frequency), width (bandwidth), and g (gain).

The Basic Syntax

The basic structure of the equalizer filter is:

ffmpeg -i input.mp3 -af "equalizer=f=FREQUENCY:width_type=TYPE:width=WIDTH:g=GAIN" output.mp3

Parameter Breakdown

  • f (Frequency): Specifies the center frequency in Hz. This is the exact frequency you want to target (e.g., f=1000 for 1 kHz).
  • width_type (Optional): Defines how the bandwidth (width) is measured. Common options include:
    • h: Hz (default)
    • q: Q-factor (higher Q means narrower bandwidth)
    • o: Octaves
  • width (Bandwidth): Sets the width of the band around the center frequency. If width_type is set to h (Hz), a value of 200 means the filter affects frequencies roughly 100 Hz above and below the center frequency.
  • g (Gain): Sets the amplification or attenuation in dB. Positive values boost the frequency (e.g., g=6 for +6 dB), while negative values cut it (e.g., g=-10 for -10 dB).

Configuration Examples

Example 1: Boosting Mid-Range Frequencies

To boost the 1000 Hz frequency by 6 dB with a bandwidth of 200 Hz, use the following command:

ffmpeg -i input.wav -af "equalizer=f=1000:width_type=h:width=200:g=6" output.wav

Example 2: Attenuating Low-End Hum (Bass Cut)

To reduce a muddy low-frequency hum at 60 Hz by 12 dB using a narrow Q-factor of 2:

ffmpeg -i input.wav -af "equalizer=f=60:width_type=q:width=2:g=-12" output.wav

Example 3: Combining Multiple Equalizer Filters

You can chain multiple equalizer filters together, separated by commas, to target multiple frequencies at once. This example boosts the bass at 100 Hz and cuts the harsh treble at 4000 Hz:

ffmpeg -i input.wav -af "equalizer=f=100:width_type=h:width=50:g=4,equalizer=f=4000:width_type=h:width=500:g=-6" output.wav