How to Use FFmpeg Bandpass Filter to Isolate Frequencies
This article provides a quick guide on how to use the
bandpass audio filter in FFmpeg to isolate a specific
frequency range. You will learn the basic syntax of the filter,
understand its key parameters like center frequency and band width, and
see practical command-line examples to apply to your audio files.
The bandpass filter in FFmpeg allows a specific band of
frequencies to pass through while attenuating (quieting) frequencies
below and above this range. It is highly useful for tasks like isolating
human speech, removing low-end rumble and high-end hiss simultaneously,
or targeting specific audio elements.
Basic Syntax
The basic syntax for applying the bandpass filter in
FFmpeg is:
ffmpeg -i input.mp3 -af "bandpass=f=CENTER_FREQUENCY:w=BAND_WIDTH" output.mp3Key Parameters
f(frequency): The center frequency of the band you want to keep, specified in Hz. The default value is 3000 Hz.width_type(optional): Defines how the band width is measured. Common options include:h(Hz - default)q(Q-factor)o(octaves)
w(width): The width of the filter band. The default value is 200 Hz.
Practical Example: Isolating Mid-Range Frequencies
To isolate a frequency range centered at 1500 Hz with a width of 1000 Hz (allowing frequencies roughly between 1000 Hz and 2000 Hz to pass through clearly), use the following command:
ffmpeg -i input.wav -af "bandpass=f=1500:w=1000" output.wavUsing Q-Factor for Narrower Isolation
If you want a sharper, more precise cut-off around your target
frequency, you can change the width_type to Q-factor
(q). A higher Q-factor results in a narrower band.
To isolate a narrow band around 1000 Hz using a Q-factor of 2.0, run:
ffmpeg -i input.wav -af "bandpass=f=1000:width_type=q:w=2.0" output.wav