Dry-run a Sume video crop with video-filter check before a batch
POST /v1/video-filter/check validates a crop program without a job, credits or an encode. Run it first, then crop a batch of ad clips for new ratios.

Before you crop a folder of ad clips, call POST /v1/video-filter/check. According to Sume's video filter docs, it runs the same schema, op and source checks as the encode, returns diagnostics, and does not create a job, reserve credits, boot a box or run the encoder. A program that passes can still fail on the box, so keep your error handling on the real encode.
Crop op rules
| Field | Rule |
|---|---|
x, y | 0 to 1, fractions of the source frame |
width, height | 0.05 to 1 |
| Bounds | x+width and y+height must be at most 1 |
| Rounding | Even values for yuv420p |
| Error code | video_filter_crop_out_of_bounds |
Check a 16:9 to 4:5 center crop
A 16:9 source cropped to 4:5 keeps (4/5)/(16/9) = 0.45 of the width and all the height. The offset that centers it is 0.275. The check call needs the source on media.sume.com.
import os, requests
API = "https://api.sume.com"
H = {"Authorization": f"Bearer {os.environ['SUME_API_KEY']}"}
width = (4 / 5) / (16 / 9)
body = {"video_url": os.environ["SUME_VIDEO_URL"],
"ops": [{"op": "crop", "x": round((1 - width) / 2, 4), "y": 0,
"width": round(width, 4), "height": 1}]}
r = requests.post(f"{API}/v1/video-filter/check", headers=H, json=body, timeout=30)
r.raise_for_status()
res = r.json()
print(res.get("valid"), res.get("next_action"), res.get("diagnostics"))Then encode
When next_action is submit_video_filter, send the same body to POST /v1/video-filter with an Idempotency-Key, and read the result through the jobs endpoints.
Sources
Related posts
More in Media tools
- Video filter hdr_source_unsupported: what to do with an HDR clip
A Sume video filter job fails with hdr_source_unsupported on PQ or HLG clips. Why the filter refuses them, and three ways to get a usable result.
- video_filter_ops_empty 400: run video-filter/check before paying $0.02
video_filter_ops_empty means no ops[] and no filtergraph. Send one dim or crop op, or a filtergraph, and call the free /v1/video-filter/check first.
- Video filter unsupported_pixel_format: why a non-YUV source fails
Sume video filter only accepts sources with a YUV pixel format. What unsupported_pixel_format means, how to spot it with video inspect, and how to fix it.
- Video frames always returns 202: mode sync does not give a 200
Sume video frames pins async, so a submit returns 202 even with mode sync. How it differs from video inspect, which waits up to 30 s, and how to poll.
Written by Sume