<p>For a target size of 720x1280, you would use</p>

<pre><code>ffmpeg -i img.png -vf scale=-1:1280:flags=lanczos,crop=720:1280:(iw-720)/2:0 out.png
</code></pre>

CC BY-SA 3.0
2016-09-23T18:40:00.887Z
Thanks, It looks like it only added the padding on top of the video, but that might actually work better for my needs.
Smeegs
CC BY-SA 3.0
2016-09-23T18:36:18.467Z
2016-09-23T18:36:18.467Z
Gyan
<p>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.</p>

<p>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.</p>

<p><a href="https://i.sstatic.net/dfTCS.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/dfTCS.png" alt="Here&#39;s a screenshot of the video"></a></p>

CC BY-SA 3.0
2016-09-23T18:17:30.023Z
Is the entire 1280x720 to be kept or is the area of interest smaller? A screenshot would help.
Gyan
CC BY-SA 3.0
2016-09-23T18:18:16.987Z
Much smaller. I'll send a screenshot in a moment.
Smeegs
CC BY-SA 3.0
2016-09-23T18:23:07.303Z
I've added a screenshot
Smeegs
<ffmpeg>
Trying to resize a video by cropping the sides and adding height is it possible to do this with ffmpeg?
Smeegs
# Trying to resize a video by cropping the sides and adding height is it possible to do this with ffmpeg?

(Asked by: username_0 on 2016-09-23)

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](https://i.sstatic.net/dfTCS.png)](https://i.sstatic.net/dfTCS.png)

**Tags:** ffmpeg

> **Comments:**
> **username_1**: Is the entire 1280x720 to be kept or is the area of interest smaller? A screenshot would help.  
> **username_0**: Much smaller. I'll send a screenshot in a moment.  
> **username_0**: I've added a screenshot  

---

## 1 answers

### Answer by username_1 on 2016-09-23. Score: 1 | Accepted answer

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

> **Comments:**
> **username_0**: Thanks, It looks like it only added the padding on top of the video, but that might actually work better for my needs.  

---

