FFMPEG COMMAND

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.

the command
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.mp3

Trims 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

shell
ffmpeg -i input.mp3 -af "silenceremove=start_periods=1:start_threshold=-50dB" -c:a libmp3lame -q:a 2 output.mp3

Removes the 2 s of silence at the start and nothing else: 12 s became 10.0 s.

Leading and trailing silence, pauses untouched

shell
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.mp3

The 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

shell
ffmpeg -i input.mp3 -af "silenceremove=stop_periods=-1:stop_threshold=-50dB:stop_duration=1" -c:a libmp3lame -q:a 2 output.mp3

No 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

shell
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.wav

The 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.

MCP tool: remove_silence_from_audioPOST /api/v1/tools/remove-silence-from-audio
request body
{
  "inputs": [{ "id": "main", "url": "https://example.com/podcast.mp3" }],
  "options": { "threshold": -35, "min_silence": 1 }
}

FAQ

Why is my output file empty or unreadable?

The threshold was above the level of your audio, so the filter treated the whole file as silence. Measure the peak with volumedetect and set the threshold well below the quietest speech.

How do I keep a short pause between sentences?

Set stop_duration to the pause length you want, for example 0.5 for half a second. Silence shorter than that is kept, longer silence is shortened to it.

Does silenceremove cut the video as well?

No, it is an audio filter. The video keeps its original length, so the streams drift apart. Detect the silences first and cut both streams with trim filters or use a tool that handles video.

What threshold should I use?

-50 dB works for clean recordings; noisy rooms need -35 to -40 dB. Test on a short excerpt and check the result with silencedetect.

Related commands

All FFmpeg commands