Configure FFmpeg Treble Filter Cutoff Frequency and Gain
This guide explains how to use the FFmpeg treble audio
filter to adjust the high-frequency response of your audio files. You
will learn the correct command-line syntax to configure both the cutoff
frequency and the gain parameters, allowing you to easily boost or
reduce treble in any audio or video file.
The FFmpeg treble filter is a high-shelving equalizer
that boosts or attenuates high frequencies. To configure this filter,
you apply the -af (audio filter) flag followed by the
treble filter name and its specific parameters.
Filter Parameters
The two primary parameters used to configure this filter are:
gorgain: Determines the amplification or attenuation in decibels (dB). The default value is0dB. Positive values boost the treble, while negative values reduce it. The valid range is-20to20.forfrequency: Sets the cutoff frequency in Hertz (Hz). This is the point where the filter begins to apply the gain. The default value is3000Hz.
An optional parameter, w or
width, defines the filter bandwidth in octaves
(default is 0.5).
Command Syntax and Examples
The basic syntax for applying the filter is:
ffmpeg -i input.mp3 -af "treble=g=GAIN:f=FREQUENCY" output.mp3Example 1: Boosting Treble
To boost the high frequencies above 4000 Hz by 6 dB, use the following command:
ffmpeg -i input.wav -af "treble=g=6:f=4000" output.wavIn this command: * g=6 increases the volume of the
treble by 6 dB. * f=4000 sets the cutoff frequency to 4
kHz.
Example 2: Reducing Treble
If your audio sounds too harsh or has unwanted high-frequency hiss, you can reduce the treble. To decrease frequencies above 3500 Hz by 5 dB, run:
ffmpeg -i input.mp4 -af "treble=g=-5:f=3500" -c:v copy output.mp4Using -c:v copy ensures that the video stream is not
re-encoded, saving time while only the audio filter is applied.