Scale with force_original_aspect_ratio=decrease, then pad: a 1920x1080 picture fits a 1080x1920 frame at 1080x608, with black bars above and below. At ReelSDK's $0.02 per compute minute, a 10-second clip costs under three quarters of a cent.

Letterbox and pad a video with ffmpeg

Two filters do it: scale shrinks a 16:9 picture until it fits a 9:16 frame, and pad fills the rest with black or any colour. ReelSDK's free vertical video converter does the same in your browser, with bars or a blurred copy behind the picture. cropdetect finds the bars again, but its default rounding of 16 can cut 4 px of real picture from each side of a 1080-wide frame.

GuidesUpdated

letterbox
ffmpeg -i in.mp4 -vf "scale=1080:1920:force_original_aspect_ratio=decrease,pad=1080:1920:(ow-iw)/2:(oh-ih)/2:color=black,setsar=1" \
  -c:v libx264 -crf 20 -preset veryfast -c:a copy -movflags +faststart tall.mp4

force_original_aspect_ratio=decrease scales the 1920x1080 frame down to 1080x608 so it fits inside 1080x1920, and pad centres it with (ow-iw)/2:(oh-ih)/2. tall.mp4 came out at 1080x1920, with 656 px of black above and below the picture.

Variations

The other commands you will need

  1. 9:16 into 16:9 with bars at the sides

    The same filters with the sizes swapped: a 1080x1920 clip becomes a 608x1080 picture at x=656, centred in a 1920x1080 frame.

    pillarbox
    ffmpeg -i clip.mp4 -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2:color=black,setsar=1" \
      -c:v libx264 -crf 20 -preset veryfast -c:a copy -movflags +faststart wide.mp4
  2. A square on white

    A negative x or y tells pad to centre the picture, so -1:-1 saves typing the expressions. color takes a name or a hex value; this one is white, 1080x1080.

    square
    ffmpeg -i in.mp4 -vf scale=1080:1080:force_original_aspect_ratio=decrease,pad=1080:1080:-1:-1:color=white,setsar=1 \
      -c:v libx264 -crf 20 -preset veryfast -c:a copy -movflags +faststart square.mp4
  3. Measure the bars, then crop them off

    cropdetect prints a crop= value for each frame. Set round=2: with the default of 16 it reported 1072 px wide on our letterboxed file, 8 px narrower than the real picture. The exact crop gives back the 1080x608 picture.

    remove bars
    ffmpeg -i tall.mp4 -vf cropdetect=round=2 -f null - 2>&1 | grep -o 'crop=[0-9:]*' | sort | uniq -c
    # 291 crop=1080:608:0:656
    ffmpeg -i tall.mp4 -vf crop=1080:608:0:656 \
      -c:v libx264 -crf 20 -preset veryfast -c:a copy -movflags +faststart uncropped.mp4

The flags

The filters and options in these commands

The filters and options in these commands
FlagWhat it doesUsed here
pad=1080:1920Size of the output frame, bars includedLetterbox
(ow-iw)/2:(oh-ih)/2x and y of the picture; half the spare room centres itLetterbox, pillarbox
color=blackBar colour, a name or hex; black is the defaultAll three
force_original_aspect_ratio=decreaseShrinks the picture until both sides fit, keeping its shapeAll three
-1:-1A negative x or y centres the pictureSquare
setsar=1Square pixels, so players show the frame at its real shapeAll three
cropdetect=round=2Prints the picture area; round defaults to 16Remove bars
crop=1080:608:0:656Width, height, x and y of the area to keepRemove bars

Source: ffmpeg filters: pad, scale, cropdetect, crop, checked November 2026.

Letterbox or pillarbox

Bars above and below are a letterbox; bars at the sides are a pillarbox. Both come from the same two steps: scale the picture until it fits the frame, then pad. Skip the first step and pad stops with "Padded dimensions cannot be smaller than input dimensions."

The ffmpeg manual on pad: "If x or y evaluate to a negative number, they'll be changed so the input image is centered on the padded area." That is why -1:-1 and (ow-iw)/2:(oh-ih)/2 give the same result. Black is the default colour.

The cropdetect rounding trap

cropdetect looks for rows and columns darker than its limit and prints the area that is left. By default it rounds that area to a multiple of 16. On our letterboxed file the picture is 1080 px wide, which is not a multiple of 16, so it printed crop=1072:608:4:656 and would have cut 4 px of picture from each side.

With round=2 it printed the exact crop=1080:608:0:656 on almost every frame and crop=608:1080:656:0 on the pillarboxed one. Count the values over the whole clip, as the fourth command does, because dark scenes can shrink the area on a few frames.

Bars or a blurred fill

Bars keep every pixel of the picture and encode small: tall.mp4 is under 3 MB for 10 seconds of vertical HD. For social feeds, a blurred copy of the clip often looks better than black; the blurred background guide does the same fit with gblur behind it.

Either way, the args run unchanged on the API, billed per compute second; see pricing.

Without installing ffmpeg

The same command as one API call

Send the first command's args to POST /v1/ffmpeg with the video's URL in inputs. Each job runs ffmpeg 8.1 on a fresh machine at $0.02 per compute minute, billed per second; this one finished in about 17 seconds and cost under three quarters of a cent.

terminalTry it
curl "https://api.reelsdk.com/v1/ffmpeg?wait=60" \
  -H "Authorization: Bearer $REELSDK_KEY" \
  --json '{
    "inputs": {
      "in.mp4": "https://api.reelsdk.com/f/lib/demo/landscape.mp4"
    },
    "args": [
      "-i", "in.mp4", "-vf",
      "scale=1080:1920:force_original_aspect_ratio=decrease,pad=1080:1920:(ow-iw)/2:(oh-ih)/2:color=black,setsar=1",
      "-c:v", "libx264", "-crf", "20", "-preset", "veryfast", "-c:a", "copy",
      "-movflags", "+faststart", "tall.mp4"
    ],
    "outputs": ["tall.mp4"]
  }'
tall.mp4 from the API: the 16:9 clip centred in a 1080x1920 frame with black bars.Input: 1920x1080 input

FAQ

Questions, answered

How do I turn a 16:9 video into 9:16 with black bars?

Use -vf "scale=1080:1920:force_original_aspect_ratio=decrease,pad=1080:1920:(ow-iw)/2:(oh-ih)/2". A 1920x1080 picture becomes 1080x608, with 656 px of black above and below.

Why does pad say padded dimensions cannot be smaller than input dimensions?

pad only adds space; it cannot shrink. Our 1920x1080 clip padded to 1080x1920 without a scale stopped with exactly that error. Scale first with force_original_aspect_ratio=decrease so the picture fits inside the padded size.

Why did cropdetect cut off part of my picture?

Its round option defaults to 16, so a 1080 px wide picture came back as 1072. Run cropdetect=round=2 to get the exact size.

Can the bars be a colour other than black?

Yes. pad takes color=white, a colour name or a hex value such as color=0x1a1a1a.

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