Content is user-generated and unverified.

silenceremove

Remove silence from audio files by trimming quiet sections at the beginning, end, or throughout the audio.

Quick Start

Remove silence from beginning and end:

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

Remove all silence throughout the file:

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

Core Concepts

What is Silence?

Silence is audio below a certain volume threshold for a minimum duration. You define:

  • Threshold: How quiet audio must be to count as silence (e.g., -60dB)
  • Duration: How long the quiet audio must last to be considered silence (e.g., 1 second)

Three Types of Silence Removal

  1. Beginning Trimming: Remove silence from the start of the audio
  2. End Trimming: Remove silence from the end of the audio
  3. Throughout Trimming: Remove silence from anywhere in the audio (beginning, middle, and end)

Configuration Guide

Beginning Silence Removal

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 beginning
  • 2: Keep the first silence, remove the second silence, etc.

start_threshold - How quiet audio must be to count as silence

  • Examples: -60dB, -40dB, 0.001 (linear scale)
  • Quieter values (more negative dB) = stricter silence detection

start_duration - How long audio must be non-silent before stopping the trim

  • Time in seconds: 0.5, 1, 2.5
  • Once non-silence lasts this long, stop trimming from the beginning

start_mode - How to detect when silence ends

  • any: Any channel above threshold counts as non-silence (default)
  • all: All channels must be above threshold

End Silence Removal

Controls 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 end
  • 2: 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

  • Same format as start_threshold

stop_duration - How long silence must last before it gets removed

  • Time in seconds
  • Only silence lasting this long or longer will be trimmed

stop_mode - How to detect silence

  • any: Any channel below threshold counts as silence (default)
  • all: All channels must be below threshold

Advanced Options

detection - Which type of audio level to measure

  • peak: Measure peak amplitude (default, most common)
  • rms: Measure RMS (root mean square) level

window - Time window for RMS detection

  • Only used when detection=rms
  • Defaults to 0.02 seconds (20ms)

Common Usage Patterns

Clean Up Podcast Recording

Remove silence from beginning and end, keep natural pauses:

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

Aggressive Silence Removal

Remove all silence throughout the file:

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

Conservative Cleanup

Only remove very obvious silence:

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

Multiple Silence Sections

Skip the first quiet section but remove subsequent ones:

bash
ffmpeg -i input.wav -af silenceremove=start_periods=2:start_duration=1:start_threshold=-60dB output.wav

Parameter Reference

ParameterWhat It ControlsCommon ValuesNotes
start_periodsWhich silence sections to skip at beginning0, 1, 20 = no trimming
start_thresholdVolume level that counts as silence-60dB, -40dBMore negative = stricter
start_durationHow long non-silence must last to stop trimming0.5, 1, 2In seconds
start_modeChannel detection modeany, allany is typical
stop_periodsWhich silence sections to remove at end0, 1, -1-1 = throughout file
stop_thresholdVolume level that counts as silence-60dB, -40dBUsually same as start
stop_durationMinimum silence length to remove1, 2, 3Longer = more conservative
stop_modeChannel detection modeany, allany is typical
detectionAudio level measurement typepeak, rmspeak for most cases
windowRMS measurement window0.02Only for RMS detection

Troubleshooting

Filter removes too much audio:

  • Make thresholds more strict (more negative): -40dB-60dB
  • Increase duration requirements: 0.52
  • Use detection=rms for more stable detection

Filter doesn't remove enough silence:

  • Make thresholds less strict: -60dB-40dB
  • Decrease duration requirements: 20.5
  • Check your audio levels with ffmpeg -i input.wav -af volumedetect -f null -

Removes silence in the middle when you don't want it to:

  • Use stop_periods=1 instead of stop_periods=-1
  • Only configure beginning/end trimming, not throughout-file trimming

Keeps silence you want to remove:

  • Lower the stop_duration value
  • Make sure stop_periods is set appropriately (1 for end-only, -1 for throughout)

Understanding the Algorithm

The filter works by:

  1. Scanning audio for sections that meet your silence criteria (threshold + duration)
  2. For beginning trim: removing silence until it finds non-silence lasting start_duration
  3. For end trim: identifying silence sections and removing them based on stop_periods setting
  4. The -1 mode for stop_periods enables a special algorithm that processes the entire file

This internal complexity is why the parameters can seem confusing - they're controlling different parts of this multi-step process.

Content is user-generated and unverified.
    FFmpeg silenceremove Filter - Rewritten Documentation | Claude