How to Use FFmpeg Silencedetect to Find Quiet Parts

This article explains how to use the FFmpeg silencedetect audio filter to identify quiet parts in a video or audio file. You will learn the specific command to run, how to customize the detection thresholds, and how to read the resulting console output to extract exact timestamps for silence start, end, and duration.

Running the FFmpeg command

To detect quiet parts in a video, you must apply the silencedetect filter to the audio stream. Since you only need the analysis data and do not want to output a new video file, you should route the output to a null renderer.

Run the following command in your terminal:

ffmpeg -i input.mp4 -af silencedetect=noise=-30dB:d=2 -f null -

Understanding the Parameters

You can adjust how FFmpeg defines "silence" using these two key parameters:

  • noise (or n): The maximum volume threshold to be considered silence. This is set in decibels (dB). For example, -30dB (default) or -50dB (for much quieter parts).
  • duration (or d): The minimum duration of silence (in seconds) required to trigger a detection. The default is 2 seconds.

Reading the Output

Because FFmpeg outputs its logs to stderr, you will see the detected silence timestamps printed in your terminal window. The relevant output lines look like this:

[silencedetect @ 0x7fa89bc05200] silence_start: 12.45
[silencedetect @ 0x7fa89bc05200] silence_end: 16.12 | silence_duration: 3.67

Here is how to interpret these lines:

  • silence_start: This indicates the exact timestamp (in seconds) where the audio volume dropped below your specified threshold. In the example above, the quiet part begins at 12.45 seconds.
  • silence_end: This indicates the timestamp where the audio volume rose back above the threshold. In the example, the silence ends at 16.12 seconds.
  • silence_duration: This tells you how long the silence lasted in seconds (the difference between the end and start times).

Filtering the Output for Easier Reading

FFmpeg outputs a lot of general file information. To isolate only the silence detection timestamps, you can pipe the output and filter it using command-line tools.

On Linux and macOS (using grep):

ffmpeg -i input.mp4 -af silencedetect=noise=-30dB:d=2 -f null - 2>&1 | grep silence

On Windows PowerShell:

ffmpeg -i input.mp4 -af silencedetect=noise=-30dB:d=2 -f null - 2>&1 | Select-String "silence"

These commands redirect stderr to stdout (2>&1) and filter for the word "silence," leaving you with a clean list of start and end times.