FFmpeg Cookbook
JA

Aspect Ratio Calculator

Enter a width or height to get the other side at the same ratio. Choose 16:9, 4:3, 21:9, 1:1, 9:16 or 2.39:1.

×
16:9

Common Resolution Presets

Name Width Height Ratio
Popular uses
Calculate 16:9 and 9:16 sizesPlan social resolutionsAvoid bars and padding

How to use

  1. Pick a ratio16:9, 4:3, 21:9, 1:1, 9:16 or 2.39:1.
  2. Enter width or heightThe other side is calculated automatically.
  3. Copy the resultUse the width and height in FFmpeg, for example in scale=width:height.

Recommended settings

YouTube / TV
16:9 (1920×1080)
YouTube’s standard ratio on a computer. Full HD TV is 16:9 too.
TikTok / Reels / Shorts
9:16 (1080×1920)
Vertical. TikTok and Reels recommend 9:16, and YouTube treats vertical or square videos up to 3 minutes as Shorts.
Cinematic (scope)
2.39:1 (1920×804 at 1920 wide)
The scope ratio used for films.

When it goes wrong

H.264 encode stops with “width not divisible by 2”

Cause: The width or height is odd.

Fix: Use -2, as in scale=-2:720, to keep the ratio and round to an even number.

Questions

Why even resolution?

Normal H.264 and H.265 video (4:2:0) stores colour once for each 2×2 block of pixels, so libx264 and libx265 refuse an odd width or height.

21:9 vs 2.39:1?

They differ. 21:9 is about 2.33:1. The film scope ratio is 2.39:1 (formerly 2.35:1). “21:9” monitors at 2560×1080 are really about 2.37:1.

More detail (settings, limits, FFmpeg commands)

What each setting means

Aspect ratio
Width:height ratio (e.g. 16:9).
Width / Height
Enter one and the other is calculated. An odd result is rounded up to the next even number.

Browsers and limits

  • Calculator only. To resize a video, use a tool such as the SNS Video Resizer.

The same job with the FFmpeg command line

Keep the ratio, set height to 720 (width rounded to even)
ffmpeg -i input.mp4 -vf scale=-2:720 -c:v libx264 -crf 23 output.mp4
A vertical video becomes narrow, for example 406×720.
Force 1280×720 (other ratios get stretched)
ffmpeg -i input.mp4 -vf scale=1280:720,setsar=1 output.mp4