curl a 30-second Sume clip: --speed-limit beats a blunt --max-time
A fixed --max-time kills a slow but healthy 30 s video download. Use --speed-limit with --speed-time to abort only stalled transfers, plus --retry.

The problem with one total timer
curl's --max-time is a cap on the whole operation, including the transfer. Set it to 60 and a perfectly healthy download on a slow link dies at second 60, leaving a truncated MP4. Set it to 600 and a connection that stalled at second 3 hangs for ten minutes.
curl has a better tool for downloads: --speed-limit bytes per second together with --speed-time seconds aborts only if the transfer stays below that speed for that long. That is a stall detector, not a stopwatch.
Flags worth knowing (read 2026-10-05)
| Flag | What it bounds |
|---|---|
| --connect-timeout | Time to establish the connection |
| --max-time | The whole operation |
| --speed-limit with --speed-time | A transfer that stays too slow for too long |
| --retry | Retries on transient errors |
| --fail-with-body | Fail on HTTP errors but keep the response body |
Download the finished clip
A job from POST /v1/videos is downloaded with GET /v1/videos/{id}/content?index=0 once it is completed, and the request needs your Authorization header like any other. Set VIDEO_ID and SUME_API_KEY, then:
curl --fail-with-body --location \
--connect-timeout 10 \
--speed-limit 10000 --speed-time 20 \
--retry 3 --retry-delay 2 \
-H "Authorization: Bearer $SUME_API_KEY" \
-o clip.mp4 \
"https://api.sume.com/v1/videos/$VIDEO_ID/content?index=0"After the download
Abort-on-stall plus retry still deserves a size check: compare the bytes on disk to the content-length header you saw, or play the file through ffprobe before you publish it. A job that is not yet completed returns an error body rather than a video; --fail-with-body shows it instead of writing it into clip.mp4 silently.
Pull the file once and keep it in your storage. Do not treat a Sume output URL as a permanent home for the asset.
Sources
Related posts
More in Developers
- Cut a 3-minute Short from a longer render with video trim
YouTube Shorts and Instagram's recommended Reel length both stop at three minutes. Cut 180 seconds from a longer clip with video trim, using start and duration.
- Debug a Sume webhook signature mismatch offline: a diagnosis script
Saved a failing Sume webhook? This Python script tells you if it was a stale timestamp, an empty secret, a mutated body or the wrong secret. Self-test included.
- Dedupe Sume webhooks with SQLite: INSERT OR IGNORE on job_id and event
Sume retries up to 10 times and Redeliver repeats events. A stdlib SQLite table keyed on job_id and event makes your video webhook handler safe to run twice.
- Two model fields: deepseek-flash for your planner, sume-agent for Sume
Your planner config says deepseek-flash. The Sume Agent Completion model field takes only sume-agent. Keep them in separate settings.
Written by Sume