Configure FFmpeg Bandpass Filter Frequency and Bandwidth

This article provides a straightforward guide on how to configure the center frequency and bandwidth parameters in the FFmpeg bandpass audio filter. You will learn the syntax, key parameters, and practical command-line examples to successfully isolate specific audio frequencies in your media files.

The FFmpeg bandpass filter allows a specific band of frequencies to pass through while attenuating frequencies outside of this range. To configure this filter, you must define the center frequency and the width of the band using the frequency (or f) and width (or w) parameters.

Basic Syntax

The basic syntax for applying the bandpass filter in an FFmpeg command is:

ffmpeg -i input.mp3 -af "bandpass=f=CENTER_FREQUENCY:w=BANDWIDTH" output.mp3

Configuring the Center Frequency

The center frequency is the middle of the frequency band you want to keep. It is specified in Hertz (Hz).

Configuring the Bandwidth

The bandwidth determines how wide the passband is around the center frequency. You can define the width using different units by configuring the width_type (or t) parameter.

Practical Examples

Example 1: Using Hertz (Hz) for Bandwidth To isolate frequencies around 1000 Hz with a bandwidth of 200 Hz (allowing frequencies roughly between 900 Hz and 1100 Hz to pass), set the width type to h:

ffmpeg -i input.wav -af "bandpass=f=1000:w=200:t=h" output.wav

Example 2: Using Q-factor (Default) To isolate frequencies around 1500 Hz using a sharp Q-factor of 2.0, you can omit the t parameter since Q-factor is the default:

ffmpeg -i input.wav -af "bandpass=f=1500:w=2.0" output.wav

Example 3: Using Octaves To isolate a broader band around 500 Hz with a width of 1 octave, set the width type to o:

ffmpeg -i input.wav -af "bandpass=f=500:w=1:t=o" output.wav