Check ad video length for Pinterest, LinkedIn and Google in Python
A short Python check of a video-inspect probe against Pinterest, LinkedIn and Google Video action length limits read on 2026-10-08, before you upload an ad.

Read duration_seconds from a Sume video-inspect probe and compare it with a small table: Pinterest 4 seconds to 15 minutes, LinkedIn video ads 3 seconds to 30 minutes, Google Video action campaigns at least 10 seconds. The script below does that in plain Python with no network call, so you can test it on a saved probe before wiring it to the API.
The limits
All four numbers come from each platform's own page, read on 2026-10-08. Google's page gives only a minimum, so its maximum is left open.
| Platform | Minimum seconds | Maximum seconds |
|---|---|---|
| Pinterest video ad | 4 | 900 |
| LinkedIn video ad | 3 | 1800 |
| Google Video action | 10 | No maximum on the page |
The script
Paste the duration_seconds value from your probe into PROBE. The check returns a short sentence per platform.
LIMITS = {
"pinterest": (4, 900),
"linkedin": (3, 1800),
"google_action": (10, None),
}
PROBE = {"duration_seconds": 8.4}
def verdict(name, lo, hi, d):
if d < lo:
return f"{name}: too short ({d}s < {lo}s)"
if hi is not None and d > hi:
return f"{name}: too long ({d}s > {hi}s)"
return f"{name}: ok"
def main():
d = PROBE["duration_seconds"]
for name, (lo, hi) in LIMITS.items():
print(verdict(name, lo, hi, d))
main()Getting a real probe
Import the clip with POST /v1/media-imports, then call POST /v1/video-inspect with frames: false. By default the call waits up to 30 seconds and returns the probe; if it takes longer, poll /v1/jobs/:id/status and read /v1/jobs/:id/result. The probe also carries width, height, fps, size_bytes and has_audio, which you can add to the table as the next checks.
With the sample value 8.4, the script reports Pinterest and LinkedIn as ok and Google Video action as too short. Fix that with a trim or a Timeline render of at least 10 seconds, then probe the new file again.
Reading the verdicts
The script is deliberately small. It does not fetch anything, so you can run it in CI against a stored probe, and it keeps the limits in one dictionary so a change on a platform page is a one-line edit. Reread each vendor page when you edit it, because specification pages change without notice, and update the read date in your own notes.
Length is only the first gate. The same probe carries width, height, fps, size_bytes and has_audio, so extend LIMITS with a second dictionary per field when you need it. Keep each platform's rules separate: LinkedIn video ads, for example, have a different length ceiling from LinkedIn Page video, and the comparison post in this batch lists both.
If a clip fails on length, the repair is a video trim at $0.02 per job, or a Timeline render at $0.10 per output minute when you need to join clips or add sound. Probe the result again before upload, since a trim that clamps to the source can still land under the minimum and report trim_clamped_to_source in its warnings.
Sources
Related posts
More in Developers
- Check Sume webhook signatures in Python with hmac.compare_digest
A Python verifier for the sume-v1 header: raw bytes, constant-time compare, 300 s replay window, empty-secret refusal, and a Flask route that dedupes on job_id.
- Claude per-message effort: drop to low while a Sume job runs
Claude's per-message effort beta keeps the prompt cache when you change effort mid-conversation. How to use it around Sume jobs, and its Haiku 5.5 limit.
- Claude tool search limits: 200-char regex, 500-char BM25, 5 results
Claude's tool search tool has fixed limits on pattern length, results and deferred tools. What they mean for a Sume hosted MCP tool list.
- Cloudflare Queue consumer 15 min wall time: poll a Sume job
A Queue consumer on Cloudflare can run 15 minutes of wall time, but a Sume job can wait longer. Re-enqueue with a delay and honor next_poll_after_seconds.
Written by Sume