FFmpeg Noise Gate: How to Silence Audio Below Threshold

This article provides a quick guide on how to use FFmpeg’s agate (audio gate) filter to silence parts of an audio file that fall below a specific volume threshold. You will learn the basic command structure, the key parameters used to control the gate’s behavior, and a practical example to clean up background noise from your recordings.

Understanding the FFmpeg agate Filter

An audio gate, or noise gate, allows signals above a certain threshold to pass through unaffected while attenuating (quieting) or completely silencing signals that fall below that threshold. This is highly effective for removing low-level background hiss, hum, or breathing sounds between spoken words.

In FFmpeg, this is achieved using the agate audio filter.

The Basic Command Syntax

To apply a noise gate in FFmpeg, use the -af (audio filter) flag followed by the agate filter and its parameters. Here is the standard command:

ffmpeg -i input.mp3 -af "agate=threshold=0.03:ratio=20:attack=20:release=250" output.mp3

Key Parameters Explained

To fine-tune the gate for your specific audio file, you can adjust the following parameters:

A Practical Example

If you have a voice recording with noticeable background noise during pauses, you can use the following command to apply a strict noise gate:

ffmpeg -i voice.wav -af "agate=threshold=-35dB:ratio=50:attack=10:release=300" cleaned_voice.wav

In this example: * Any sound quieter than -35dB will trigger the gate. * The volume of the quiet parts is reduced heavily due to the 50 ratio. * The gate opens quickly (10ms) when speaking starts and closes smoothly (300ms) during pauses to maintain a natural sound.