Detect silence with FFmpeg
silencedetect scans the audio and prints where silence starts and ends. The test file has silence at 0 to 2 s, 5 to 7.5 s and 10.5 to 12 s, and every command below reported exactly those ranges.
Verified with FFmpeg 9.0.1 on 26 August 2026. Search intent: ffmpeg silencedetect.
ffmpeg -i input.mp4 -af "silencedetect=noise=-30dB:d=0.5" -f null -Treats anything below -30 dBFS lasting at least 0.5 s as silence and prints silence_start, silence_end and silence_duration lines while decoding. Nothing is written: -f null discards the output.
Flags, explained
- noise=-30dB
- Silence threshold. Also accepts a linear amplitude (noise=0.001). Lower values (further from 0) mean stricter silence.
- d=0.5
- Minimum duration in seconds before a quiet stretch counts as silence. Short pauses in speech are ignored.
- -f null -
- Decode and run the filter without producing a file.
- -vn
- Ignore the video stream of the input. Put it before -i.
- ametadata=mode=print:file=
- Dump the filter metadata (the detected timestamps) to a file.
Variants
Stricter threshold and longer minimum silence
ffmpeg -i input.mp4 -af "silencedetect=noise=-50dB:d=2" -f null -Only silences of 2 s or more are reported: the 2 s and 2.5 s gaps were printed, the 1.5 s tail was not. -50 dB suits studio recordings; room tone on a phone recording usually needs -30 to -40 dB.
Skip the video decode
ffmpeg -vn -i input.mp4 -af "silencedetect=noise=-30dB:d=0.5" -f null --vn before the input drops the video stream so only audio is decoded. Same three ranges, noticeably faster on long recordings.
Write the timestamps to a file
ffmpeg -i input.mp4 -af "silencedetect=noise=-30dB:d=0.5,ametadata=mode=print:file=silence.txt" -f null -ametadata writes the lavfi.silence_start, lavfi.silence_end and lavfi.silence_duration values to silence.txt instead of the console log, which is easier to parse from a script.
Pitfalls we hit
- The results go to stderr, not stdout. Redirect with 2>&1 before piping into grep or a script.
- Timestamps are sample-accurate but not round: the 5 s gap printed silence_start: 4.999909 and silence_end: 7.500113. Round them before using them as cut points.
- A silence shorter than d is not reported at all. With d=2 the 1.5 s tail disappeared from the output.
- In the ametadata file, the frame pts_time on each line is when the event was noticed, not the event itself: silence_start 4.999909 was written on the frame at 5.48 s. Read the lavfi.silence_start value.
- The threshold is relative to digital full scale, not to the recording level. Measure the noise floor with volumedetect or ebur128 before picking a value.
How we verified it
Run with FFmpeg 9.0.1 on 26 August 2026 against a 12 s H.264 file whose AAC track holds 2 s silence, 3 s tone, 2.5 s silence, 3 s tone, 1.5 s silence. noise=-30dB:d=0.5 printed silence 0 to 2.000159 s, 4.999909 to 7.500113 s and 10.499932 to 12 s. noise=-50dB:d=2 printed only the first two. -vn gave identical output. The ametadata variant wrote the same values to silence.txt.
The same edit as a typed operation
detect_silence returns the silent ranges as JSON (start, end, duration in seconds) so an agent can trim, split or skip without parsing FFmpeg logs. Threshold and minimum length are validated before the job runs.
{
"inputs": [{ "id": "main", "url": "https://example.com/podcast.mp3" }],
"options": { "threshold": -35, "min_silence": 1 }
}FAQ
Related commands
- ffmpeg remove silenceRemove silence from audio with FFmpegRead
- ffmpeg scene detectionDetect scene changes with FFmpegRead
- ffmpeg normalize audioNormalize audio loudness with FFmpegRead