<p>To keep aspect ratio change:</p>

<pre><code>-vf scale=640:360
-vf scale=1280:720
-vf scale=1920:1080
</code></pre>

<p>to:</p>

<pre><code>-vf scale=-2:360
-vf scale=-2:720
-vf scale=-2:1080
</code></pre>

<p>See <a href="https://ffmpeg.org/ffmpeg-filters.html#scale" rel="nofollow noreferrer">scale filter documentation</a> for more info.</p>

CC BY-SA 4.0
2020-05-23T21:53:24.650Z
How can I support both horizontal and vertical videos at the same time, say 1920x1080 and 1080x1920 ?
london_utku
CC BY-SA 4.0
2020-05-24T19:03:06.560Z
@UtkuBulkan See [Resizing videos to fit into specific size](https://superuser.com/a/1136305/110524).
llogan
CC BY-SA 4.0
2020-05-23T20:59:54.383Z
2020-05-23T20:59:54.383Z
llogan
<p>If you want the output resolution to be 1280x720 and the video keeps its original ratio aspect as well:</p>

<pre><code>ffmpeg  -v error -stats -i input -vf
"scale=1280:720:force_original_aspect_ratio=1,pad=1280:720:(ow-iw)/2:(oh-ih)/2"
output
</code></pre>

CC BY-SA 4.0
2020-06-15T05:34:38.877Z
2020-06-17T01:29:58.417Z
2020-06-17T01:29:58.417Z
Rami Magdi
<p>I am using the following ffmpeg command to create multiple resolutions for the same video content.</p>

<pre><code>ffmpeg -i ${f} -c:v libx264 -keyint_min 150 \
-g 150 -profile:v main -f h264 -dash 1 \
-an -vf scale=640:360 -b:v 750k ${streamsdirectory}/${filename}_640x360_750k.mp4 \
-an -vf scale=1280:720 -b:v 2000k ${streamsdirectory}/${filename}_1280x720_2000k.mp4 \
-an -vf scale=1920:1080 -b:v 4000k ${streamsdirectory}/${filename}_1920x1080_4000k.mp4
</code></pre>

<p>What is the best strategy to keep respect for the aspect ratio for any video content ?</p>

<ffmpeg><transcoding><aspect>
Best strategy to keep aspect ratio consistent for all videos having any resolution
london_utku
# Best strategy to keep aspect ratio consistent for all videos having any resolution

(Asked by: username_0 on 2020-05-23)

I am using the following ffmpeg command to create multiple resolutions for the same video content.
ffmpeg -i ${f} -c:v libx264 -keyint_min 150 \
-g 150 -profile:v main -f h264 -dash 1 \
-an -vf scale=640:360 -b:v 750k ${streamsdirectory}/${filename}_640x360_750k.mp4 \
-an -vf scale=1280:720 -b:v 2000k ${streamsdirectory}/${filename}_1280x720_2000k.mp4 \
-an -vf scale=1920:1080 -b:v 4000k ${streamsdirectory}/${filename}_1920x1080_4000k.mp4

What is the best strategy to keep respect for the aspect ratio for any video content ?

**Tags:** ffmpeg, transcoding, aspect


---

## 2 answers

### Answer by username_2 on 2020-06-15. Score: 3 | Accepted answer

If you want the output resolution to be 1280x720 and the video keeps its original ratio aspect as well:
ffmpeg  -v error -stats -i input -vf
"scale=1280:720:force_original_aspect_ratio=1,pad=1280:720:(ow-iw)/2:(oh-ih)/2"
output


---

### Answer by username_1 on 2020-05-23. Score: 1

To keep aspect ratio change:
-vf scale=640:360
-vf scale=1280:720
-vf scale=1920:1080

to:
-vf scale=-2:360
-vf scale=-2:720
-vf scale=-2:1080

See scale filter documentation for more info.

> **Comments:**
> **username_0**: How can I support both horizontal and vertical videos at the same time, say 1920x1080 and 1080x1920 ?  
> **username_1**: @UtkuBulkan See [Resizing videos to fit into specific size](https://superuser.com/a/1136305/110524).  

---

