How to Use FFmpeg firequalizer for Custom EQ Curves
This guide demonstrates how to apply arbitrary frequency response
curves to audio streams using FFmpeg's built-in
firequalizer (Finite Impulse Response Equalizer) filter.
You will learn the two primary methods for shaping the frequency
spectrum—using discrete coordinate points with linear interpolation or
using continuous mathematical expressions—along with the critical
parameters needed to control curve accuracy and sound quality.
Core Concepts of
firequalizer
The firequalizer filter shapes audio in the frequency
domain using Fast Fourier Transforms (FFT). Unlike traditional
parametric equalizers that rely on cascaded IIR peak/shelf filters,
firequalizer allows you to define an exact target response
curve across the spectrum from 0 Hz to the Nyquist frequency (half your
sample rate).
You define your custom curve using one of two parameters:
gain_entry: Defines the curve by setting explicit frequency-gain pairs that FFmpeg interpolates between.gain: Defines the curve continuously using a mathematical formula evaluated as a function of frequency (f).
Method 1: Specifying
Points with gain_entry
The gain_entry parameter is the most straightforward
method for creating arbitrary equalizer curves. It takes a list of
entries formatted as entry(frequency, gain_in_dB).
Basic Syntax
ffmpeg -i input.wav -af "firequalizer=gain_entry='entry(f1, g1); entry(f2, g2); ...'" output.wavExample: Multi-Point Custom Curve
To apply a 6 dB boost at 80 Hz, a cut of 3 dB at 400 Hz, a 4 dB boost at 3 kHz, and a steep roll-off above 10 kHz:
ffmpeg -i input.wav -af "firequalizer=gain_entry='entry(0, 0); entry(80, 6); entry(400, -3); entry(3000, 4); entry(10000, 0); entry(14000, -24)'" output.wavNote: Always anchor the curve at 0 Hz and at or near
your maximum expected frequency to prevent undefined gains at the
frequency boundaries.
Method 2:
Mathematical Expressions with gain
The gain parameter lets you describe the target gain in
dB as an algebraic formula using FFmpeg's expression evaluator. The
variable f represents the frequency in Hertz.
Basic Syntax
ffmpeg -i input.wav -af "firequalizer=gain='EXPRESSION'" output.wavExample: Conditional Band Shelf
To apply a 6 dB boost only between 1 kHz and 4 kHz, while keeping all other frequencies flat (0 dB):
ffmpeg -i input.wav -af "firequalizer=gain='if(between(f, 1000, 4000), 6, 0)'" output.wavExample: Continuous Slope (Tilt EQ)
To apply a continuous tilt across the spectrum:
ffmpeg -i input.wav -af "firequalizer=gain='3 * log2(f / 1000)'" output.wavEssential Configuration Parameters
To ensure the filter interprets your custom curve accurately and without audio artifacts, adjust the following optional settings:
1. Frequency and Gain
Scaling (scale)
By default, FFmpeg interpolates frequencies linearly. Because human
hearing is logarithmic, frequency points should usually be interpolated
logarithmically by setting scale=loglin:
ffmpeg -i input.wav -af "firequalizer=scale=loglin:gain_entry='entry(20, 0); entry(100, 4); entry(1000, -2); entry(10000, 3)'" output.wavAvailable scale options:
linlin: Linear frequency scale, linear gain scale.linlog: Linear frequency scale, logarithmic gain scale.loglin(Recommended): Logarithmic frequency scale, linear gain (dB) scale.loglog: Logarithmic frequency scale, logarithmic gain scale.
2. Accuracy and Resolution
(delay)
The delay parameter (measured in seconds) controls the
length of the impulse response filter. A larger delay allows for steeper
slopes and more precise low-frequency control, at the cost of higher
latency and CPU usage:
ffmpeg -i input.wav -af "firequalizer=delay=0.05:gain_entry='...'" output.wavThe default delay is 0.05 seconds (50 ms), which is
typically sufficient for most curves. Increase this up to
0.1 or higher if you need sharp cuts at sub-bass
frequencies below 100 Hz.
3. Window Function
(wfunc)
The window function shapes the transition of the FIR filter kernel.
The default is hann, but you can change it to reduce
ripple:
hann: Balanced roll-off and stop-band attenuation (default).blackman: Provides greater stop-band rejection with slightly wider transition bands.rectangular: Sharpest transitions, but introduces significant frequency rippling.
ffmpeg -i input.wav -af "firequalizer=wfunc=blackman:gain_entry='...'" output.wavComplete Production Example
The following command applies a smooth, log-interpolated headphone
compensation curve with high precision (delay=0.1) and high
dynamic range windowing (wfunc=blackman):
ffmpeg -i source.flac -af "firequalizer=scale=loglin:delay=0.1:wfunc=blackman:gain_entry='entry(20, 3); entry(100, 1.5); entry(800, -1); entry(3500, 4); entry(7000, -2); entry(12000, 1); entry(20000, -4)'" -c:a flac corrected_output.flac