Apply Octave-Band Equalizer Using FFmpeg

Applying an octave-band equalizer to an audio file using FFmpeg allows you to precisely shape your sound by boosting or cutting frequencies spaced at standard musical octaves. This guide details how to implement a standard 10-band octave equalizer using FFmpeg's built-in equalizer filter, explains the necessary parameters for octave-based bandwidths, and provides clear command-line examples to process your audio files.

Standard Octave-Band Frequencies

A standard octave-band equalizer divides the audible spectrum into 10 bands where each center frequency is roughly double the previous one:

  • 31.25 Hz (Sub-bass)
  • 62.5 Hz (Bass)
  • 125 Hz (Upper Bass)
  • 250 Hz (Low Midrange)
  • 500 Hz (Midrange)
  • 1000 Hz (1 kHz - Midrange)
  • 2000 Hz (2 kHz - Upper Midrange)
  • 4000 Hz (4 kHz - Presence)
  • 8000 Hz (8 kHz - Brilliance)
  • 16000 Hz (16 kHz - Air)

The FFmpeg equalizer Filter Syntax

FFmpeg provides the equalizer audio filter for peak/bell filters. To make each filter band behave as an octave band, set the filter width type to octaves (width_type=o) and the width to 1.

Key filter parameters:

  • f: Center frequency in Hz.
  • width_type: Set to o for octave bandwidth.
  • w: Bandwidth width. A value of 1 corresponds to a full one-octave band.
  • g: Gain adjustment in decibels (dB). Positive values boost, negative values cut.

Multiple bands are applied simultaneously by chaining filters together with commas (,) inside the -af (audio filter) argument.

FFmpeg Command Example

To apply a 10-band octave equalizer to an audio file, chain the equalizer filter for each of the 10 standard center frequencies:

ffmpeg -i input.mp3 -af "\
equalizer=f=31.25:width_type=o:w=1:g=0,\
equalizer=f=62.5:width_type=o:w=1:g=2,\
equalizer=f=125:width_type=o:w=1:g=3,\
equalizer=f=250:width_type=o:w=1:g=1,\
equalizer=f=500:width_type=o:w=1:g=-2,\
equalizer=f=1000:width_type=o:w=1:g=-1,\
equalizer=f=2000:width_type=o:w=1:g=0,\
equalizer=f=4000:width_type=o:w=1:g=2,\
equalizer=f=8000:width_type=o:w=1:g=3,\
equalizer=f=16000:width_type=o:w=1:g=1" \
-c:a libmp3lame -q:a 2 output.mp3

Explanation of the Command

  • -i input.mp3: Specifies the input source file.
  • -af "...": Applies the chain of ten equalizer stages, with each stage targeting an octave band. Adjust the g (gain) value for each frequency to achieve the desired tone.
  • -c:a libmp3lame: Sets the output audio encoder (use pcm_s16le for WAV, aac for M4A, or keep it consistent with your container format).
  • -q:a 2: Sets a high-quality variable bitrate for MP3 output.
  • output.mp3: Specifies the name and container of the processed output file.

Alternative: Using superequalizer

If you require a preset 18-band graphic equalizer rather than explicitly calculated parametric octave bands, FFmpeg also includes the superequalizer filter:

ffmpeg -i input.wav -af "superequalizer=1b=1.2:2b=1.0:3b=0.8" output.wav

In superequalizer, bands 1b through 18b correspond to fixed frequency steps, where 1.0 represents unity gain (0 dB), values greater than 1.0 amplify the band, and values lower than 1.0 attenuate it.