Add Watermark to Top Right of Video with FFmpeg

This guide provides a straightforward tutorial on how to position an image watermark in the top-right corner of a video using the FFmpeg overlay filter. You will learn the exact command-line syntax, understand how the coordinate system works, and see practical examples to customize the watermark’s padding.

To place a watermark in the top-right corner, you must calculate the horizontal (x) and vertical (y) coordinates using FFmpeg’s built-in variables.

The Coordinate Formula

By subtracting the width of the watermark from the width of the video, the image is pushed to the far right edge. Setting the vertical coordinate to zero aligns it with the top edge.

Basic Command

Use the following command to place the watermark flush against the top-right corner:

ffmpeg -i input.mp4 -i watermark.png -filter_complex "overlay=main_w-overlay_w:0" output.mp4

In most cases, placing a watermark directly against the edge looks crowded. You can add padding (for example, 20 pixels of space from both the top and right edges) by adjusting the math:

ffmpeg -i input.mp4 -i watermark.png -filter_complex "overlay=main_w-overlay_w-20:20" output.mp4

Parameter Breakdown