This is a ffmpeg command for moving text (left to right)
ffmpeg -i input.mp4 -vf drawtext="fontfile=/path/to/fonts/FreeSans.ttf:text='Hello World':fontcolor=white@1.0:fontsize=16:y=h-line_h-100:x=(2*n)-tw" -codec:v libx264 -codec:a copy output.mp4
And I would like to know how to make the moving text to start after 'X' seconds and appear every 'X' seconds ?
It's right there in the documentation. For example to make it appear every 3 seconds for a duration of 1 second you can add the following to your drawtext
filter:
enable=lt(mod(t\,3)\,1)
Update: based on the comments it has to be a continuously scrolling text. Here's an example for a text that scrolls the whole width of the video in 10s, after an initial time of 10s and then dissappears for another 10s, in a loop:
ffmpeg -i input.mp4 -filter:v drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSans.ttf:text='Hello World':fontcolor=white@1.0:fontsize=16:y=h-line_h-100:x=w/10*mod(t\,10):enable=gt(mod(t\,20)\,10)" -codec:v libx264 -codec:a copy -y output.mp4
Details:
Horizontal movement:
x=w/10*mod(t\,10)
where w
is the input width, t
is the time, w/10
is the speed of movement (whole width in 10s) and t mod 10
is used to repeat every 10s
Enabling: enable=gt(mod(t\,20)\,10)
, every 20s show the text animation for 10s after the initial 10s