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 is not free: a $0.0899 Modal hold, then actual seconds
video_inspect now holds a $0.0899 Modal ceiling and captures its own container seconds at Modal list x 1.25 plus the 5.5% fee. Transcripts add $0.01 a minute.
- 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.
- Video trim limits on Sume: 1800 s source, 900 s output, error codes
Video trim takes a source up to 1800 seconds and cuts at most 900 seconds, at least 0.2. Here are the limits, the clamp warning and the stable error codes.
Written by Sume