Crop 16:9 to 4:5 with video-filter: width 0.45 and an x offset

To crop 16:9 to 4:5 in Sume video-filter, use width 0.45, height 1 and an x between 0 and 0.55. Here is the math, the x choice and the output scale.

5 min readSume
All posts

To cut a 4:5 portrait out of a 16:9 clip with Sume, send one crop op with width: 0.45, height: 1, y: 0 and an x between 0 and 0.55. Centered, that is x: 0.275. The crop values are fractions of the source frame, so you do not need to know the pixel size.

The rule comes from the video filter docs: x, y in [0, 1], width and height in [0.05, 1], and x + width and y + height must each be at most 1.

What is the math for 4:5 from 16:9?

A 16:9 frame has an aspect of 1.7778 and a 4:5 frame has 0.8. Keep the full height and the kept width is 0.8 divided by 1.7778, which is 0.45 of the source width. The widest x that still fits is 1 minus 0.45, so 0.55.

The crop is exact only for sources that are truly 16:9. The compiler even-rounds the compiled size for yuv420p, so a 1920x1080 source gives about 864x1080, which is a hair off 4:5 at the pixel level. Treat the result as 4:5 for display, not as a guaranteed 864x1080.

Where should the x offset go?

Pick x from where the subject sits, not by default. Here are three values.

x offsets for a 0.45-wide crop, read 2026-10-02
Subject positionxKept range of the source width
Left third00 to 0.45
Centered0.2750.275 to 0.725
Right third0.550.55 to 1

What does the request look like?

Check first with the free check endpoint, then encode. Import the source before either call, because only media.sume.com URLs are accepted. Writes need an Idempotency-Key.

curl -X POST https://api.sume.com/v1/video-filter \
  -H "Authorization: Bearer $SUME_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: crop-4x5-001" \
  -d '{
    "video_url": "https://media.sume.com/artifacts/artf_demo/talk.mp4",
    "ops": [{"op":"crop","x":0.275,"y":0,"width":0.45,"height":1}]
  }'

What does Sume not do here?

It does not track a subject. The crop box is fixed for the whole clip, so a person who walks across the frame can leave it. For a moving subject, cut the clip with video trim into shots and crop each with its own x.

The op takes no pixel sizes and no scale. To land on exactly 1080x1350 you would add scale in the filtergraph, which runs after ops[]; scale is on the allowlist, but check the program first and read the compiled filters[] in the result.

Finally, the job is async by default. Poll GET /v1/jobs/:id/status, then read /result for the new video_url; the jobs page covers the details.

Sources

Related posts

More in Media tools

All Media tools posts

Written by Sume