Use drawtext with fontsize=h/14 for a title that scales with the frame, and escape every colon in the text or ffmpeg stops with exit code 234. ReelSDK runs it at $0.02 per compute minute, Anton and other fonts included.

How can I add text to a video with ffmpeg?

To add text to a video, run ffmpeg's drawtext filter and size it from the frame: h/14 for a title, h/30 for a clock. On ReelSDK the fonts in /usr/share/fonts/reelsdk work as they are, and any other font comes in as an input URL.

GuidesUpdated

drawtext
ffmpeg -i in.mp4 -vf "drawtext=fontfile=Poppins-Bold.ttf:text='Seville, day 1':\
fontsize=h/14:fontcolor=white:box=1:boxcolor=black@0.55:boxborderw=28:\
x=(w-text_w)/2:y=h*0.08:enable='between(t,0.5,6)',\
drawtext=fontfile=Poppins-Bold.ttf:text='%{pts\:hms}':fontsize=h/30:\
fontcolor=white:box=1:boxcolor=black@0.55:boxborderw=14:\
x=w-text_w-40:y=h-text_h-40" -c:v libx264 -crf 20 -c:a copy titled.mp4

The title sits centered near the top on a half-transparent box from 0.5 to 6 s; the clock runs in the bottom-right corner the whole time.

Variations

The other commands you will need

  1. A colon in the text

    The colon separates options, so escape it inside the text. Without the backslash ffmpeg stopped with exit code 234.

    escape
    ffmpeg -i in.mp4 -vf "drawtext=fontfile=Poppins-Bold.ttf:text='Seville\: day 1':fontsize=72" \
      -frames:v 1 escaped.png
  2. Your own font

    Any .ttf or .otf file works; give the path. Here, Anton for a 2-second clip.

    own font
    ffmpeg -i in.mp4 -t 2 -vf "drawtext=fontfile=Anton-Regular.ttf:text='Seville':\
    fontsize=h/8:fontcolor=white:x=(w-text_w)/2:y=h*0.1" -c:v libx264 -crf 23 -an font.mp4

The flags

The options in these commands

The options in these commands
FlagWhat it doesUsed here
fontfile=Path to the font fileAll
text='...'The text; escape : and ' inside itAll
fontsize=h/14Size in pixels; an expression of the frame height keeps it in proportion. The default is 16Title
box=1, boxcolor=black@0.55A box behind the text, 55% opaque blackTitle, clock
boxborderw=28Padding between the text and the edge of the boxTitle
x=(w-text_w)/2Centers the text: frame width minus text width, halvedTitle
y=h*0.088% down from the topTitle
enable='between(t,0.5,6)'Draws only from 0.5 s to 6 sTitle
%{pts\:hms}Prints the frame time as HH:MM:SS.mmmClock
x=w-text_w-40:y=h-text_h-4040 px in from the bottom-right cornerClock

Sources: ffmpeg filters: drawtext, ffmpeg filters: timeline editing, checked November 2026.

Why the colon breaks it

A filter's options are separated by colons, and the filter graph has its own quoting on top. The single quotes around the text are used up by the first layer, so text='Seville: day 1' still reaches drawtext as two options. ffmpeg stopped with "No option name near ' day 1:fontsize=72'" and exit code 234.

Put a backslash before the colon inside the text: text='Seville\: day 1'. The same goes for the clock: %{pts\:hms} needs it because pts:hms has a colon too. In a shell, the outer double quotes keep the backslash intact.

Sizes that follow the frame

drawtext sizes are in pixels, and the default is 16, which is tiny on HD video. Use the frame height instead: fontsize=h/14 is about 77 px at 1080 px tall and scales by itself on other sizes. Positions work the same way: text_w and text_h are the size of the rendered text, w and h the frame, so x=(w-text_w)/2 always centers.

Show it only for a while

enable turns a filter on and off by time. between(t,0.5,6) draws the title from half a second to six seconds and leaves the rest of the clip alone. Each drawtext in the chain has its own enable, so you can stack several titles with different timings in one command.

Fonts on a server

fontfile needs a real path; there is no default you can count on. On the API, Anton, Bebas Neue, Montserrat Black and ExtraBold, Poppins Bold, ExtraBold and Black, and Noto Sans JP, SC, KR, Arabic, Hebrew, Thai, Devanagari, Lao and Myanmar in Bold are installed under /usr/share/fonts/reelsdk. For anything else, list the font's URL in inputs and refer to it by its file name: our Anton test did exactly that and finished in about 5 seconds.

For captions that follow speech, drawtext is the wrong tool. Write an SRT and burn it with the subtitles filter, or let POST /v1/captions transcribe and style it.

Without installing ffmpeg

The same command as one API call

Send the same args to POST /v1/ffmpeg. The fonts we bundle sit in /usr/share/fonts/reelsdk; for any other font, put its URL in inputs and use the file name, as we did with Anton. Each job runs ffmpeg 8.1 on a fresh machine at $0.02 per compute minute, billed per second; this one finished in about 11 seconds and cost under half a cent.

terminalTry it
curl "https://api.reelsdk.com/v1/ffmpeg?wait=60" \
  -H "Authorization: Bearer $REELSDK_KEY" \
  --json '{
    "inputs": {
      "in.mp4": "https://api.reelsdk.com/f/lib/demo/landscape.mp4"
    },
    "args": [
      "-i", "in.mp4", "-vf",
      "drawtext=fontfile=/usr/share/fonts/reelsdk/Poppins-Bold.ttf:text='\''Seville, day 1'\'':fontsize=h/14:fontcolor=white:box=1:boxcolor=black@0.55:boxborderw=28:x=(w-text_w)/2:y=h*0.08:enable='\''between(t,0.5,6)'\'',drawtext=fontfile=/usr/share/fonts/reelsdk/Poppins-Bold.ttf:text='\''%{pts\\:hms}'\'':fontsize=h/30:fontcolor=white:box=1:boxcolor=black@0.55:boxborderw=14:x=w-text_w-40:y=h-text_h-40",
      "-c:v", "libx264", "-crf", "20", "-c:a", "copy", "titled.mp4"
    ],
    "outputs": ["titled.mp4"]
  }'
The title shows from 0.5 to 6 s; the timecode runs the whole clip.Input: landscape clipfont.mp4 (own font)

FAQ

Questions, answered

How do I add text to a video with ffmpeg?

Use -vf "drawtext=fontfile=font.ttf:text='Hello':fontsize=h/14:fontcolor=white:x=(w-text_w)/2:y=h*0.08" and re-encode the video, copying the audio.

Why does drawtext fail with No option name near?

The text has a colon or quote that ends the option. Escape it with a backslash, as in text='Seville\: day 1'.

How do I show text only for a few seconds?

Add enable='between(t,0.5,6)' to the drawtext filter; it draws only while t is between the two times in seconds.

Can I add text to video with an API?

Yes. POST the same args to https://api.reelsdk.com/v1/ffmpeg with fontfile pointing at /usr/share/fonts/reelsdk or at a font you list in inputs. It runs ffmpeg 8.1 for $0.02 per compute minute, billed per second.

Ready to build?

Ship video from your app today

Your first $0.50 is free, and one key covers every endpoint.

Moonlit lake with a lit cabin under the mountains