C.W.K.
Stream
Lesson 05 of 10 · published

Overlay — Picture-in-Picture, Logos, Watermarks

~10 min · overlay, logo, watermark, pip

Level 0Viewer
0 XP0/73 lessons0/15 achievements
0/100 XP to next level100 XP to go0% complete

Overlay positions

overlay=x:y. Common position expressions:

  • overlay=10:10 — top-left, 10px in.
  • overlay=W-w-10:10 — top-right (W = main width, w = overlay width).
  • overlay=W-w-10:H-h-10 — bottom-right.
  • overlay=(W-w)/2:(H-h)/2 — centered.

Time-aware overlays

enable='between(t,2,5)' — only show overlay between t=2s and t=5s. Useful for sponsor logos, lower-thirds, etc.

Code

Overlay recipes·bash
# Logo top-right with margin
ffmpeg -i in.mp4 -i logo.png \
  -filter_complex "[1:v]scale=200:-2[lg]; [0:v][lg]overlay=W-w-20:20" \
  -c:a copy with_logo.mp4

# Picture-in-picture (small webcam in corner of screen recording)
ffmpeg -i screen.mp4 -i webcam.mp4 \
  -filter_complex "[1:v]scale=320:-2[cam]; [0:v][cam]overlay=W-w-20:H-h-20" \
  -map 0:a -c:a copy pip.mp4

# Show watermark only during a specific time window
ffmpeg -i in.mp4 -i sponsor.png \
  -filter_complex "[1:v]scale=240:-2[sp]; [0:v][sp]overlay=20:H-h-20:enable='between(t,30,60)'" \
  -c:a copy timed.mp4

# Animated overlay (fade in/out)
ffmpeg -i in.mp4 -i logo.png \
  -filter_complex "[1:v]format=rgba,fade=t=in:st=2:d=1:alpha=1,fade=t=out:st=8:d=1:alpha=1[lg]; \
                   [0:v][lg]overlay=W-w-20:20" \
  -c:a copy fade_logo.mp4

External links

Exercise

Add a transparent PNG logo to a video at top-right with 20px margin. Then make a picture-in-picture with two clips. Then make the logo fade in at second 2 and fade out at second 8. Inspect each output and verify the timing/positioning.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.