Draw "Test Text" with font FreeSerif, using the default values for the optional parameters.

drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"

Draw 'Test Text' with font FreeSerif of size 24 at position x=100 and y=50 (counting from the top-left corner of the screen), text is yellow with a red box around it. Both the text and the box have an opacity of 20%.

drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
          x=100: y=50: fontsize=24: fontcolor=yellow@0.2: box=1: boxcolor=red@0.2"

Note that the double quotes are not necessary if spaces are not used within the parameter list.

Show the text at the center of the video frame:

drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"

Show the text at a random position, switching to a new position every 30 seconds:

drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=if(eq(mod(t\,30)\,0)\,rand(0\,(w-text_w))\,x):y=if(eq(mod(t\,30)\,0)\,rand(0\,(h-text_h))\,y)"

Show a text line sliding from right to left in the last row of the video frame. The file 'LONG_LINE' is assumed to contain a single line with no newlines.

drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"

Show the content of file 'CREDITS' off the bottom of the frame and scroll up.

drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"

Draw a single green letter "g", at the center of the input video. The glyph baseline is placed at half screen height.

drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"

Show text for 1 second every 3 seconds:

drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"

Use fontconfig to set the font. Note that the colons need to be escaped.

drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'

Print the date of a real-time encoding (see strftime(3)):

drawtext='fontfile=FreeSans.ttf:text=%{localtime\:%a %b %d %Y}'

Show text fading in and out (appearing/disappearing):

#!/bin/sh
DS=1.0 # display start
DE=10.0 # display end
FID=1.5 # fade in duration
FOD=5 # fade out duration
ffplay -f lavfi "color,drawtext=text=TEST:fontsize=50:fontfile=FreeSerif.ttf:fontcolor_expr=ff0000%{eif\\\\: clip(255*(1*between(t\\, $DS + $FID\\, $DE - $FOD) + ((t - $DS)/$FID)*between(t\\, $DS\\, $DS + $FID) + (-(t - $DE)/$FOD)*between(t\\, $DE - $FOD\\, $DE) )\\, 0\\, 255) \\\\: x\\\\: 2 }"

Horizontally align multiple separate texts. Note that 'max_glyph_a' and the 'fontsize' value are included in the 'y' offset.

drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a

For more information about libfreetype, check: .

For more information about fontconfig, check: .

For more information about libfribidi, check: .