Add Text Watermark to Video with FFmpeg

Adding a text watermark to a video is a common task for branding, copyright protection, or adding captions. This guide provides a quick, step-by-step walkthrough on how to overlay static, styled, or dynamic text onto a video using the powerful FFmpeg command-line tool in Linux. You will learn the basic syntax, how to customize fonts and colors, and how to precisely position your watermark.

Basic Syntax for Text Overlays

To add text to a video, FFmpeg utilizes the drawtext video filter. This filter requires your system to have access to the fonts, usually managed via fontconfig.

Here is the fundamental command to overlay a simple text watermark:

ffmpeg -i input.mp4 -vf "drawtext=text='My Watermark':x=10:y=10:fontsize=24:fontcolor=white" -c:a copy output.mp4

In this command:

Customizing Fonts and Styling

For a more professional appearance, you can specify a specific font file path and add background boxes or borders to make the text stand out against varying video backgrounds.

ffmpeg -i input.mp4 -vf "drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:text='Copyright 2026':x=20:y=20:fontsize=30:fontcolor=yellow:box=1:boxcolor=black@0.5:boxborderw=5" -c:a copy output.mp4

Key styling parameters used here include:

Advanced Positioning

FFmpeg allows you to use internal variables like w (video width), h (video height), tw (text width), and th (text height) to dynamically position your watermark.

Center of the video:

-vf "drawtext=text='Centered Text':x=(w-tw)/2:y=(h-th)/2:fontsize=32:fontcolor=white"

Bottom-right corner (with a 20-pixel margin):

-vf "drawtext=text='Property of Company':x=w-tw-20:y=h-th-20:fontsize=24:fontcolor=white@0.7"

Using these variables ensures your watermark stays relatively positioned in the correct location regardless of the input video’s resolution.