Thanh Dao
Thanh Dao

Reputation: 1260

How to add text to video by time use ffmpeg

I create my slideshow with command:

"ffmpeg" -f concat -safe 0 -i /path/to/text.txt -i /path/to/audio.mp3 -vsync vfr -pix_fmt yuv420p /path/to/output.mp4

The contents of text.txt

file '/path/to/img1.jpg'
duration 6
file '/path/to/img2.jpg'
duration 6
file '/path/to/img3.jpg'
duration 6
file '/path/to/img4.jpg'
duration 6
file '/path/to/img5.jpg'
duration 6
file '/path/to/img6.jpg'
duration 6

The video has been cretaed perfectly. Now I want to add titles for each images displayed. Example:

I search a lot but got any solutions. Anyone help me. I'm stuck

Upvotes: 5

Views: 7442

Answers (1)

Gyan
Gyan

Reputation: 92928

You'll need to add daisychained drawtext filters.

-vf "drawtext=text='Title1':enable='between(t,0,6)',
     drawtext=text='Title2':enable='between(t,6,12)',
     drawtext=text='Title3':enable='between(t,12,18)'"

Consult the docs for drawtext to see all options. You'll want to specify fontfile, fontcolor, fontsize and x,y.

Upvotes: 6

Related Questions