Add text to a video with FFmpeg

If you want to add text to multiple video files in a bulk operation, FFmpeg is the way to go. You don’t want to manually edit a bunch of videos just to add the same stuff each time. Automation for the win!

In this FFmpeg example, we will add some text to this video clip.

Credit to Andrea Guerrieri on YouTube

As you can see, no text yet.

We want to add “hard coded” text (that cannot be removed after it is added). We are not talking subtitles/captions.

Here is the command, but hold on for a sec…

The following command has been made simpler to read by breaking the long command into multiple lines. If you use this command you should remove all ^-symbols, so that everything is displayed in one line. Also don’t miss the spaces in there.

ffmpeg ^
-ss 00:00:15 -t 5 ^
-i input.mkv ^
-vf drawtext="fontfile=C\\:/Windows/Fonts/arial.ttf:^
fontsize=200:^
fontcolor=white:^
box=1:^
boxcolor=black@0.8:^
x=(w-text_w)/2:^
y=(h-text_h)/2:^
text='This is some text right here...'" ^
output.mkv

This command is made for a Windows environment so it might look a little different if you are on another OS.

You can also make the text with a little better position and padding like this:

ffmpeg ^
-ss 00:00:15 ^
-t 5 ^
-i input.mkv ^
-vf drawtext="fontfile=C\\:^
/Windows/Fonts/arial.ttf:^
fontsize=200:^
fontcolor=white:^
box=1:^
boxcolor=black@0.8:^
x=w-tw-100:^
y=100:^
text='This is some text right here...'" output.mkv

This is the result:

Sources: https://superuser.com/questions/939357/ffmpeg-watermark-on-bottom-right-corner

Leave a Reply

Your email address will not be published. Required fields are marked *