Mute specified sections of an audio file using ffmpeg

后端 未结 2 1806
时光说笑
时光说笑 2020-12-01 06:57

I have a JSON file containing regions that I want to mute in a given audio file. How can I process the audio file to mute the file between the listed sections?

相关标签:
2条回答
  • 2020-12-01 07:09

    Thanks to @aergistal , it worked for me:

    command line:

    ffmpeg -i input.mp4 -af "volume=enable='between(t,1,2)':volume=0" output.mp4
    

    nodejs fluent ffmpeg:

    ffmpeg('input.mp4').audioFilters("volume=0:enable='between(t,1,2)'").output('output.mp4')
    
    0 讨论(0)
  • 2020-12-01 07:21

    The following command will mute two sections: between 5-10s and 15-20s:

    ffmpeg -i video.mp4 -af "volume=enable='between(t,5,10)':volume=0, volume=enable='between(t,15,20)':volume=0" ...
    

    Description:

    -af is the audio filter. It works by specifying multiple volume filters that are enabled/disabled at the specified time. volume=enable='between(t,5,10)':volume=0 means use a volume filter that gets enabled between 5 and 10 seconds and sets the volume to 0.

    0 讨论(0)
提交回复
热议问题