How to Use FFmpeg Bandreject Filter to Remove Hum

This article provides a straightforward guide on how to use the FFmpeg bandreject audio filter to eliminate specific, unwanted hum frequencies from your audio and video files. You will learn the exact command-line syntax, understand the key parameters required to target electrical interference (such as 50 Hz or 60 Hz hums), and see practical examples of how to apply the filter effectively.

The FFmpeg Bandreject Filter Syntax

The bandreject filter attenuates a narrow band of frequencies around a central frequency while leaving the rest of the audio spectrum untouched. This makes it ideal for removing constant background hums caused by ground loops or electrical grids.

The basic syntax for the filter is:

ffmpeg -i input.mp4 -af "bandreject=f=FREQUENCY:width_type=TYPE:width=WIDTH" output.mp4

Key Parameters Explained


Practical Examples

Example 1: Removing a 60 Hz Electrical Hum (US/Canada)

To remove a 60 Hz hum using a narrow 2 Hz bandwidth (which targets 59 Hz to 61 Hz), use the following command:

ffmpeg -i input.wav -af "bandreject=f=60:width_type=h:width=2" output.wav

Example 2: Removing a 50 Hz Electrical Hum (Europe/UK)

To remove a 50 Hz hum with a narrow band using shorthand parameter names:

ffmpeg -i input.mp3 -af "bandreject=f=50:t=h:w=2" output.mp3

Example 3: Using Q-Factor for a Sharp Cut

Using a high Q-factor creates a very steep curve, preserving as much of the surrounding audio as possible. A Q-factor of 10 or higher is recommended for precise hum removal:

ffmpeg -i input.mkv -af "bandreject=f=60:g=q:w=15" -c:v copy output.mkv

(Note: -c:v copy ensures the video stream is copied without re-encoding, saving time and preserving video quality).


Targeting Harmonics (Advanced)

Electrical hums often generate “harmonics” (multiples of the base frequency, such as 120 Hz, 180 Hz, or 100 Hz, 150 Hz). If the hum persists after filtering the base frequency, you can chain multiple bandreject filters together:

ffmpeg -i input.mp4 -af "bandreject=f=60:w=2,bandreject=f=120:w=2,bandreject=f=180:w=2" -c:v copy output.mp4