What is the easiest way to add watermark to a video?

15,956

Two options I found:

  1. Using ffmpeg:

     ffmpeg -i input.mp4 -i watermark.png -filter_complex "overlay=1500:1000" output.mp4
    
  2. Using avconv:

     avconv -i input.mp4 -i watermark.png -filter_complex 'overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10' output.mp4
    

Information:

ffmpeg's overlay= option allows me to specify where the top left of the image will appear on the video. So adjust those number based on the resolution of your watermark and of your video. Specifying a specific position of the overlay in pixels – 10:10 puts the video 10 pixels from the top and 10 pixels from the left. (x:y coordinates)

avconv has a more complex syntax. It's possible to specify the absolute position using overlay=x=1500:y=1000 or to use relative positions with overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10.

Source:

https://shkspr.mobi/blog/2016/08/easy-ways-to-add-watermarks-to-images-and-videos-in-linux/

http://ksloan.net/watermarking-videos-from-the-command-line-using-ffmpeg-filters/

Share:
15,956

Related videos on Youtube

SamSi
Author by

SamSi

Updated on September 18, 2022

Comments

  • SamSi
    SamSi over 1 year

    It can be image watermark or text watermark. I would prefer text watermark though. I am unable to find a good solution to the above problem. Kindly help me. Video format will be mostly a MP4 H.264 file. Resolutions of the files may vary. If I can do this in batch that's good but as of now I am fine with doing it to a single video file. Thank You

  • Reuben Thomas
    Reuben Thomas over 4 years
    A minor correction to the above: in ffmpeg, the overlay x coordinate counts from the LEFT, not the right.
  • llogan
    llogan over 4 years
    ffmpeg can also use main_w, main_h, overlay_w, and overlay_h. See the overlay filter documentation.