Configure FFmpeg Silencedetect Noise Threshold

This article explains how to configure the noise threshold for the silencedetect filter in FFmpeg to accurately identify quiet or silent periods in audio files. You will learn about the specific parameters used to define what constitutes “silence” and how to apply them in your command-line workflows.

Understanding the Silencedetect Parameters

The silencedetect filter analyzes the audio stream of an input file and logs the start, end, and duration of silent intervals to the console. To configure how the filter detects silence, you must adjust two main parameters:

How to Set the Noise Threshold

The noise threshold is specified using the noise parameter. You can define this value either in decibels (dB) or as a decimal amplitude ratio.

1. Using Decibels (dB)

Decibels are the most common and intuitive unit for measuring audio levels in FFmpeg. The default threshold is -60dB.

2. Using Amplitude Ratio

Alternatively, you can specify the threshold as a linear amplitude ratio between 0 (absolute silence) and 1 (maximum volume). For example, 0.003 is approximately equivalent to -50dB.

Practical Command Examples

To run the silencedetect filter, you apply it as an audio filter (-af) and route the output to the null muxer (-f null -) to avoid rendering a new file.

Example 1: Standard Silence Detection

To detect silence that is quieter than -50dB and lasts for at least 2 seconds:

ffmpeg -i input.mp3 -af silencedetect=noise=-50dB:duration=2 -f null -

Example 2: High Background Noise

If your audio has a high level of background hiss, a lower threshold like -60dB might miss the silent gaps. To compensate, raise the threshold to -40dB:

ffmpeg -i input.mp3 -af silencedetect=n=-40dB:d=1.5 -f null -

Example 3: Near-Absolute Silence

To find only near-perfect digital silence (minimum 3 seconds long) in a high-quality studio recording, lower the threshold to -80dB:

ffmpeg -i input.wav -af silencedetect=noise=-80dB:duration=3 -f null -

How to Read the Output

When you run the command, FFmpeg will print the results to the standard error output (stderr). Look for lines formatted like this:

[silencedetect @ 0x7fa89bc05200] silence_start: 12.345
[silencedetect @ 0x7fa89bc05200] silence_end: 15.678 | silence_duration: 3.333

If the filter does not output any timestamps, your noise threshold may be too low (the background noise is louder than the threshold) or the silence duration parameter is longer than any actual silent gaps in the audio. Adjust the noise decibel value upward (closer to 0dB) to make the filter more sensitive.