Trim a video without re-encoding: precision keyframe in the Sume API

Sume's video trim with precision keyframe stream-copies the cut, with no re-encode. It can start a GOP early, so read actual_start_seconds in the result.

4 min readSume
All posts

To trim a video without re-encoding with Sume's API, send POST /v1/video-trim with precision: "keyframe". That is a stream copy: the video is not re-encoded, so it is not frame-accurate, and the cut may start a GOP (a group of pictures) early. The result's actual_start_seconds tells you where the file really begins.

The fields are from the Sume docs page Video trim, read 2026-09-29.

What is the difference between exact and keyframe?

exact is the default. It is a frame-accurate re-encode with libx264 and yuv420p. keyframe copies the streams as they are, so the start snaps to the picture the copy can begin on. The trade is an in-point that may sit a little before the one you asked for.

Trim precision values and their limits, from the Video trim docs, read 2026-09-29.
`precision`How it cuts`output` conform
exact (default)Frame-accurate re-encodeAllowed: width and height 256 to 2160, fps 24, 25, 30 or 60
keyframeStream copy; the start may be a GOP earlyRefused with video_trim_output_requires_exact

What does the request look like?

Everything else is the same as an exact trim: start, and exactly one of end or duration, plus an Idempotency-Key.

curl -X POST https://api.sume.com/v1/video-trim \
  -H "Authorization: Bearer $SUME_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: trim-keyframe-001" \
  -d '{
    "video_url": "https://media.sume.com/artifacts/artf_demo/talk.mp4",
    "start": 12,
    "duration": 20,
    "precision": "keyframe"
  }'

How do I read where the cut really starts?

Poll GET /v1/jobs/:id/status until the job is terminal, then read GET /v1/jobs/:id/result. It is kind: video_trim with video_url, duration_seconds, actual_start_seconds, precision and audio. The docs tell you to re-base against actual_start_seconds: if you asked for 12 and the copy began at 10.4, the moment you wanted is 1.6 seconds into the new file, not at the start.

The new file is a new artifact, never the source. The docs say to drop that MP4 into a Timeline video[] slot with source_in at 0; a Timeline render takes its sound from the audio spine you give it, not from the clip.

How long a piece can I cut?

The cut, end minus start or duration, must be at least 0.2 seconds and at most 900. A range longer than 900 seconds, or an end at or before start, fails video_trim_range_empty. Source video can be up to 1800 seconds, so a longer stretch needs more than one cut. An end past the end of the source does not fail: it clamps and the result warns trim_clamped_to_source.

When should I pick exact instead?

Pick exact when the in-point must land on the frame you named, or when you want to resize or change the frame rate with output, because keyframe refuses that. Both modes let you choose audio: keep by default or drop.

Sources

Related posts

More in Media tools

All Media tools posts

Written by Sume