Gaël Barbin
Gaël Barbin

Reputation: 3929

Drawing text on video with avconv only at the start of the video

I want to embed the creation date of personnal videos, but only at their start (let say the 10 first seconds).

I'm using the drawtext of avconv:

avconv -i input.avi -vf "drawtext=fontcolor=white:fontsize=30:fontfile=/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-L.ttf:text='$date':x=30:y=h-text_h-30" test.mpg

but I do not find any option to tell to just write the date on only a portion of the video. I could split the start of the video, or make an srt file, but there is probably an easier solution.

Upvotes: 1

Views: 2526

Answers (1)

alexbuisson
alexbuisson

Reputation: 8499

The easiest solution could be to use the "Timeline editing" functionalities of ffmpeg (http://www.ffmpeg.org/ffmpeg-filters.html#toc-Timeline-editing)

Add the following option in the option of the VF you use.

enable='between(t, 0, 10)'

so the filter should draw the text only during 10s and bypass frame after.

As you use avconv you could have a look at https://libav.org/avconv.html#toc-drawtext

the draw text filter seems to have : a 'n' option to specify the number of frame where the text must be draw and a 't' option to express a time stamp

So specify n='10*your vidéo framerate'

Upvotes: 1

Related Questions