Overlay an Image onto a resized video. FFMPEG 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??
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
       "[0]scale=1004x512:force_original_aspect_ratio=decrease,
           pad=1024:1024:10+(1004-iw)/2:10+(512-ih)/2[vid];
        [vid][1]overlay"  output


The 10 in the pad expressions represent the border thickness.