Skip to main content
Live. This area is documented as current, user-reliable behavior.

Goal

Produce repeatable media derivatives whose cache identity includes the canonical definition, source bytes, overlay bytes, and processor revision.

Prerequisites

  • An asset in the same account
  • An assets:process token for transforms
  • A clean, ready source before durable materialization

Workflow

1
Build a version 2 definition with the source media kind, ordered operations, and one output.
2
Store it as a named preset when multiple assets use it; set eager=true to materialize after the clean scan gate.
3
POST the definition or preset to the asset transforms route. Supply exactly one, never both.
4
Poll the returned Assets job until it completes, then list derivatives and use only an available output.

Definition contract and bounds

  • version is exactly 2; media_kind is image or video; operation order is significant.
  • A definition contains 1–24 operations. Output kinds are image, video, audio, or thumbnail.
  • Final images are limited to 4096×4096 and 16,777,216 pixels. DPR is 0.5–4; blur sigma is greater than 0 and at most 100; output quality is 1–100 and defaults to 82 for image/thumbnail outputs.
  • Background is transparent or normalized 6/8-digit hex. Rotation is finite and normalized modulo 360.
  • Video FPS is 1–60. Trim end must exceed start. Trim and thumbnail timestamps are checked against probed source duration during processing.
  • Image formats are JPEG, PNG, WebP, and AVIF; video is MP4; extracted audio is MP3, AAC, or WAV; thumbnails are JPEG, PNG, or WebP.

Timestamp thumbnail example

Presets, eager processing, and v1 compatibility

  • POST /assets/transformations continues to accept the legacy width/height/crop/format/quality fields and signed v1 specs.
  • For v2, send name, definition, and eager. Stored presets expose definition_version, media_kind, normalized definition/spec, eager, and revision.
  • POST /assets/{assetID}/transforms accepts {definition} or {preset} and returns an Assets job. If no idempotency key is supplied, the service derives one from asset ID, source checksum, and normalized spec.
  • For CLI transform-run, the JSON passed to --file is the complete request body: wrap a v2 definition as { "definition": { ... } }, or use { "preset": "name" }.
  • GET /assets/{assetID}/derivatives returns persisted output kind, MIME type, size, transform hash, dependency checksum, processor revision, and availability state.
  • The service invokes libvips/FFmpeg/ffprobe through context-bound argument arrays, strips metadata, normalizes color, and marks output deliverable only after durable persistence and replication.

Expected result

Identical source and transform dependencies collapse onto the same durable output, while any source, overlay, definition, or processor change produces a new identity.

Common failures

  • A request mixes image-only operations such as DPR or radius into a video definition.
  • A thumbnail omits its single timestamp, or an audio output includes an operation other than trim.
  • An overlay is remote, belongs to another account, is not clean and ready, or exceeds the four-overlay limit.
  • The caller treats 202 Accepted as deliverable before the job persists and replicates the output.

Media Workflows visual builder and API

Author editable templates or blank typed DAGs that coordinate asset gates, native StackShift services, bounded Stackie reasoning, and approved external integrations.

Assets REST API reference

The routes, wire fields, response states, and concurrency rules shared by every official Assets SDK.

Video, scanning, and governance

Process video asynchronously, deliver HLS and posters, expose scan gates, quarantine unsafe assets, and enforce account policies.