Overlay an Image onto a resized video. 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.