Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mute specified sections of an audio file using ffmpeg

Tags:

ffmpeg

audio

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?

like image 793
kimadactyl Avatar asked Mar 23 '15 16:03

kimadactyl


1 Answers

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.

like image 158
aergistal Avatar answered Sep 28 '22 09:09

aergistal