4/22/2016 - 11:17 PM

FFmpeg add a watermark to video

FFmpeg add a watermark to video

How to Add a Watermark to Video

FFMPEG filters 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 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.


ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay=10:10" test1.mp4

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


ffmpeg -i test.mp4 -i watermark.png \


ffmpeg -i test.mp4 -i watermark2.png \


ffmpeg -i test.mp4 -i watermark.png \