How to place a video in a specific place on top of a larger static background image using ffmpeg?

I installed the current ffmpeg build to access the -filter_complex option in the hope that you can use the video as an overlay on top of the static background image, which is larger than the video.

First, I just try to get the video overlay on top of the static background image to work with the following command (which does not work):

ffmpeg -loop 1 -i background.png -i overlay.mov -filter_complex overlay -shortest -y output.mov

output.mov has only one frame consisting of background.png file without video overlay.

How can I do this work and additionally add a specific coordinate location for the video in the background?

BONUS : with a special command, is it also possible to resize the overlay video to a larger size by placing it on top of the bg image?

+4
source share
1 answer

This command works fine for me (using 0.11.1.git-56ae592 built on Jul 19 2012 or N-42914-gf5a5b43 built on Jul 26 2012 ); the problem is elsewhere. What version of ffmpeg are you using? (There are current builds for a number of versions.) Are there messages on the output indicating that something is not working?

To answer other questions:

  • You can set the filter coordinates to x=100 , y=50 (top to bottom)

     ... -filter_complex overlay=100:50 ... 
  • Changing the size of the background overlay can be done using the scale filter:

     ... -filter_complex "[0] scale=1280:960 [bg]; [bg][1] overlay" ... 

    Strike>

     ... -filter_complex "[1] scale=1280:960 [over]; [0][over] overlay" ... 
  • As a complement, you do not need -filter_complex for this, for example:

     ffmpeg -i over.mov -vf "movie=background.png [bg]; [bg][in] overlay" out.mp4 

    should also work. I say β€œmust” because this command actually neutralizes the versions of FFmpeg that I tested on, but the command syntax can handle what you want to do without -filter_complex .

+3
source

All Articles