How to Use the FFmpeg Equalizer Filter
This article provides a practical guide on how to use the
equalizer audio filter in FFmpeg. You will learn the
fundamental syntax, key parameters such as frequency, bandwidth, and
gain, and see real-world examples of how to boost or cut specific audio
frequencies to improve your audio files.
The equalizer filter in FFmpeg is a peaking equalizer,
which means it boosts or dampens a specific frequency range around a
central frequency. To apply the filter, you use the -af
(audio filter) option followed by the equalizer parameter
and its arguments.
Basic Syntax
The basic syntax for the equalizer filter is:
ffmpeg -i input.mp3 -af "equalizer=f=FREQUENCY:width_type=TYPE:w=WIDTH:g=GAIN" output.mp3Key Parameters
f(frequency): The central frequency in Hz that you want to target (e.g.,100for bass,1000for mids,10000for treble).width_type: Defines how the bandwidth helperwis measured. Common values include:h: Hz (frequency width)q: Q-factor (quality factor, default)o: Octaves
w(width): The width of the band around the central frequency. A smaller width targets a narrower band, while a larger width affects a broader range.g(gain): The amount of boost or cut applied to the targeted frequency in dB. Use positive values to boost (e.g.,6for +6dB) and negative values to cut (e.g.,-6for -6dB).
Practical Examples
1. Boosting the Bass
To boost low-end frequencies around 60 Hz by 6 dB using a bandwidth of 20 Hz, use the following command:
ffmpeg -i input.wav -af "equalizer=f=60:width_type=h:w=20:g=6" output.wav2. Cutting an Unwanted Hum
If your audio has an annoying hum at 1000 Hz, you can sharply cut that specific frequency by 12 dB using a narrow Q-factor of 2:
ffmpeg -i input.wav -af "equalizer=f=1000:width_type=q:w=2:g=-12" output.wav3. Chaining Multiple Equalizers
If you need to adjust multiple frequency bands at once, you can chain
multiple equalizer filters together, separated by commas.
The following command boosts the bass at 80 Hz and cuts the harsh mids
at 2000 Hz:
ffmpeg -i input.wav -af "equalizer=f=80:width_type=h:w=30:g=5,equalizer=f=2000:width_type=q:w=1:g=-6" output.wav