Basically, I want to convert an mp4 file that's in landscape to portrait. It's a single image on a black background with no sound. I want to keep the size and aspect ratio of the image intact and my plan is to convert it from 1280x720 to 720x1280.

I'm playing around with crop and padding, but I'm wondering if there's a way to get this done with one command, and if I need to reencode it.

Here's a screenshot of the video

  • Is the entire 1280x720 to be kept or is the area of interest smaller? A screenshot would help.
    – Gyan
    Sep 23, 2016 at 18:17
  • Much smaller. I'll send a screenshot in a moment.
    – Smeegs
    Sep 23, 2016 at 18:18
  • I've added a screenshot
    – Smeegs
    Sep 23, 2016 at 18:23

1 Answer 1


For a target size of 720x1280, you would use

ffmpeg -i img.png -vf scale=-1:1280:flags=lanczos,crop=720:1280:(iw-720)/2:0 out.png
  • Thanks, It looks like it only added the padding on top of the video, but that might actually work better for my needs.
    – Smeegs
    Sep 23, 2016 at 18:40

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.