Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overlay multiple images on one base image using FFMPEG

Tags:

ffmpeg

I have command to overlay 2 images , and its working fine,

"-y -i \(image1) -i \(image2) -filter_complex [0][1]overlay=(W-w)/2:(H-h)/2 \(out)"




I wish to add multiple images
for example: we have four images [image1,image2, image3, image4].

Now image1 will be base one, I want to other 3 images on image1 as overlay.

The images place can be vary randomly.

I have been trying to search this on google, everything redirects to multiple images on video or combine video.


Can anybody help me.

like image 521
Caleb Avatar asked Dec 08 '25 06:12

Caleb


1 Answers

You'll need to use multiple overlay filters. A basic example:

ffmpeg -i input0 -i input1 -i input2 -i input3 
-filter_complex "[0][1]overlay[bg0];[bg0][2]overlay[bg1];[bg1][3]overlay[v]"
-map "[v]" output
like image 87
llogan Avatar answered Dec 12 '25 04:12

llogan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!