I am trying to overlay a video over an image in FFMPEG. For this I am using the below command.

-i C:\Users\Vivek\Desktop\SAM\Effects\bubbles.mp4 -i C:\Users\Vivek\Desktop\selfie.jpg -filter_complex "[1:v][0:v]scale2ref[ua][b];[ua]setsar=1,format=yuva444p,colorchannelmixer=aa=0.5[u];[b][u]overlay[v]" -map "[v]" C:\Users\Vivek\Desktop\selfie.gif

The above commands work perfectly but this stretches the image according to the video's width while I want the reverse of it i.e to stretch video to width and height of image.


Switch the inputs to the scale2ref filter.

  • Is it different from switching the input files? I tried switching the input files but that didn't worked – Vivek Mishra Oct 11 '18 at 17:39
  • What happened ? – Gyan Oct 11 '18 at 17:42
  • Since I am using this wirh unity so my ide just hanged when I did that – Vivek Mishra Oct 11 '18 at 17:43
  • Run it from a shell and check. Should eliminate IDE from the equation. – Gyan Oct 11 '18 at 17:47
  • Okay I will check and revert back. – Vivek Mishra Oct 11 '18 at 17:48

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.