Remove silence from audio with FFmpeg
silenceremove trims silence at the start and shortens every pause after it. Its parameters are easy to misread, so each command below was run on a 12 s file containing 6 s of silence and the resulting durations are given.
Verified with FFmpeg 9.0.1 on 26 August 2026. Search intent: ffmpeg remove silence.
ffmpeg -i input.mp3 -af "silenceremove=start_periods=1:start_threshold=-50dB:start_silence=0.1:stop_periods=-1:stop_threshold=-50dB:stop_duration=0.5" -c:a libmp3lame -q:a 2 output.mp3Trims the leading silence down to 0.1 s and caps every later pause, including the tail, at 0.5 s. The 12 s test file became 7.14 s; silencedetect on the result found two pauses of 0.52 s.
Flags, explained
- start_periods=1
- Trim silence at the beginning once. 0 (the default) leaves the start alone.
- start_threshold=-50dB
- Level below which the beginning counts as silence.
- start_silence=0.1
- Amount of the leading silence to keep, in seconds.
- stop_periods=-1
- Handle every silence after the start, not just the first one.
- stop_duration=0.5
- Silence up to this length is kept as is; longer silences are cut down to this length. It is both the trigger and the pause you keep.
- stop_silence=0.3
- Extra silence to keep on top of stop_duration. 1 s plus 0.3 s gave 1.32 s pauses in the test.
Variants
Leading silence only
ffmpeg -i input.mp3 -af "silenceremove=start_periods=1:start_threshold=-50dB" -c:a libmp3lame -q:a 2 output.mp3Removes the 2 s of silence at the start and nothing else: 12 s became 10.0 s.
Leading and trailing silence, pauses untouched
ffmpeg -i input.mp3 -af "silenceremove=start_periods=1:start_threshold=-50dB,areverse,silenceremove=start_periods=1:start_threshold=-50dB,areverse" -c:a libmp3lame -q:a 2 output.mp3The classic trick: trim the start, reverse, trim the new start, reverse back. Result 8.50 s (2 s head and 1.5 s tail gone, the 2.5 s pause kept). areverse holds the whole file in memory.
Internal pauses only, capped at 1 s
ffmpeg -i input.mp3 -af "silenceremove=stop_periods=-1:stop_threshold=-50dB:stop_duration=1" -c:a libmp3lame -q:a 2 output.mp3No start_* options, so the leading 2 s stay. The 2.5 s and 1.5 s silences were cut to 1.02 s each: 10.04 s total.
From a video file, audio out
ffmpeg -i input.mp4 -vn -af "silenceremove=start_periods=1:start_threshold=-50dB:stop_periods=-1:stop_threshold=-50dB:stop_duration=1:stop_silence=0.3" -c:a pcm_s16le output.wavThe filter only edits audio, so take the audio out with -vn. WAV keeps the intermediate lossless. Result 8.64 s with pauses of about 1.3 s (1 s stop_duration plus 0.3 s stop_silence).
Pitfalls we hit
- stop_duration is the pause you end up with, not only a trigger: stop_duration=1 left 1.02 s gaps, stop_duration=0.5 left 0.52 s gaps, stop_duration=0.2 gave a 6.44 s file.
- A threshold above the signal deletes everything. With start_threshold=-20dB on a file peaking at -20.2 dBFS, FFmpeg exited 0 and wrote an empty MP3 that no decoder could open.
- This filter never touches video. Cutting silence out of a video with its picture in sync needs separate trim and concat steps, or a tool that does it for you.
- Encoding to MP3 twice loses quality. Keep WAV or FLAC as the intermediate and encode once at the end.
- areverse buffers the entire stream in memory; for hour-long recordings prefer stop_periods=-1 without the reverse trick, or trim the tail with -t.
How we verified it
Run with FFmpeg 9.0.1 on 26 August 2026 against a 12 s stereo MP3 (2 s silence, 3 s tone, 2.5 s silence, 3 s tone, 1.5 s silence, peak -20.2 dBFS). Primary command: 7.139 s, two pauses of 0.52 s. Leading only: 9.999 s. areverse variant: 8.500 s. Internal only with stop_duration=1: 10.039 s with 1.02 s pauses. stop_duration=1 plus stop_silence=0.3: 1.32 s pauses. stop_duration=0.2: 6.439 s. start_threshold=-20dB: empty, unreadable output.
The same edit as a typed operation
remove_silence_from_audio takes a threshold in dB and a minimum silence in seconds, validates them, and returns an MP3 or WAV through a signed URL. No filter syntax and no reverse trick to remember.
{
"inputs": [{ "id": "main", "url": "https://example.com/podcast.mp3" }],
"options": { "threshold": -35, "min_silence": 1 }
}FAQ
Related commands
- ffmpeg silencedetectDetect silence with FFmpegRead
- ffmpeg normalize audioNormalize audio loudness with FFmpegRead
- ffmpeg extract audioExtract audio from a video with FFmpegRead