Check an ad clip's aspect ratio with Sume video inspect stills
Sume video inspect returns stills with width and height. Send max_edge at the source edge, read the ratio, and catch a wrong-ratio clip before upload.

Sume video inspect returns frames[{t,url,width,height}] for a clip, so one still gives you the clip's shape. Divide width by height, compare to the ratio the ad platform wants, and reject a mismatch before you upload. Send frames as { "at": [0], "max_edge": 2160 } so the still is as large as the source allows.
What inspect takes and returns
| Item | Value |
|---|---|
| Route | POST /v1/video-inspect |
| Source | A media.sume.com clip the workspace owns |
| Default mode | sync, a 30-second wait, 202 if slower |
| Source length limit | 1800 seconds |
max_edge | 64 to 2160, default 768 |
| Stills per call | Up to 24 |
Read the ratio from one still
Import the clip first with POST /v1/media-imports. Inspect then needs an Idempotency-Key. A slow job returns 202, which this script treats as a stop; read the finished job via the jobs endpoints.
import os, uuid, requests
API = "https://api.sume.com"
H = {"Authorization": f"Bearer {os.environ['SUME_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4())}
body = {"video_url": os.environ["SUME_VIDEO_URL"],
"frames": {"at": [0], "max_edge": 2160}}
r = requests.post(f"{API}/v1/video-inspect", headers=H, json=body, timeout=60)
r.raise_for_status()
if r.status_code == 202:
raise SystemExit("inspect still running")
still = r.json()["video_inspect"]["frames"][0]
ratio = still["width"] / still["height"]
want = 9 / 16
print(round(ratio, 3), "ok" if abs(ratio - want) / want < 0.01 else "wrong ratio")Notes
- The 1% tolerance in the script is a choice of mine, not a platform rule; use the tolerance your platform's page states.
- Probe fields beyond
has_audioare not described in the docs page, so this method relies on the stills.
Sources
Related posts
More in Media tools
- Video inspect hdr flag: spot PQ or HLG clips before you submit
Sume video inspect returns probe.hdr, color_transfer and pix_fmt. Read them first and route HDR clips away from the video filter and exact trim.
- Video inspect 400 video_inspect_transcribe_required: the fix
Sending language_code, segmentation or duration_seconds to Sume video inspect without transcribe true returns a 400. Why, and the request that works.
- Which field holds the file URL in a Sume media job result
Sume media jobs return different result keys: audio_url for detach, video_url for trim and filter, frames for stills. A field map for no-code steps.
- Which Sume media step caps your clip: 1800, 900 or 300 s
Trim takes a 1800 s source, video filter and video frames stop at 300 s, compose at 300 s, Timeline at 1800 s. One table of every length cap.
Written by Sume