Agent Wranglers

MED-13Recommended

Transcode every video into an adaptive stream

Transcode every uploaded video in a background job into an HLS or DASH stream with three or more renditions, and play that stream. Never play the uploaded original.

How to do it

A video straight from a phone is large and uses whatever codec the phone chose. An adaptive stream splits each rendition into short segments, so the player switches quality as the connection changes. HLS is described in RFC 8216, and DASH is ISO/IEC 23009-1. Write fragmented MP4 segments, so one set of files can serve both. Apple's HLS authoring specification sets a target segment length of 6 seconds and a keyframe every 2 seconds. It asks for some H.264 renditions for older devices, and an I-frame playlist for scrubbing. Its example ladder starts at 416 by 234 pixels and 145 kbit/s. Keep the original private, so you can encode it again when codecs change. Mark the video ready only when every rendition exists. Run the job in the sandbox from Run media tools in a sandbox with no network. Short clips may play as plain MP4 instead, as Send video that starts fast and costs little says.

How to check

Upload a 1080p test video. The job writes a multivariant playlist with three or more renditions, and no segment is longer than 6.5 seconds. A request for the original without a signature answers 403.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/files-and-media/video-and-audio/adaptive-streaming">Agent Wranglers files and media playbook</a>. In code you write, add a comment next to it with the same link.