using FFMPEG with silencedetect to remove audio silence

后端 未结 3 1154
[愿得一人]
[愿得一人] 2020-12-02 13:50

I am trying to use the following command with the latest ffmpeg build to remove silence from my .mp3 files:

ffmpeg -i SILENCE.mp3 -af silencedetect=n=-50dB:d         


        
3条回答
  •  星月不相逢
    2020-12-02 14:11

    Use the silenceremove filter. This removes silence from the audio track only - it will leave the video unedited, i.e., things will go out of sync

    Its arguments are a little cryptic.

    An example

    ffmpeg -i input.mp3 -af silenceremove=1:0:-50dB output.mp3
    

    This removes silence

    • 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).

    Documentation: FFMPEG silence remove filter

    Also anyone looking to find the right value to classify silence as may wish to look into normalising their input audio volume to 0dB first, to do this in ffmpeg see this answer.

    Edit

    As pointed out by @mems, to detect whether your version of ffmpeg has the filter run

    ffmpeg -hide_banner -filters | grep silenceremove

    if you have the filter it'll output something like

    silenceremove A->A Remove silence

提交回复
热议问题