Skip to main content

Generate a remuxed MP4 clip from an archived stream

GET 

/program/api/v2/archive/mp4-clip

Produces a single MP4 file by remuxing (not transcoding) the archived HLS segments that fall within the requested time range into an MP4 container. Source is assumed to be H.264 video + AAC audio; the clip is written with the +faststart flag so the moov atom precedes the mdat box for progressive playback. The program service looks up the project's archiving-config in vault and delegates clip generation to the foundation-mediaassets service. Always writes to S3 and always returns metadata — there is no body-response mode, and output_path is required. Max clip duration is enforced server-side (default 3 minutes). Requests whose end_datetime - start_datetime exceeds the cap are rejected with 400 before any S3 lookup. Clip boundary precision: because this is a pure remux (no transcode), the start of the produced MP4 snaps back to the nearest keyframe at-or-before the requested start_datetime. With the typical 2-second keyframe interval in our archives this adds up to ~2 seconds of leading content (head-padding) before the requested start. The end is frame-accurate at the requested end_datetime. Net effect: the actual MP4 may be up to one keyframe interval longer than end_datetime - start_datetime; the extra is at the head, never at the tail. The actual produced duration is returned in mp4.durationSeconds; callers that need exact-frame starts should consume the metadata and skip the head-padding client-side.

Generate JWT

Request

Responses

MP4 clip generated successfully. Returns ArchiveAssetMetadata describing the S3 write, with MP4-specific fields under the mp4 sub-object.

Bad request — missing/invalid params, duration exceeds the configured cap, or output_path not provided.

Forbidden - No project access

Archiving config not found, or no archive sessions for the stream key + range

Internal Server Error