0

I saw one app and I'm willing to add photos similar to how that app does.

Following is the screenshot of the video that I got from that app:

I'm not sure what is the black part in there on the right-hand side.

Below is the end result after a photo has been added:

Now the photo that I've added seems like it's behind the video, so any help how to do that and an answer to what the black part the right side of the video is, then it will be great and highly appreciated.

3

I'm going to call the video/image on top, overlay, and the bottom one, the photo.

ffmpeg -i photo -i overlay
       -filter_complex "[1]split=2[color][alpha];
                        [color]crop=iw/2:ih:0:0[color];[alpha]crop=iw/2:ih:iw/2:0[alpha];
                        [color][alpha]alphamerge[ovrly];
                        [0][ovrly]overlay=0:0" output.jpg

I assume that if the resolution of the video is WxH then the resolution of the photo is W/2 X H. If it's not, add a crop filter to the photo and then use that result in the overlay.

If the resulting video has uneven dimensions, add a scale filter after the overlay to rectify that: [0][ovrly]overlay=0:0,scale=2*trunc(iw/2):2*trunc(ih/2)


If you have a sequence of images of the same resolution, then you can use the concat demuxer.

First, create a text file,

file 'image1'
duration 2.0
file 'image2'
duration 4.0
file 'image3'
duration 2.0

Then,

ffmpeg -f concat -i text -i overlay
       -filter_complex "[0]fps=25[bg];
                        [1]split=2[color][alpha];
                        [color]crop=iw/2:ih:0:0[color];[alpha]crop=iw/2:ih:iw/2:0[alpha];
                        [color][alpha]alphamerge[ovrly];
                        [bg][ovrly]overlay=0:0,scale=2*trunc(iw/2):2*trunc(ih/2)" output.jpg
|improve this answer|||||

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.