I am using this command to mute audio :
ffmpeg -i input.mp4 -af "volume=enable ='between(t,10,15)':volume=0, volume=enable ='between(t,20,25)':volume=0, volume=enable ='between(t,30,35)':volume=0, volume=enable ='between(t,40,45)':volume=0, volume=enable ='between(t,50,55)':volume=0" -c:v copy -c:a aac -b:a 192K output.mp4
How can I repeat or loop this filter without writing it again and again?
For example, this commands zooms video after specific seconds :
ffmpeg -i input.mp4 -vf "zoompan=z='if(lte(mod(time,6),3),zoom+1.5,zoom-3)':x='iw/2-(iw/zoom)/2':y='ih/2-(ih/zoom)/2':d=1:fps=24" -c:v libx264 -crf 20 -preset:v ultrafast -profile:v high -g 60 -threads 2 -c:a aac -b:a 192K output.mp4
How can I use volume filter like this to mute audio after specific seconds?
Tip: you can target multiple time ranges or conditions in one enable expression by adding them, e.g.
ffmpeg -i input.mp4 -af "volume=volume=0:enable ='between(t,10,15)+between(t,20,25)+between(t,30,35)+between(t,40,45)+between(t,50,55)'" -c:v copy -c:a aac -b:a 192K output.mp4
If the pattern is regular, like 'every 10 seconds, for 2 seconds', you generally use the mod function, which returns the remainder of the left operand by the right operand. Then you enclose this is a comparative function like lte
(less than or equal to)
In this case,
ffmpeg -i input.mp4 -af "volume=volume=0:enable ='lte(mod(t\,10)\,2)'" -c:v copy -c:a aac -b:a 192K output.mp4