How to Use the Treble Filter in FFmpeg
This guide explains how to use the treble audio filter
in FFmpeg to adjust the high-frequency components of your audio files.
You will learn the basic syntax of the filter, its key
parameters—including gain, frequency, and width—and practical
command-line examples for boosting or cutting treble in your media.
Understanding the Treble Filter
The treble filter in FFmpeg is a high-shelving
equalizer. It allows you to boost or attenuate audio frequencies above a
specified threshold. This is useful for brightening muddy audio
(boosting treble) or reducing harsh high-pitched noises and sibilance
(cutting treble).
Treble Filter Parameters
The filter accepts several options, which can be specified as
key=value pairs separated by colons:
gorgain: Sets the audio boost or attenuation in dB. Positive values boost the treble, while negative values reduce it. The default is0.forfrequency: Sets the filter’s central frequency in Hz. Frequencies around and above this limit will be affected by the gain. The default is3000Hz.worwidth: Sets the bandwidth/slope of the filter. The default is0.5.torwidth_type: Defines the unit of the width parameter. Options includeh(Hz),q(Q-factor),o(octave), ands(slope). The default iso.
Practical Examples
To apply the treble filter, use the audio filter flag
(-af or -filter:a) in your FFmpeg command.
1. Boost Treble
To boost the high frequencies by 6 dB using the default frequency threshold of 3000 Hz, run:
ffmpeg -i input.mp3 -af "treble=g=6" output.mp32. Cut Treble
To reduce harsh high frequencies by 8 dB to make the audio sound warmer, use a negative gain value:
ffmpeg -i input.wav -af "treble=g=-8" output.wav3. Adjust Target Frequency and Width
To target higher frequencies (such as those above 5000 Hz) with a custom width of 1.0 octave and boost them by 5 dB, define the parameters explicitly:
ffmpeg -i input.mp4 -af "treble=g=5:f=5000:w=1.0" -c:v copy output.mp4(Note: The -c:v copy option is used here to copy the
video stream without re-encoding it, which speeds up the
process).