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.

1 Answer 1


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];
                        [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


ffmpeg -f concat -i text -i overlay
       -filter_complex "[0]fps=25[bg];
                        [bg][ovrly]overlay=0:0,scale=2*trunc(iw/2):2*trunc(ih/2)" output.jpg
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Dr Mayhem
    Commented Mar 3, 2019 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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