Is it possible and if so how, to use ffmpeg to scale-down the original video that is 360x640 (aspect ratio 1.77777778) into an area that is 282x500 (aspect ratio 1.773) as an overlay on top of a static image, with upper left corner at a x,y location that not 0,0.

What I am trying to do is to use the screencast capture of an Android phone application's usage (like in an explainer video), that currently is 360x640 (actually reported by VLC as having Resolution: 368x642, and Display Resolution: 360x640), that is mp4 encoded - overlaid on a static image of an Android phone (generic, no specific model), s.t. the resulting video appearing to be playing on a device (the static device image serving as a frame for the video).

The original video has no audio, so my need is to deal with video only.



ffmpeg -i video -i image -filter_complex "[0]scale=282:500[vid];[1][vid]overlay=X:Y:eof_action=endall" out.mp4

X and Y should be substituted with the co-ordinates, measured from top-left corner of image.

  • Thanks. Just in case I decide that I do not need to scale-down, should I change the command to: ffmpeg -i video.mp4 -i image.png -filter_complex "[1][vid]overlay=X:Y:eof_action=endall" out.mp4 – icarus74 May 18 '18 at 16:48
  • 1
    Almost. The filter would be [1][0]overlay=X:Y:eof_action=endall – Gyan May 18 '18 at 17:14
  • Thanks again. Somehow with ":eof_action=endall" it didn't work for me. What did was: ffmpeg -i video.mp4 -i image.png -filter_complex "[1][0]overlay=X:Y" out.mp4 (found through random experimentation). – icarus74 May 18 '18 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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