I have installed a current build of ffmpeg
in order to gain access to the -filter_complex
option in hopes to be able to use a video as an overlay over a static background image that's larger than the video.
Initially I'm simply trying to get the overlay of the video over 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
The output.mov
only has a single frame composed of the background.png
file with no video overlay.
How can I make this work and additionally add a specific coordinate location for the video atop the background?
BONUS: with a singular command, is it also possible to resize the overlay video to a larger size while placing it atop the bg image?
FFmpeg offers the overlay filter as a way to overlay images (or even other videos) onto video streams. To centre overlay/watermark on a video, use this command: ffmpeg -i inputvideo.avi -i watermarklogo.png -filter_complex \ "overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" -codec:a copy output.flv.
That 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 any messages in the output suggesting that something's not working?
To answer your other questions:
You can set the coordinates of the overlay filter to x=100
, y=50
(from top-left) like so:
... -filter_complex overlay=100:50 ...
Resizing the background overlay can be done using the scale filter:
... -filter_complex "[0] scale=1280:960 [bg]; [bg][1] overlay" ...
... -filter_complex "[1] scale=1280:960 [over]; [0][over] overlay" ...
As an addendum, you shouldn't need -filter_complex
to do this, something like:
ffmpeg -i over.mov -vf "movie=background.png [bg]; [bg][in] overlay" out.mp4
should also work. I say "should" because that command actually segfaults with the versions of FFmpeg I tested on, but the command syntax can handle what you want to do without -filter_complex
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With