Remove silence from the beginning, middle or end of the audio.
The filter accepts the following options:
- start_periods
-
This value is used to indicate if audio should be trimmed at beginning of the audio. A value of zero indicates no silence should be trimmed from the beginning. When specifying a non-zero value, it trims audio up until it finds non-silence. Normally, when trimming silence from beginning of audio the start_periods will be
1
but it can be increased to higher values to trim all audio up to specific count of non-silence periods. Default value is0
. - start_duration
-
Specify the amount of time that non-silence must be detected before it stops trimming audio. By increasing the duration, bursts of noises can be treated as silence and trimmed off. Default value is
0
. - start_threshold
-
This indicates what sample value should be treated as silence. For digital audio, a value of
0
may be fine but for audio recorded from analog, you may wish to increase the value to account for background noise. Can be specified in dB (in case "dB" is appended to the specified value) or amplitude ratio. Default value is0
. - stop_periods
-
Set the count for trimming silence from the end of audio. To remove silence from the middle of a file, specify a stop_periods that is negative. This value is then treated as a positive value and is used to indicate the effect should restart processing as specified by start_periods, making it suitable for removing periods of silence in the middle of the audio. Default value is
0
. - stop_duration
-
Specify a duration of silence that must exist before audio is not copied any more. By specifying a higher duration, silence that is wanted can be left in the audio. Default value is
0
. - stop_threshold
-
This is the same as start_threshold but for trimming silence from the end of audio. Can be specified in dB (in case "dB" is appended to the specified value) or amplitude ratio. Default value is
0
. - leave_silence
-
This indicates that stop_duration length of audio should be left intact at the beginning of each period of silence. For example, if you want to remove long pauses between words but do not want to remove the pauses completely. Default value is
0
. - detection
-
Set how is silence detected. Can be
rms
orpeak
. Second is faster and works better with digital silence which is exactly 0. Default value isrms
. - window
-
Set ratio used to calculate size of window for detecting silence. Default value is
0.02
. Allowed range is from0
to10
.
Examples
-
The following example shows how this filter can be used to start a recording that does not contain the delay at the start which usually occurs between pressing the record button and the start of the performance:
silenceremove=1:5:0.02
-
Trim all silence encountered from begining to end where there is more than 1 second of silence in audio:
silenceremove=0:0:0:-1:1:-90dB