I would like to apply a PNG overlay (watermark) to an arbitrary video file using ffmpeg. I would like the video to stay its original size (which I don't know ahead of time), and the PNG to be scaled relative to the video.
For example, the following command places the overlay in the top left:
ffmpeg.exe -i input.mov -i header.png -filter_complex \
"[0][1] overlay=0:0" output.mkv
And the following command scales the overlay relative to itself (1/5 of the width, height relative):
ffmpeg.exe -i input.mov -i header.png -filter_complex \
"[1] scale=iw/5:-1 [scaled]; \
[0][scaled] overlay=0:0" output.mkv
How could I make the overlay 1/5 of the width of input.mov? (For example, is it possible to store and/or query the width of another filter clause?)
The closest question I've come across is Scale watermark overlay by video size with ffmpeg but that answer uses external Linux/Cygwin commands. FFmpeg watermark was also helpful while I was figuring ffmpeg out. However, I'm on Windows and invoking ffmpeg via Python, so I'd like to do it all within the filter_complex clause. If that's not possible, I'd like to know for sure so I can stop trying :)