0

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.

output

enter image description here enter image description here

11
  • Please show the complete console output from your command.
    – llogan
    Mar 30, 2016 at 21:15
  • Why are you using scale2ref with a fixed resolution? The whole idea of using scale2ref is that the reference is unknown or varying in size. For a fixed height of 950, you can just use regular scale and save some time.
    – Gyan
    Mar 31, 2016 at 8:47
  • @Mulvya how? can you give an example?
    – Marcel
    Mar 31, 2016 at 15:01
  • Replace with "[1:v]scale=-1:950[ovrl];[0:v][ovrl]overlay=.....
    – Gyan
    Mar 31, 2016 at 15:04
  • @Mulvya your suggestion doesn't make the process faster, but it changes the scaling system. Mine rescaled everything to a a height of 950px and the width accordingly and leaving me the same margin of the background image. but yours, doesn't leave the same margins, the margins get reduced, I see less of the background image.
    – Marcel
    Mar 31, 2016 at 15:13

0

You must log in to answer this question.

Browse other questions tagged .