I am using the following code to overlay my video on a background .png
file:
ffmpeg -i C:\image.png -i C:\input.mp4 \
-filter_complex "[1:v][0:v]scale2ref=-1:950[ovrl][0v]; \
[0v][ovrl]overlay=x=(main_w-overlay_w)/2:y=0[watermark]" \
-map "[watermark]" -map 1:a -codec:v libx264 -preset veryfast \
-crf 18 -c:a copy C:\output.mp4
So, basically, my image.png is 1800x1200 and I am overlaying the video on top of this image starting from y=0
and the x
coordinate to fall into the middle of the image.
However, since my input videos are of different resolution, of different sizes, that is why I am scaling the videos to fit exactly a height of 950 pixels
and of a relative width.
Everything is working fine!
The question is: how can I optimize this process to get the same result but MUCH FASTER?
This is taking ages to process the videos one by one.
"[1:v]scale=-1:950[ovrl];[0:v][ovrl]overlay=.....