Development

How to do a text watermark in FFmpeg

I wanted a way to avoid using an image to watermark videos with FFmpeg. Sometimes just simple text is great in watermarking media. Here is how to do it with some examples:

Using FFmpeg Drawtext we can create text and add a shadow in the chosen location. This example the watermark will be in the bottom left:

ffmpeg -i "input.mp4" -vf "drawtext=text='a watermark':x=10:y=H-th-10:fontfile=/pathto/font.ttf:fontsize=10:fontcolor=white:shadowcolor=black:shadowx=2:shadowy=2" "output.mp4"

The watermark will also have a shadow that makes the watermark standout more. Keep in mind you must have a font file (.ttf) to do this. Make sure you edit the path to it in the command supplied above.

As for the location of the watermark, that is defined by x and y. In the example the text will be padded 10 from the left and up 10 from the bottom of the video. To do bottom right make it: x=-10:y=H-th-10

 

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

1 year ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

1 year ago

FTP getting array of file details such as size using PHP

Using FTP and PHP to get an array of file details such as size and…

2 years ago

Creating Laravel form requests

Creating and using Laravel form requests to create cleaner code, separation and reusability for your…

2 years ago

Improving the default Laravel login and register views

Improving the default Laravel login and register views in such a simple manner but making…

2 years ago

Laravel validation for checking if value exists in the database

Laravel validation for checking if a field value exists in the database. The validation rule…

2 years ago