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
- with minimum length zero (indicated by the second argument
- silence is classified as anything under -50 decibels (indicated by
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 the
silenceremovecommand string. Unfortunately I don't have these options in my copy of
ffmpeg(3.4.4), so I can't test if it works.
You cannot use -acodec copy to keep the original quality.