EJL
EJL

Reputation: 205

How to add audio to specific time [ffmpeg]

So far, I've manage to add audio to the video in ffmpeg but it is playing all along. The enable='between(t,start,end)' option is not working

I have tried googling for possible answers but my approach is different. I wanted to enable/disable the audio repeatedly in the video.

SO far I have this code:

ffmpeg -y -i cut.mp4 -i typing.mp3 -filter_complex "[0:v]drawtext=enable='between(t,0,3)':fontfile=fonts/RobotoBoldCondensed.ttf:text='Finding Nemo...':fontcolor=white:fontsize=24:x=50:y=h-h/5+20[v0]; [1:a]volume=enable='between(t,0,3)'[a3]" -vcodec libx264 -c:a libfdk_aac -map "[v0]" -map "[a3]" -preset ultrafast -async 1  output.mp4

Upvotes: 0

Views: 434

Answers (1)

Gyan
Gyan

Reputation: 93008

The volume filter, by default, maintains input volume. So, you should set expression to 0 and invert the enable expression.

volume=0:enable='not(between(t,0,3))'

This will mute the audio for the first 3 seconds.

Upvotes: 2

Related Questions