How to Use the Bass Filter in FFmpeg
This article provides a straightforward guide on how to use the
bass audio filter in FFmpeg to boost or attenuate
low-frequency signals in your audio files. You will learn the primary
parameters of the filter—including gain, frequency, and width—and see
practical command-line examples to help you achieve the exact audio
profile you need.
The bass filter in FFmpeg is a specialized equalizer
tool designed to alter the low-frequency response of an audio stream
using a two-pole shelving filter. It allows you to either boost the bass
to make your audio sound warmer and punchier, or reduce the bass to
clean up muddy low-end frequencies.
Filter Parameters
To customize the bass response, the filter utilizes three primary parameters:
g(gain): Defines the amount of boost or attenuation in decibels (dB). Positive values (e.g.,5) boost the bass, while negative values (e.g.,-5) reduce it. The range is from -20 to +20 dB, with a default of 0 dB.f(frequency): Sets the filter’s shelf frequency in Hz. The filter will affect frequencies below this point. The default value is 100 Hz.w(width): Determines the shelf transition width or slope. A lower value creates a sharper transition, while a higher value creates a gentler slope. The default value is 0.5.
Command Examples
To apply the filter, use the -af (audio filter) flag in
your FFmpeg command.
1. Basic Bass Boost
To boost the bass by 6 dB using the default frequency of 100 Hz, use the following command:
ffmpeg -i input.mp3 -af "bass=g=6" output.mp32. Cutting Low-End Frequencies
If your audio has too much low-end rumble, you can reduce the bass. This command cuts the frequencies below 120 Hz by 8 dB:
ffmpeg -i input.wav -af "bass=g=-8:f=120" output.wav3. Customizing All Parameters
For precise control, you can define the gain, cutoff frequency, and width simultaneously. This command applies a 5 dB boost at 80 Hz with a sharper width of 0.3:
ffmpeg -i input.mp4 -c:v copy -af "bass=g=5:f=80:w=0.3" output.mp4(Note: -c:v copy is used here to copy the video
stream without re-encoding it, saving processing time.)