Resize a clip while trimming: output needs precision exact

Sume video trim takes output {width, height, fps} only with precision exact, the default. With keyframe you get video_trim_output_requires_exact. $0.02 a job.

5 min readSume
All posts

Yes, Sume video trim can resize and change the frame rate in the same job as the cut, but only with precision: exact, which is the default. Send output with width, height and fps, and the exact re-encode conforms the clip. If you ask for precision: keyframe and output together, the request is refused with video_trim_output_requires_exact.

The reason is in how the modes work, described in the video trim docs: keyframe is a stream copy, so there is nothing to scale, while exact re-encodes with libx264 in yuv420p. One job costs $0.02 either way, per the catalog.

The output block

output is { width, height, fps }. If you leave it out, the output keeps the source values.

video-trim output conform limits, from docs.sume.com/models/video-trim, read 2026-10-09
FieldAcceptsNote
width256 to 2160Pixels
height256 to 2160Pixels
fps24, 25, 30 or 60Other rates are refused
precisionexact (default) or keyframeoutput works with exact only
audiokeep (default) or dropExact remuxes kept audio as AAC

A 9:16 example

To cut seconds 12 to 27 of a master and deliver a 720x1280 clip at 30 fps, send one job. The range is 15 seconds, within the 0.2 to 900 second output limit, and the source must be 1800 seconds or shorter. A separate rescale job would add a second fee, so combining them costs $0.02 instead of two jobs.

Pick sizes that match the aspect ratio of the source or accept that the content will be conformed to the box you name; check one output before a batch.

{
  "video_url": "https://media.sume.com/artifacts/artf_demo/master.mp4",
  "start": 12,
  "end": 27,
  "precision": "exact",
  "output": { "width": 720, "height": 1280, "fps": 30 },
  "audio": "keep"
}

When keyframe is still the right choice

Keyframe is for quick, lossless cuts where the exact start does not matter. The cut can begin a GOP early, so re-base your times with actual_start_seconds from the result. If you later find you need a new size, run a second exact trim, or use video filter for a crop.

  • Cut and conform together: exact, with output.
  • Cut only, fast: keyframe, no output.
  • A trim past the end of the source is clamped and warns trim_clamped_to_source.
  • Import the file first; the source must already be on your workspace's media host.

Checking the result

The result returns the new MP4 as a durable artifact plus duration_seconds, actual_start_seconds, precision, audio and output, and optional warnings[]. Compare the returned values with what you asked for. If the output is the wrong shape, you have not lost the source: the original is never changed, and a second trim costs another $0.02.

For a batch of 50 clips that all need 720x1280 at 30 fps, the cost is 50 x $0.02 = $1.00, and each job needs its own idempotency key.

Choosing sizes

The width and height range of 256 to 2160 covers the common delivery sizes: 720x1280 for vertical social, 1080x1920 for full-height vertical, and 1280x720 or 1920x1080 for landscape. The upper bound of 2160 applies to each side separately, so a 3840-wide landscape frame is outside it. For a larger output, use video upscale, which takes a public HTTPS URL and a factor from 1.1 to 4 at $0.009 per video second.

One more option: the default frame rate keeps the source value. Set fps only when the destination needs a fixed rate, since a conform to 24, 25, 30 or 60 re-times the clip.

Sources

Related posts

More in Media tools

All Media tools posts

Written by Sume