Provide a time period in ffmpeg drawtext filter

I am trying to add text to a video using ffmpeg and want the text to be displayed for a certain period of time. I am trying to use the DrawText filter, but do not know how to provide a time period for this filter. Can anyone help me out.

thanks

+6
source share
1 answer

The drawtext filter supports editing the timeline (see the output of ffmpeg -filters ). This can evaluate expression and allows you to specify the time (s) when the filter should be enabled.

In this example, the filter will be from 12 seconds to 3 minutes:

 ffmpeg -i input.mp4 -vf "drawtext=enable='between(t,12,3*60)':fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'" -acodec copy output.mp4 

In this example, the audio was stream copy .

If you do not have support for editing the timeline, you will need to get a newer version. You can simply download the Linux ffmpeg assembly or follow the walkthrough to compile ffmpeg .

Also see the FFmpeg and x264 Encoding Guide .

+13
source

All Articles