The image to be overlaid

I have an image which is a frame of 1024×1024 resolution which is half empty or transparent... I have various number of videos of different resolutions and I want to scale them to the empty space width and height(might be 1024×512) by keeping the aspect ratio of the video unchanged and I want to add padding for the empty space.

Whenever I'm trying to overlay the image over the video, the output video is in the resolution same as the input video's because of which half of the frame (input image) is getting cut in the output video.

I need help... I want the output video to have the resolution of the input image not of the input video's. It should more or less look like PIP. Can I do that on FFmpeg??

  • What is the size of the window area?
    – Gyan
    Commented Sep 30, 2018 at 15:23
  • I'm not sure actually ... But consider it around width~1024 and height=512..So almost 1024*512. Like height is half the image size and width is almost the same. Commented Oct 1, 2018 at 16:13

1 Answer 1


I'll assume the window area is 1004x512. You can adjust the command below after getting the exact values.

ffmpeg -i video -i frame -filter_complex
        [vid][1]overlay"  output

The 10 in the pad expressions represent the border thickness.

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.