You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[FFMPEG filters](https://www.ffmpeg.org/ffmpeg-filters.html) provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay filter. The easiest way to install ffmpeg is to [download](https://www.ffmpeg.org/download.html) a pre-built binary for your specific platform. Then you don’t have to worry about including and installing all the right dependencies and codecs you will be using.
Once you have ffmpeg installed, adding a watermark is as easy as passing your existing source through an overlay filter like so:
Basically, we’re passing in the original video, and an overlay image as inputs, then passing it through the filter, and saving the output as test1.mp4.
We specify a specific position of the overlay in pixels – **10:10** puts the video 10 pixels from the top and 10 pixels from the right. (x:y coordinates)
In some cases you might not know the exact dimensions of the videos you’ll be watermarking. Fortunately, there are variables you can use to better position your watermark depending on the size of the video. These variables include:
***main_h** – the video’s height
***main_w** – the video’s width
***overlay_h** – the overlay’s height
***overlay_w** – the overlay’s width
Using these variable we can position the watermark right in the center of the video like so:
If we wanted to add branding or a watermark to the clip but not cover the existing video, we can use the [pad filter](https://www.ffmpeg.org/ffmpeg-filters.html#pad) to add some padding to our clip, and then position our watermark over the padding like so: