scale=1280:-2 keeps the shape and an even height: 1280x720 from a 1920x1080 clip. scale=1000:-1 asks libx264 for 1000x563, and it refuses. ReelSDK bills the resize at $0.02 per compute minute, under a quarter of a cent here.

Resize a video with ffmpeg: scale, -2 and fit with pad

Give scale one side and -2 for the other and the aspect ratio holds with an even pixel count. ReelSDK's free video compressor resizes to 720p or 480p in your browser; to fill a 1080x1920 frame, fit the picture and pad the rest.

GuidesUpdated

1280 wide
ffmpeg -i landscape.mp4 -vf scale=1280:-2 -c:a copy 720p.mp4

-2 works the height out from the width and rounds it to an even number: 720 for a 1920x1080 clip. -c:a copy leaves the audio alone.

Variations

The other commands you will need

  1. Why -1 can fail

    -1 keeps the aspect ratio but doesn't round: a 1000-pixel width needs a 562.5-pixel height, ffmpeg made it 563, and libx264 stopped with height not divisible by 2 (1000x563). Use -2.

    odd height
    ffmpeg -i landscape.mp4 -vf scale=1000:-1 odd.mp4
  2. Fit a 1080x1920 frame without stretching

    force_original_aspect_ratio=decrease shrinks the picture until it fits the box, pad centers it on a black 1080x1920 canvas, and setsar=1 keeps the pixels square. Without that last filter our file reported an aspect ratio a hair off 9:16.

    fit and pad
    ffmpeg -i landscape.mp4 -vf "scale=1080:1920:force_original_aspect_ratio=decrease,\
    pad=1080:1920:(ow-iw)/2:(oh-ih)/2,setsar=1" -c:a copy fit.mp4
  3. Halve the size with the Lanczos scaler

    Expressions work too: iw/2:ih/2 halves both sides, 960x540 here, and flags=lanczos picks the Lanczos scaler instead of the default bicubic.

    half size
    ffmpeg -i landscape.mp4 -vf "scale=iw/2:ih/2:flags=lanczos" -c:a copy half.mp4

The flags

The flags in these commands

The flags in these commands
FlagWhat it doesUsed here
scale=1280:-2Width 1280, height from the aspect ratio, made divisible by 21280 wide
-1Keeps the aspect ratio without rounding, so the result can be oddOdd height
iw/2:ih/2Sizes as expressions of the input width and heightHalf size
force_original_aspect_ratio=decreaseShrinks the output inside the box to keep the shape; increase grows it to cover the boxFit
pad=1080:1920:(ow-iw)/2:(oh-ih)/2Centers the picture on a 1080x1920 canvas, black by defaultFit
setsar=1Sets the sample aspect ratio to square pixelsFit
flags=lanczosChooses the scaling algorithm; bicubic is the defaultHalf size
-c:a copyCopies the audio; only the video is encoded againEvery resize

Source: ffmpeg filters: scale and pad, checked November 2026.

-1 or -2

Both keep the aspect ratio. With one side at -1, scale works the other side out exactly and rounds it to a whole pixel. With -2, or any -n, ffmpeg "will, however, make sure that the calculated dimension is divisible by n and adjust the value if necessary."

That matters because libx264 encodes the yuv420p format MP4 players expect, which stores colour at half resolution in both directions, and it refuses odd widths and heights. A 1920x1080 clip scaled to 1000 wide needs 562.5 rows; -1 gave 563 and the encoder stopped, -2 would have given 562.

Fit, fill or stretch

Give scale both sizes and it stretches the picture to them. To keep the shape, add force_original_aspect_ratio: decrease fits the picture inside the box, so you pad the gaps, and increase makes it cover the box, so you crop what sticks out. The crop guide covers the crop side.

Fitting a 1920x1080 clip into 1080x1920 gives a 1080-pixel-wide picture with bars above and below. Filling it gives a full frame from the middle of the clip, as in the vertical video guide.

The sample aspect ratio catch

A 1080-pixel width at 16:9 needs 607.5 rows. scale wrote 608 and kept the shape by storing a sample aspect ratio: our fit.mp4 had SAR 1216:1215, so players stretch each pixel by a hair and the file reports a display aspect ratio of 76:135, not 9:16.

Upload checks and editors that read the display aspect ratio see a file that isn't quite vertical. setsar=1 at the end of the chain marks the pixels as square; the same file then reported SAR 1:1 and 9:16, and the size barely moved.

Which scaler

flags picks the algorithm libswscale uses. ffmpeg -h full on our 8.1 build lists bicubic as the default. lanczos is a common choice for downscaling, and neighbor keeps hard pixel edges, which suits pixel art and screen recordings scaled by whole numbers.

Without installing ffmpeg

The same command as one API call

Send the same args to POST /v1/ffmpeg with the clip's URL in inputs. Each job runs ffmpeg 8.1 on a fresh machine at $0.02 per compute minute, billed per second; this resize finished in about 7 seconds and cost under a quarter of a cent.

terminalTry it
curl "https://api.reelsdk.com/v1/ffmpeg?wait=60" \
  -H "Authorization: Bearer $REELSDK_KEY" \
  --json '{
    "inputs": {
      "landscape.mp4": "https://api.reelsdk.com/f/lib/demo/landscape.mp4"
    },
    "args": [
      "-i", "landscape.mp4", "-vf", "scale=1280:-2", "-c:a", "copy",
      "720p.mp4"
    ],
    "outputs": ["720p.mp4"]
  }'
720p.mp4 from the API: 1280x720, about 3.2 MB.Input: 1920x1080 input

FAQ

Questions, answered

How do I resize a video and keep the aspect ratio?

Set one side and pass -2 for the other: ffmpeg -i in.mp4 -vf scale=1280:-2 out.mp4. ffmpeg works the missing side out from the aspect ratio and keeps it even, 1280x720 for a 1920x1080 input.

How do I fix height not divisible by 2?

Use -2 instead of -1 for the side ffmpeg calculates, or add force_divisible_by=2 when you use force_original_aspect_ratio. libx264 refuses odd sizes in yuv420p; our scale=1000:-1 asked for 1000x563 and failed.

How do I resize a landscape video to 1080x1920 without stretching?

Fit it with scale=1080:1920:force_original_aspect_ratio=decrease, center it with pad=1080:1920:(ow-iw)/2:(oh-ih)/2 and finish with setsar=1. That keeps the whole picture with bars; cropping instead fills the frame.

Why does my resized video show the wrong aspect ratio?

scale stores a sample aspect ratio when it has to round a side, so the display aspect ratio drifts: our fit came out at 76:135 instead of 9:16. Add setsar=1 at the end of the filter chain.

Can I resize a video without installing ffmpeg?

Yes. Send the same args to POST https://api.reelsdk.com/v1/ffmpeg with the video URL in inputs. It runs ffmpeg 8.1 on a fresh machine per job for $0.02 per compute minute, billed per second, and failed jobs are free.

Ready to build?

Ship video from your app today

Your first $0.50 is free, and one key covers every endpoint.

Moonlit lake with a lit cabin under the mountains