How to Use FFmpeg Bandpass Filter to Isolate Vocals

Isolating vocal frequencies in an audio file is a common task in audio post-production, and FFmpeg provides a powerful, built-in bandpass filter to achieve this. This article explains how the FFmpeg bandpass filter works, identifies the frequency ranges essential for human speech, and provides practical command-line examples to help you filter out unwanted low-end rumble and high-frequency noise from your audio tracks.

Understanding Vocal Frequencies

Before applying the filter, it is important to understand the frequency range of the human voice. While the fundamental frequencies of human speech generally lie between 85 Hz and 255 Hz, the harmonics and consonants that provide clarity and intelligibility span from 300 Hz to 3,400 Hz.

To isolate vocals, you want to allow this specific range to pass through while attenuating everything below 300 Hz (like wind or traffic rumble) and everything above 3,400 Hz (like hiss or electronic noise).

The FFmpeg Bandpass Syntax

The bandpass filter in FFmpeg requires two main parameters: the center frequency and the bandwidth.

The Basic Command

To target the standard vocal range of approximately 300 Hz to 3,400 Hz, you can set the center frequency to 1,850 Hz with a width of 3,100 Hz. This allows frequencies between 300 Hz (1,850 - 1,550) and 3,400 Hz (1,850 + 1,550) to pass.

Use the following command in your terminal:

ffmpeg -i input.mp3 -af "bandpass=f=1850:width_type=h:width=3100" output.mp3

Adjusting for Female or High-Pitched Voices

For higher-pitched voices, you may want to shift the band upward to capture the sibilance and clarity in the higher registers (up to 5,000 Hz). To target a range of 500 Hz to 5,000 Hz, use a center frequency of 2,750 Hz with a width of 4,500 Hz:

ffmpeg -i input.mp3 -af "bandpass=f=2750:width_type=h:width=4500" output.mp3

Adjusting for Male or Deep Voices

For deeper voices, you want to preserve the low-end warmth of the speech. To target a range of 100 Hz to 3,000 Hz, use a center frequency of 1,550 Hz with a width of 2,900 Hz:

ffmpeg -i input.mp3 -af "bandpass=f=1550:width_type=h:width=2900" output.mp3

Fine-Tuning with Q-Factor

Instead of defining the bandwidth in Hertz, you can use the Q-factor (width_type=q). A higher Q-factor results in a narrower, sharper bandpass filter, while a lower Q-factor results in a wider, gentler slope.

To isolate a narrow band of vocals centered tightly around 1,000 Hz, use:

ffmpeg -i input.mp3 -af "bandpass=f=1000:width_type=q:width=1.0" output.mp3

Varying the width value (e.g., trying 0.5 for a wider band or 2.0 for a narrower band) will allow you to quickly dial in the exact vocal presence required for your audio source.