Video trim end past the clip: trim_clamped_to_source and a short ad
If end is beyond the source, Sume video-trim clamps it and warns trim_clamped_to_source. Ask for 0-20 s of a 15 s clip and you get 15 s, which can break a spot.

If end is after the end of the source, Sume video trim does not fail. It clamps the range to the source and puts the warning trim_clamped_to_source in the result. So a request for start: 0, end: 20 on a 15-second clip returns a 15-second MP4 as a successful job, and a script that only checks for errors would pass it on. If your target is a 20-second spot, read duration_seconds in the result.
What the API does with a range
Video trim 1.0 takes one Sume-hosted clip and exactly one of end or duration. The output is a new MP4 and costs $0.02 a job. The limits from the docs (read 2026-10-08) are below.
| Case | Result |
|---|---|
start: 0, end: 20 on a 15 s source | Clamped to 15 s; warning trim_clamped_to_source |
end and duration both sent | Refused: video_trim_range_conflict |
Neither end nor duration | Refused: video_trim_range_required |
end <= start, or range longer than 900 s | Refused: video_trim_range_empty |
duration below 0.2 s | Outside the 0.2-900 s duration range |
| Source longer than 1,800 s | Refused by the worker: source_duration_exceeded |
Why it matters for ad specs
Platform specs have both a floor and a ceiling. The TikTok page (read 2026-10-08) allows up to 10 minutes for non-Spark ads, and it sets 540x960 and 516 kbps as minimums. The page facts used here give no minimum length, but a creative brief often does. A clamp silently turns a 20-second brief into a 15-second file. The fix is a check in your code, and it is two lines: compare duration_seconds with what you asked for, and compare the list of warnings.
import math
def trim_ok(result: dict, asked_seconds: float) -> bool:
warned = any("trim_clamped_to_source" in str(w) for w in result.get("warnings", []))
return not warned and math.isclose(
result["duration_seconds"], asked_seconds, abs_tol=0.1
)
print(trim_ok({"duration_seconds": 15.0, "warnings": [{"code": "trim_clamped_to_source"}]}, 20))
print(trim_ok({"duration_seconds": 20.0}, 20))Reading the result
A finished trim returns kind: video_trim with video_url, duration_seconds, actual_start_seconds, precision, audio, output and the optional warnings[]. Three fields tell you whether the file is the one you asked for. duration_seconds is the real length. actual_start_seconds is the real in-point, which can differ from start under precision: keyframe. warnings[] lists soft problems such as the clamp. A job that carries a warning is still a finished job, billed at $0.02, so a retry costs another $0.02. Fix the request before you retry, or you will pay twice for the same short file.
- Asked 20 s, got 15 s: the source was 15 s. Check the clip, not the API.
- Asked 20 s from
start: 10, source 15 s: the cut is 5 s long, so the clamp is larger than it looks. - The check costs nothing: a probe with
frames: falsereads the duration first.
Use `duration` when you want a length
With duration you state the length you want, and with end you state a point in the source. For a fixed-length cutdown, duration reads more clearly. Combine it with video_inspect first if you do not know the source length: a probe with frames: false is enough, and it gives the duration before you pay the $0.02. The warnings[] field is optional, so treat a missing field as no warnings.
Sources
Related posts
More in Developers
- Video upscale hold: omit duration_seconds and Sume reserves 5 s
Sume video upscale reserves from duration_seconds, or 5 seconds when you omit it. Hold table for 5, 15 and 30 seconds at $0.009 per second and the 402 case.
- Vidu Q4 or LTX on Sume? Check the video model list first
Sume does not list Vidu or LTX in its video catalog as of 2026-10-08. Query GET /v1/videos/models and filter by id; a short script and the 12 ids it returns.
- Vidu Q4 Preview result URLs last 24 hours: save the file the same day
Vidu says Q4 Preview output URLs stay valid for 24 hours. Copy the file the day you render it, and see what Sume documents about its job result URL.
- Vidu Q4 Preview has a seed field; Sume video models reject seed
Vidu Q4 Preview image-to-video takes a custom seed. Sume video models report seed false and return 400 unsupported_parameter if you send one.
Written by Sume