Load Custom Equalizer Text File in FFmpeg Firequalizer
The FFmpeg firequalizer (Finite Impulse Response
Equalizer) filter is a powerful tool for shaping audio frequency
responses using custom curves. This article provides a clear,
step-by-step guide on how to format a custom equalization text file and
load it directly into the firequalizer filter to apply
precise audio adjustments to your media files.
Step 1: Create the Custom EQ Text File
First, you need to create a plain text file (e.g.,
eq.txt) containing your equalization points. Each line in
the file must define a frequency in Hertz (Hz) followed by the desired
gain in decibels (dB), separated by a space.
Create a file named eq.txt and format it like this:
20 -10
100 -5
1000 0
4000 3
16000 6
In this example, the audio at 20 Hz is attenuated by -10 dB, while the high frequencies at 16,000 Hz are boosted by 6 dB.
Step 2: Load the File into FFmpeg
To load this file into the firequalizer filter, use the
gain_entry parameter prefixed with the @
symbol. This symbol tells FFmpeg to treat the following string as a file
path rather than an inline formula.
Run the following command in your terminal:
ffmpeg -i input.wav -af "firequalizer=gain_entry='@eq.txt'" output.wavStep 3: Choose an Interpolation Method (Optional)
By default, FFmpeg will construct a smooth curve between your
specified frequency points. You can explicitly define how FFmpeg
interpolates the space between your points using the gain
option.
Cubic Interpolation (Default / Smooth curves)
ffmpeg -i input.wav -af "firequalizer=gain='cubic_interpolate(f)':gain_entry='@eq.txt'" output.wavLinear Interpolation (Straight lines between points)
ffmpeg -i input.wav -af "firequalizer=gain='linear_interpolate(f)':gain_entry='@eq.txt'" output.wav