Crop a 16:10 MacBook screen recording to 9:16: width 0.3516
A 16:10 recording needs crop width 0.3515625 for 9:16: 900x1600 at 2560x1600, but 674x1200 at 1920x1200 because 675 is odd. The request and the rounding.
To crop a 16:10 screen recording to 9:16 with Sume video filter, keep the full height and use a crop width of 0.3515625 of the frame. The number is the 9:16 ratio divided by the 16:10 ratio, 0.5625 / 1.6. Centre it with x = (1 - 0.3515625) / 2 = 0.32421875. The crop op takes fractions, so the same request serves a 2560x1600 and a 1920x1200 recording.
The even-pixel rule changes the answer
The compiler rounds crop sides and offsets down to the nearest even value, because yuv420p needs even dimensions. Whether your crop is exactly 9:16 therefore depends on the pixel size of the source. The fraction is sent with six decimals, so 0.3515625 is written as 0.351563, which is a hair above the exact value. That tiny excess is what keeps an even result from rounding down a step.
| Source | Ideal 9:16 width | Cropped width | Output |
|---|---|---|---|
| 2560x1600 | 900 | 900 | 900x1600, exactly 9:16 |
| 1920x1200 | 675 (odd) | 674 | 674x1200, about 0.15 percent narrow |
| 1680x1050 | 590.6 | 590 | 590x1050 |
| 1440x900 | 506.25 | 506 | 506x900 |
Why the odd widths do not matter much
A 674x1200 strip is off 9:16 by about one pixel in 675. The next step is a scale to the delivery size, and scale=1080:1920 stretches that sliver imperceptibly. For a screen recording with text an exact aspect is rarely needed, but check one frame with video frames at full size before you batch the rest.
The request
Ops run before the graph, so the crop sees the original frame and the scale sees the strip. The source must be 300 seconds or shorter; a longer demo needs a video trim first. A filter encode is $0.02 per job, and POST /v1/video-filter/check validates the same body for free.
{
"video_url": "https://media.sume.com/artifacts/artf_demo/demo.mp4",
"ops": [
{ "op": "crop", "x": 0.324219, "y": 0, "width": 0.351563, "height": 1 }
],
"filtergraph": "scale=1080:1920"
}What the crop throws away
The strip is about 35 percent of the width. A 16:10 desktop usually has its toolbar and content spread across the whole frame, so a centre crop can cut off the sidebar you meant to show. Move x toward 0 for a left-aligned window or toward 1 - width (0.648437) for one on the right, or crop the browser chrome off first, as in the screen recording crop post. A crop never resizes the content, so text that was 14 px high stays 14 px high until the scale step enlarges it.
Sources
Related posts
More in Media tools
- Crop a 2:1 landscape phone recording to 9:16: width 0.28125
A 2:1 (18:9) landscape clip needs width 0.28125 for 9:16: exact at 1920x960 (540x960), 606 px at 2160x1080. The offset, the rounding and the full request.
- Crop a 5:4 monitor clip to 9:16: width 0.45 and the exact sizes
A 5:4 clip crops to 9:16 with width 0.45 and x 0.275. At 1280x1024 that is 576x1024, at 1600x1280 it is 720x1280. Two sizes, one body, and why it is exact.
- Crop a 2:3 Pinterest video to 4:5 for Facebook: height 0.8333
A 1000x1500 Pinterest video becomes 1000x1250 (4:5) with a crop of height 0.8333. Facebook's feed page lists 4:5 at 1440x1800; request inside.
- Crop 21:9 to a 1:1 square: width 0.4286, centered x 0.2857
A 2520x1080 ultrawide clip becomes 1080x1080 with a crop of width 0.4286. TikTok's in-feed page lists 1:1 at a 640x640 minimum. Request and numbers inside.
Written by Sume