Load Custom EQ Curves with FFmpeg Firequalizer
This article explains how to load custom equalizer (EQ) response
curves into FFmpeg using the firequalizer audio filter. You
will learn the syntax required to define custom frequency response
curves, how to format configuration files, and how to apply these EQ
curves to your audio files using command-line examples.
The firequalizer filter is a frequency-domain equalizer
that uses finite impulse response (FIR) filtering. Unlike standard
equalizers with fixed bands, it allows you to define a highly
customized, continuous frequency response curve.
Method 1: Specifying EQ Points Directly in the Command
The simplest way to load a custom curve is to define specific
frequency-to-gain coordinate points directly in the FFmpeg command using
the gain_entry parameter.
The syntax for an entry is entry(f, g), where
f is the frequency in Hertz and g is the gain
in decibels (dB).
Command Example:
ffmpeg -i input.mp3 -af "firequalizer=gain_entry='entry(0, -20); entry(100, 0); entry(1000, 3); entry(15000, -6)'" output.mp3In this example: * 0 Hz (sub-bass/DC offset) is cut by -20 dB. * 100 Hz is set to 0 dB (neutral). * 1000 Hz (mid-range) is boosted by +3 dB. * 15000 Hz (high treble) is cut by -6 dB.
By default, FFmpeg uses cubic interpolation
(gain='cubic(f)') to smoothly connect the points you
define.
Method 2: Loading an EQ Curve from an External File
If you have a complex curve with many points, writing them directly in the command line can become impractical. You can save your EQ curve in a plain text file and load it using shell interpolation.
Step 1: Create the EQ Profile File
Create a text file named my_curve.txt and define your
custom curve using entry(f, g) points separated by
semicolons or newlines:
entry(0, -10);
entry(50, -5);
entry(100, 0);
entry(500, 1.5);
entry(1000, 3);
entry(4000, -2);
entry(16000, -5);
entry(20000, -12);
Step 2: Run FFmpeg to Load the File
Use your operating system’s command-line syntax to inject the
contents of the text file into the gain_entry
parameter.
For Linux and macOS (Bash/Zsh):
ffmpeg -i input.wav -af "firequalizer=gain_entry='$(cat my_curve.txt)'" output.wavFor Windows (PowerShell):
ffmpeg -i input.wav -af "firequalizer=gain_entry='$(Get-Content my_curve.txt -Raw)'" output.wavAdvanced Interpolation and Custom Functions
The firequalizer filter uses the gain
parameter to determine how the curve is drawn between your specified
points. You can change this behavior by altering the mathematical
evaluation method:
Cubic Interpolation (Default): Smoothly curves between points.
firequalizer=gain='cubic(f)':gain_entry='entry(100,0); entry(1000,3)'Linear Interpolation: Connects points with straight diagonal lines.
firequalizer=gain='interpolate(f)':gain_entry='entry(100,0); entry(1000,3)'Mathematical Expressions: You can bypass
gain_entrycompletely and use mathematical functions based on the frequency variablef. For example, to create a low-pass filter with a 6 dB per octave slope starting at 1000 Hz:ffmpeg -i input.mp3 -af "firequalizer=gain='-6*log2(f/1000)*clip(isge(f,1000),0,1)'" output.mp3