Use FFmpeg firequalizer for Custom Frequency Curves
This article explains how to use the firequalizer audio
filter in FFmpeg to apply custom, arbitrary frequency response curves.
You will learn the syntax for defining specific gain values at precise
frequencies using the gain_entry parameter, understand how
to format the command, and see practical examples for shaping your
audio’s frequency spectrum.
Understanding the firequalizer Filter
The firequalizer is a powerful finite impulse response
(FIR) equalizer filter in FFmpeg. Unlike standard parametric equalizers
that use fixed bands, firequalizer allows you to define an
arbitrary frequency response curve by specifying gain values (in
decibels) at any frequency points you choose. FFmpeg then interpolates
between these points to create a smooth equalization curve.
Defining the Curve with gain_entry
To define an arbitrary curve, you use the gain_entry
option. The syntax requires you to define individual coordinate points
using the entry(f, g) function, where f is the
frequency in Hertz (Hz) and g is the desired gain in
decibels (dB). Multiple entries are separated by semicolons.
The basic syntax for the filter is:
firequalizer=gain_entry='entry(f1, g1); entry(f2, g2); entry(f3, g3)'Practical Example
If you want to apply a curve that reduces low-end rumble, dips the mids at 1 kHz, and boosts the highs at 10 kHz, you can write the command like this:
ffmpeg -i input.wav -af "firequalizer=gain_entry='entry(0, -20); entry(100, 0); entry(1000, -6); entry(10000, 4); entry(20000, 0)'" output.wavIn this example: * entry(0, -20):
Sub-bass frequencies starting at 0 Hz are cut by 20 dB. *
entry(100, 0): The curve rises to 0 dB
(neutral) by 100 Hz. * entry(1000, -6):
The mid-range at 1 kHz is cut by 6 dB. *
entry(10000, 4): The treble at 10 kHz is
boosted by 4 dB. * entry(20000, 0): The
curve returns to 0 dB at the limit of human hearing (20 kHz).
Advanced Configuration Options
You can further customize how firequalizer interprets
your custom curve using additional parameters:
1. Frequency Scaling
(scale)
By default, FFmpeg interpolates frequencies linearly. You can change
this to a logarithmic scale, which better matches human hearing
perception, by using the scale parameter:
ffmpeg -i input.wav -af "firequalizer=scale=log:gain_entry='entry(100, -3); entry(1000, 3)'" output.wavAvailable scales include lin (linear), log
(logarithmic), inverse (inverse linear), and
cubic (cubic spline).
2. Equalizer Delay
(delay)
The delay parameter controls the filter’s latency. A
longer delay allows for more precise frequency resolution, especially in
the low end, but increases processing time and audio latency. The
default is 0.05 seconds.
ffmpeg -i input.wav -af "firequalizer=delay=0.1:gain_entry='entry(50, 6); entry(150, 0)'" output.wav