You are here: Home » Engineering » How to add watermark to your videos?

How to add watermark to your videos?

Adding Watermark to videos is an ideal way to protect against content theft and enhance your brand presence. It enables the users to know the content belongs to you and can't be used without proper authorization.

There are many free tools available that can add watermarks. You can achieve this programmatically as well.

FFMPEG is one such tool that provides an easy way to add watermarks. This gives you more control over the entire process.

Image Watermarks

As a start, to add a basic watermark image to your video, you can use the below command.

ffmpeg -i input.mp4 -i watermark.png -filter_complex "overlay=10:10" output.mp4

Customizations:

Basically, You can customize the position and opacity of the image.

main_h – Video's height
main_w – Video's width
overlay_h – Overlay's height
overlay_w – Overlay's width

ffmpeg -i input.mp4 -i watermark.png -filter_complex "overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2" output.mp4

The opacity for images can be controlled using the below parameter.

ffmpeg -i input.mp4 -i watermark.png -filter_complex "[1]lut=a=val*0.3[a];[0][a]overlay=0:0" -y output.mp4

Text Watermarks

To add a basic text as watermark to your video, you can use the below command.

ffmpeg -i input.mp4 -vf "drawtext=text='@your text'" -y output.mp4

Customizations:

Furthermore, You can configure the watermark's styling and position with inbuilt parameters.

ffmpeg -i input.mp4 -vf "drawtext=text='@your text':x=(W-tw-10):y=(H-th-10)" -y output.mp4

Additionally, you can configure the font size and family.

ffmpeg -i input.mp4 -vf "drawtext=text='@your text':x=(W-tw-10):y=(H-th-10):fontfile=/path/to/font/font.ttf:fontsize=15:fontcolor=white" -y output.mp4

Similarly, You can configure the opacity of your watermark.

ffmpeg -i input.mp4 -vf "drawtext=text='@your text':x=(W-tw-10):y=(H-th-10):fontfile=/path/to/font/font.ttf:fontsize=15:fontcolor=white@0.5" -y output.mp4