0

The image to be overlayedI 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 Sep 30 '18 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. – Sandeep Yadav Oct 1 '18 at 16:13
0

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.

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.