sheathe
Pure-Rust HLS / DASH / CMAF media packager. A memory-safe, dependency-light alternative to Shaka Packager, built and validated against it as the reference oracle.
📖 Read the story: Packaging the World's Video in Pure Rust
Status: Phases 0–5 complete — VOD + live/advanced manifests + on-demand single-file DASH, CMAF/TS/packed-audio segments, encryption, broad inputs, HTTP push, UDP ingest, and a JIT origin.
probe/package/origindemux MP4, MPEG-TS, WebM/Matroska, and elementary streams; write DASH/HLS with correct codec strings. Video: H.264, H.265, AV1, VP8/VP9. Audio: AAC, AC-3, E-AC-3, MP3, FLAC, Opus. Text: WebVTT + CEA-608/708. CENC matrix + multi-DRMpssh. SeeROADMAP.mdanddocs/CONFORMANCE.md.
Why
Mature DASH/HLS manifest parsers exist in Rust, but a mature packager /
origin does not. sheathe fills the Delivery lane: probe → ladder → CMAF
segment → DASH/HLS manifests, with no C/C++ dependencies.
Workspace layout
| Crate | Role | Shaka Packager analogue |
|---|---|---|
sheathe-core |
Media model: streams, samples, timing, errors | media/base |
sheathe-mp4 |
ISO-BMFF / fMP4 / CMAF box writing + fragmentation | media/formats/mp4 + chunking |
sheathe-ts |
MPEG-2 TS demux + mux (PAT/PMT/PES) + audio parsers (AAC/AC-3/E-AC-3/MP3/FLAC) | media/formats/mpeg |
sheathe-es |
Raw elementary stream demux (Annex B, ADTS, AC-3/E-AC-3, MP3, FLAC) | media/formats |
sheathe-mkv |
WebM/Matroska (EBML) demux — VP8/VP9/AV1 + Opus | media/formats/webm |
sheathe-text |
Timed text: WebVTT input + CEA-608 caption extraction → wvtt |
media/formats/webvtt |
sheathe-dash |
MPEG-DASH .mpd generation |
mpd |
sheathe-hls |
HLS master + media playlist generation | hls |
sheathe-crypto |
Common Encryption (cenc / cbcs) | media/crypto |
sheathe / sheathe-cli |
The sheathe binary / its CLI library |
app (packager) |
Install / build
# or, from a checkout:
Commands
| Command | Description |
|---|---|
sheathe package |
Demux → fragment → CMAF/TS/packed-audio segments + DASH/HLS |
sheathe probe |
List streams sheathe detects (no packaging) |
sheathe origin |
JIT HTTP origin — package on GET /package?input=… |
Full flag reference, recipes, and output layouts: docs/CLI.md
Quick start
# VOD: CMAF segments + DASH + HLS
# Inspect streams
# ABR ladder (each file = one rendition)
# Live-style window from a finished mezzanine
# Encrypted (cenc) multi-DRM
# On-demand single-file DASH
# MPEG-TS HLS
# Trick-play + low-latency + SCTE-35 ad markers
# JIT origin (package on request)
# curl 'http://127.0.0.1:8787/package?input=clip.mp4&format=hls'
package flag groups (summary)
| Group | Flags |
|---|---|
| Core | -o/--out, --segment-duration, --dash, --hls |
| Format | --format cmaf|ts|packed-audio, --on-demand, --parallel, --http-push |
| Presentation | --presentation vod|event|live, --live-window, --multi-period |
| Advanced | --trick-play, --low-latency, --part-duration, --scte35, --availability-start-time |
| Encryption | --enc-key, --enc-key-file, --enc-scheme, --enc-key-uri, --protection-systems, --crypto-period-duration |
See docs/CLI.md for defaults, output directory layout, and every recipe (ABR, multi-period, DRM, LL-HLS, origin, push, oracle).
Developer tasks (just)
Documentation map
| Doc | Contents |
|---|---|
| docs/CLI.md | Command reference — all subcommands, flags, recipes |
| docs/CONFORMANCE.md | Oracle gates, DASH-IF / mediastreamvalidator, fuzz |
| ROADMAP.md | Phase status (0–5 complete) |
| CHANGELOG.md | Release notes |
| CONTRIBUTING.md | Dev workflow, hooks, style |
Method
Per the workspace's revelo method: implement in pure Rust, then
differential-test output (segments, MPD, playlists) against Shaka Packager on a
sample corpus. Numbers and bitstreams that can't be validated against the oracle
don't ship.
MSRV
Rust 1.85 (declared in Cargo.toml's workspace.package.rust-version). CI
reads that exact value and builds against it, so the MSRV can't drift.
License
MIT OR Apache-2.0.