Install a recent version of ffmpeg with HLS and H.264/AAC support.
Run ffmpeg with your input file, specifying the output format as hls (-f hls), and configure the segment duration with -hls_time (commonly 6 seconds).
Set -hls_playlist_type to vod for on-demand content or omit it for live.
Specify the output path for the .m3u8 playlist file; ffmpeg will generate segment files (typically .ts) in the same directory with an auto-incremented naming pattern unless you override it with -hls_segment_filename.
For adaptive bitrate (ABR) delivery, run multiple ffmpeg passes at different resolutions and bitrates, then create a master playlist (.m3u8) that references each variant stream using the EXT-X-STREAM-INF tag.
Serve the playlist and segment files from a web server or CDN with correct MIME types (application/vnd.apple.mpegurl for .m3u8, video/MP2T for .ts) and appropriate CORS headers.
Known gotchas
Segment files must be accessible at URLs relative to the playlist location; mismatched relative paths break playback in HLS clients.
For live streams, set -hls_list_size to control how many segments remain in the playlist; setting it to 0 retains all segments (suitable for VOD-style live recordings).
CORS headers are required when the player origin differs from the segment server origin; missing CORS headers cause playback failure in browser-based players.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp