crop=ih*9/16:ih cuts a centered 608x1080 slice from a 1920x1080 frame; for black bars, run cropdetect with round=2 first. ReelSDK runs the same crop for $0.02 per compute minute, and its free vertical converter crops in your browser.

Crop a video with ffmpeg: 9:16, square and black bars

crop=w:h:x:y keeps one rectangle of every frame, centered when x and y are left out, and crop=ih:ih makes a 1080x1080 square. ReelSDK's API ran the 9:16 crop of a 10-second clip in about 7 seconds.

GuidesUpdated

9:16 crop
ffmpeg -i landscape.mp4 -vf "crop=ih*9/16:ih" -c:a copy vertical.mp4

ih*9/16 is the input height times 9/16, 607.5 on a 1080-pixel-high frame, and ffmpeg wrote 608. With no x and y the crop is centered, and -c:a copy keeps the audio as it was.

Variations

The other commands you will need

  1. Crop to a square

    Width and height both set to the input height give a centered 1080x1080 square.

    square crop
    ffmpeg -i landscape.mp4 -vf "crop=ih:ih" -c:a copy square.mp4
  2. Crop a fixed region

    x and y count from the top-left corner of the frame. 960:540:960:0 keeps the top-right quarter of a 1920x1080 frame.

    region crop
    ffmpeg -i landscape.mp4 -vf "crop=960:540:960:0" -c:a copy corner.mp4
  3. Find and remove black bars

    cropdetect prints a crop= value for the frames it reads; -f null - throws the output away. Our letterboxed clip holds a 1920x804 picture between 138-pixel bars. With round=2 cropdetect printed crop=1920:804:0:138, and that crop gave a 1920x804 file.

    black bars
    ffmpeg -i letterboxed.mp4 -vf cropdetect=round=2 -f null -
    ffmpeg -i letterboxed.mp4 -vf crop=1920:804:0:138 -c:a copy nobars.mp4

The flags

The flags in these commands

The flags in these commands
FlagWhat it doesUsed here
crop=w:h:x:yKeeps a w by h rectangle whose top-left corner sits at x, yEvery crop
iw, ihThe input width and height, for use in expressionsih*9/16, ih:ih
x and y left outDefault to (in_w-out_w)/2 and (in_h-out_h)/2, which centers the crop9:16 and square
exact=1Crops subsampled video at the exact sizes and offsets instead of rounding them downNot used
cropdetectReads frames and prints the crop that removes dark bordersBlack bars
round=2cropdetect: width and height must divide by this; the default is 16Black bars
limitcropdetect: the level below which a pixel counts as black, 24 on a 0 to 255 scale by defaultDefault
-c:a copyCopies the audio; only the video is encoded againEvery crop

Source: ffmpeg filters: crop and cropdetect, checked November 2026.

How crop reads w:h:x:y

The crop filter takes the output width and height first, then the position of the top-left corner. Leave x and y out and ffmpeg fills them in as (in_w-out_w)/2 and (in_h-out_h)/2, a centered crop. Width and height default to the full input, so crop=ih:ih on a landscape frame is a centered square.

Every value can be an expression. ih*9/16 came to 607.5 on our clip and ffmpeg wrote 608 columns, so the file is a hair wider than 9:16. For a full-size 1080x1920 export, scale the crop up afterwards, as the vertical video guide does in one filter chain.

A crop always re-encodes the video

Filters work on decoded frames, so cropping means decoding the video and encoding it again; -c copy can't crop. Only the audio passes through untouched with -c:a copy.

With no -c:v, ffmpeg encoded our MP4 crops with libx264 at its defaults: CRF 23 and the medium preset. Add -crf and -preset to choose size and speed yourself; the CRF guide measures what each step does.

Black bars and cropdetect

cropdetect looks for rows and columns darker than its limit, 24 on a 0 to 255 scale by default, and prints the smallest crop that keeps the rest. It skips the first 2 frames and prints a line for every frame after that; take the last one, which by default covers the largest picture area seen in the whole run.

Our test file has a 1920x804 picture inside a 1920x1080 frame. With the default round=16, cropdetect printed crop=1920:800:0:140: 804 doesn't divide by 16, so it cut 2 rows of picture at the top and 2 at the bottom. With round=2 it printed the exact crop=1920:804:0:138.

Crop, scale or pad

Crop throws pixels away, scale resizes all of them, and pad adds a border around them. To turn landscape footage into a vertical video you either crop the sides off, as above, or fit the whole frame and pad it, which keeps everything but leaves bars. The resize guide has the fit-and-pad command and the aspect ratio catch that comes with it.

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 crop 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", "crop=ih*9/16:ih", "-c:a", "copy",
      "vertical.mp4"
    ],
    "outputs": ["vertical.mp4"]
  }'
vertical.mp4 from the API: 608x1080, about 2 MB.Input: 1920x1080 input

FAQ

Questions, answered

How do I crop a video to 9:16 with ffmpeg?

Use -vf "crop=ih*9/16:ih". It keeps the full height and a centered slice of the width: 608x1080 from a 1920x1080 clip. Scale it to 1080x1920 afterwards if the platform asks for that size.

How do I remove black bars from a video?

Run ffmpeg -i in.mp4 -vf cropdetect=round=2 -f null -, take the last crop= value it prints and pass it to the crop filter. On our letterboxed clip that was crop=1920:804:0:138.

Why is cropdetect a few pixels off?

Its round option defaults to 16, so the width and height it prints divide by 16. Our 804-pixel-high picture came back as 800 rows. Set round=2 for an exact crop that still has even sizes.

Can ffmpeg crop a video without re-encoding?

Not with the crop filter. Filters work on decoded frames, so the video stream is encoded again. The audio can be copied as it is with -c:a copy.

Can I crop a video without installing ffmpeg?

Yes. Send the same args to POST https://api.reelsdk.com/v1/ffmpeg with the video URL in inputs and the cropped file in outputs. 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