Read time: 4 minutes

Summary: Watermarks protect copyright and branding. Learn how to add video watermarks using FFmpeg commands. Position-specific commands provided. Executing the process in FFmpeg involves basic steps. Corrupt videos can’t have watermarks; repair them first.

The utilization of a watermark serves the dual purpose of safeguarding your copyright by dissuading unauthorized actions such as reproduction, sharing, circulation, publishing, and exploitation of your work without your explicit consent. Additionally, it aids in the establishment, identification, distribution, and safeguarding of your brand. In this current blog post, we will delve into the process of incorporating a watermark into your video content.

We shall discuss how to add a watermark to videos.

How to add a watermark to a video Using FFMPEG Commands?

You can add a watermark to your video using the FFmpeg command-line utility you can download the FFmpeg utility from the link ‘Builds – CODEX FFMPEG @ gyan.dev’

Commands to add watermark differ according to positions, viz. top left or right, bottom left or right, and center of the screen.

Different commands for different positions on the video screen are given below:

All the commands consist of variables and extensions, which may vary. We have listed them for you:

Variables:
  • ‘inputvideo’ – replace the name of the input video.
  • ‘watermarklogo.png’ – replace the name of the watermark file with extensions like.png, .jpeg, .jpg, etc.
  • ‘outputvideo.flv’– replace ‘flv’ with mpeg, mp4, etc.

And the FFmpeg commands to add a watermark vary according to the position on the screen.

  • Top left corner
    ffmpeg –i inputvideo.avi -vf “movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:10 [out]” outputvideo.flv
  • Top right corner
    ffmpeg –i inputvideo.avi -vf “movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]” outputvideo.flv
  • Bottom left corner
    ffmpeg –i inputvideo.avi -vf “movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:main_h-overlay_h-10 [out]” outputvideo.flv
  • Bottom right corner
    ffmpeg –i inputvideo.avi -vf “movie=watermarklogo.png [watermark]; [in][watermark] overlay=(main_w-overlay_w-10)/2:(main_h-overlay_h-10)/2 [out]” outputvideo.flv
  • Centre
    ffmpeg -i input.mp4 -i logo.png -filter_complex “overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2” -codec:a copy outputvideo.flv
The Process of Executing Command in FFMPEG

The process of executing command is simple, consisting of 3 basic steps:
steps
Prior to commencing the procedure, establish a fresh directory where you will continually append the necessary items outlined in the subsequent instructions. Additionally, assign a distinct name to this directory.

  1. Create a logo/image file (formats can be .BMP,.JPEG,.PNG etc.) and put it in the new folder mentioned above. Name this logo file.
  2. Copy the source video to which you wish to add a watermark and put it in the folder mentioned above. Name this video file.
  3. Copy the ffmpeg.exe file to the new folder mentioned above.
  4. First, decide which position you wish to add a watermark to, then select the command for that position as mentioned in the table above.
    • Select the desired command from the first table, copy it to Notepad, and make necessary variable edits, as previously explained.
    • Press Window Key and R together. This will open the Run box.
    • Type ‘cmd’ and press ‘enter.’ This will open the command window.
    • Navigate back to the newly created folder and copy its path.
    • Return to the Command window; at the blinking white cursor, type ‘cd.’
    • Press ‘space’ and paste the path of the folder.
    • Press’ Enter.’
    • To run the next command, go to Notepad and copy the edited position command.
    • Go back to the command window, and paste the position command copied in step (h) at the cursor. Paste this path. Press’ Enter.’
    • Let the process complete.
    • Go back to your folder, where you will find the output video.
    • Here, you can find the video with the watermark.
Can we add a watermark to a corrupt video?

Adding a watermark to a corrupted video is not feasible. Nevertheless, you have the option to utilize Kernel Video Repair to rectify the video’s corruption before incorporating the watermark. This software serves as an uncomplicated solution for repairing video files in various formats. It effectively addresses nearly all video-related issues, rendering them compatible with various video players. For further insight into its functionality, you can explore the trial version of the tool.

Conclusion

In this blog post, we’ve explored the process of applying a watermark to a video. It’s important to note that adding a watermark to a corrupted video file isn’t feasible. Nevertheless, you can restore the corrupted video first and then proceed with watermarking it. To accomplish this, you may want to consider utilizing a specialized video repair tool.

Kernel Video Repair