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.

5 min readSume
All posts

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

Facts from Sume's video inspect docs (read 2026-10-05)
ItemValue
RoutePOST /v1/video-inspect
SourceA media.sume.com clip the workspace owns
Default modesync, a 30-second wait, 202 if slower
Source length limit1800 seconds
max_edge64 to 2160, default 768
Stills per callUp 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_audio are not described in the docs page, so this method relies on the stills.

Sources

Related posts

More in Media tools

All Media tools posts

Written by Sume