Remove silence from audio files by trimming quiet sections at the beginning, end, or throughout the audio.
Remove silence from beginning and end:
ffmpeg -i input.wav -af silenceremove=start_periods=1:start_duration=1:start_threshold=-60dB:stop_periods=1:stop_duration=1:stop_threshold=-60dB output.wavRemove all silence throughout the file:
ffmpeg -i input.wav -af silenceremove=start_periods=1:start_duration=1:start_threshold=-60dB:stop_periods=-1:stop_duration=1:stop_threshold=-60dB output.wavSilence is audio below a certain volume threshold for a minimum duration. You define:
-60dB)1 second)Controls what happens at the start of your audio file.
start_periods - How many silence-to-sound transitions to skip
0: Don't remove any beginning silence (default)1: Remove the first stretch of silence at the beginning2: Keep the first silence, remove the second silence, etc.start_threshold - How quiet audio must be to count as silence
-60dB, -40dB, 0.001 (linear scale)start_duration - How long audio must be non-silent before stopping the trim
0.5, 1, 2.5start_mode - How to detect when silence ends
any: Any channel above threshold counts as non-silence (default)all: All channels must be above thresholdControls what happens at the end of your audio file.
stop_periods - How many sound-to-silence transitions to process
0: Don't remove any ending silence (default)1: Remove the final stretch of silence at the end2: Remove the last two silence sections-1: Special mode - Remove silence throughout the entire file (beginning, middle, and end)stop_threshold - How quiet audio must be to count as silence
start_thresholdstop_duration - How long silence must last before it gets removed
stop_mode - How to detect silence
any: Any channel below threshold counts as silence (default)all: All channels must be below thresholddetection - Which type of audio level to measure
peak: Measure peak amplitude (default, most common)rms: Measure RMS (root mean square) levelwindow - Time window for RMS detection
detection=rms0.02 seconds (20ms)Remove silence from beginning and end, keep natural pauses:
ffmpeg -i podcast.wav -af silenceremove=start_periods=1:start_duration=0.5:start_threshold=-50dB:stop_periods=1:stop_duration=2:stop_threshold=-50dB output.wavRemove all silence throughout the file:
ffmpeg -i input.wav -af silenceremove=start_periods=1:start_duration=0.5:start_threshold=-40dB:stop_periods=-1:stop_duration=1:stop_threshold=-40dB output.wavOnly remove very obvious silence:
ffmpeg -i input.wav -af silenceremove=start_periods=1:start_duration=1:start_threshold=-70dB:stop_periods=1:stop_duration=3:stop_threshold=-70dB output.wavSkip the first quiet section but remove subsequent ones:
ffmpeg -i input.wav -af silenceremove=start_periods=2:start_duration=1:start_threshold=-60dB output.wav| Parameter | What It Controls | Common Values | Notes |
|---|---|---|---|
start_periods | Which silence sections to skip at beginning | 0, 1, 2 | 0 = no trimming |
start_threshold | Volume level that counts as silence | -60dB, -40dB | More negative = stricter |
start_duration | How long non-silence must last to stop trimming | 0.5, 1, 2 | In seconds |
start_mode | Channel detection mode | any, all | any is typical |
stop_periods | Which silence sections to remove at end | 0, 1, -1 | -1 = throughout file |
stop_threshold | Volume level that counts as silence | -60dB, -40dB | Usually same as start |
stop_duration | Minimum silence length to remove | 1, 2, 3 | Longer = more conservative |
stop_mode | Channel detection mode | any, all | any is typical |
detection | Audio level measurement type | peak, rms | peak for most cases |
window | RMS measurement window | 0.02 | Only for RMS detection |
Filter removes too much audio:
-40dB → -60dB0.5 → 2detection=rms for more stable detectionFilter doesn't remove enough silence:
-60dB → -40dB2 → 0.5ffmpeg -i input.wav -af volumedetect -f null -Removes silence in the middle when you don't want it to:
stop_periods=1 instead of stop_periods=-1Keeps silence you want to remove:
stop_duration valuestop_periods is set appropriately (1 for end-only, -1 for throughout)The filter works by:
start_durationstop_periods setting-1 mode for stop_periods enables a special algorithm that processes the entire fileThis internal complexity is why the parameters can seem confusing - they're controlling different parts of this multi-step process.