This is answered in the Stack Overflow post
using FFMPEG with silencedetect to remove audio silence.
The first remark is that silencedetect only detects the silence, not remove it.
You should use instead the silenceremove filter.
To detect whether your version of ffmpeg has this filter run:
ffmpeg -hide_banner -filters | grep silenceremove
The output should look like:
silenceremove A->A Remove silence
The command to remove silent parts may look like:
ffmpeg -i input.mp3 -af silenceremove=1:0:-50dB output.mp3
Where the silenceremove parameter is explained as removing:
- at the beginning (indicated by the first argument
1)
- with minimum length zero (indicated by the second argument
0)
- silence is classified as anything under -50 decibels (indicated by
-50dB)
Reference: FFMPEG silence remove filter.
For finding the right value for silence, normalize first the input audio volume to
0dB, described in this answer.
silencedetect, but it is probably worth checking if you can add-c copyto thesilenceremovecommand string. Unfortunately I don't have these options in my copy offfmpeg(3.4.4), so I can't test if it works. – AFH Nov 11 '18 at 18:51You cannot use -acodec copy to keep the original quality.– Vitaly Zdanevich Nov 11 '18 at 20:23silenceremoveas a filter, but when I tried to combine it with-c copyI gotFiltergraph 'silenceremove=0.5:-50dB' was defined for audio output stream 0:0 but codec copy was selected./Filtering and streamcopy cannot be used together.So I think that must be your answer, though an edit list may still allow an answer without reencoding. – AFH Nov 11 '18 at 20:50