ffmpeg scale2ref explanation?

Viewed 1949

I'm applying a watermark to a video. I'm trying to get the watermark to scale proportionally to the video dimensions. I've seen maybe a dozen different answers using scale2ref, but no explanations as to actually what's happening, so I'm finding it difficult to know how to implement/make changes to the configs to work for my situation.

Current overlay command:

ffmpeg -i test.mp4 -i logo.png -filter_complex "overlay=0:0" output.mp4

Some answers I've looked at:

ffmpeg creating gif from images, add watermark during creation?

ffmpeg fix watermark size or percentage

What are the rules to how scale2ref works?

1 Answers

Apply this filter to position the watermark

Center:
overlay=(main_w-w)/2:(main_h-h)/2
Top left corner:
overlay=1:1
Top right corner:
overlay=W-w-1:1
lower right corner:
overlay=W-w-1:H-h-1
Bottom left corner:
overlay=1:H-h-1
Bottom right corner. Padding 10px to the right and -10px to the bottom:
overlay=main_w-w/1:main_h-h/2
Bottom right corner. Padding -10px to the right and -10px to the bottom:
overlay=main_w-w/1:main_h-h/2

Center:
-filter_complex "overlay=(main_w-w)/2:(main_h-h)/2" -preset ultrafast -codec:a copy

Related