Watermark and Logo Overlay — How to Use the overlay Filter

The overlay filter is used to burn logos and copyright notices into video. It takes two video inputs and outputs them as a single composited image. This article walks through everything from basic usage to advanced position variables, transparent PNGs, and time-limited display.

Verified with: ffmpeg 6.1


1. overlay Filter Basics

The overlay filter requires two inputs. Specify the video and logo image separately with -i, and composite them with -filter_complex.

ffmpeg -i input.mp4 -i logo.png -filter_complex "overlay=10:10" output.mp4

2. Built-in Variables for Position

Using variables instead of fixed numbers for coordinates allows the position to automatically adapt when the video size changes.

VariableMeaning
main_w / WWidth of the main video
main_h / HHeight of the main video
overlay_wWidth of the overlay (logo)
overlay_hHeight of the overlay (logo)

Bottom-right placement (the most commonly used pattern)

ffmpeg -i input.mp4 -i logo.png -filter_complex "overlay=main_w-overlay_w-10:main_h-overlay_h-10" output.mp4

Other common positions:

PositionX expressionY expression
Top-left1010
Top-rightmain_w-overlay_w-1010
Bottom-left10main_h-overlay_h-10
Bottom-rightmain_w-overlay_w-10main_h-overlay_h-10
Center(main_w-overlay_w)/2(main_h-overlay_h)/2

3. Using Transparent PNGs Directly (Alpha Channel Support)

When using a PNG logo with transparent areas, you can adjust the size with the scale filter before compositing.

ffmpeg -i input.mp4 -i logo.png -filter_complex "[1:v]scale=100:-1[wm];[0:v][wm]overlay=10:10" output.mp4

Filter graph explanation:

  1. [1:v]scale=100:-1[wm] — Resizes the logo (second input) to 100px wide (preserving aspect ratio) and labels it [wm]
  2. [0:v][wm]overlay=10:10 — Composites the main video and the resized logo at position (10, 10)

Key point: FFmpeg automatically handles transparency for alpha channel PNGs. No special options are required.


4. Display Only During a Specific Time Range (enable Option)

Using the enable option, you can specify a time range in seconds during which the logo is visible.

ffmpeg -i input.mp4 -i logo.png -filter_complex "overlay=10:10:enable='between(t,0,5)'" output.mp4

This is useful when you want the logo to appear only during a specific section (e.g., intro or outro) rather than the entire video.


5. Summary: The Standard Bottom-Right Logo Command

This is the most commonly used pattern in real-world use.

ffmpeg -i input.mp4 -i logo.png -filter_complex "[1:v]scale=150:-1[wm];[0:v][wm]overlay=main_w-overlay_w-20:main_h-overlay_h-20" output.mp4

Common Notes



Tested with: ffmpeg 6.1.1 / Ubuntu 24.04 (GitHub Actions runner)
Primary sources: ffmpeg.org/ffmpeg.html / ffmpeg.org/ffmpeg-filters.html / trac.ffmpeg.org