Skip to main content

Module packager

Module packager 

Source
Available on crate feature hls only.
Expand description

Egress packaging: turn a live frame stream into HLS/LL-HLS segments.

Gated behind hls. Provides the Muxer and Packager contracts, a sliding-window HlsPlaylist generator, and an HlsSegmenter that cuts segments on keyframe boundaries and writes both media segments and the .m3u8 playlist through any StorageBackend.

The container byte-format is pluggable via Muxer: a PassthroughMuxer (elementary-stream concatenation) ships here; production MPEG-TS or fMP4/CMAF muxers implement the same trait and drop in unchanged.

use arcly_stream::packager::{HlsSegmenter, Packager, PassthroughMuxer};
use arcly_stream::storage::FsStorage;

let storage = FsStorage::new("/var/hls");
let mut seg = HlsSegmenter::new(PassthroughMuxer::new("ts"), storage, "live/cam", 6, 5);
let mut sub = handle.subscribe_resilient();
while let Some(frame) = sub.recv().await {
    seg.push(&frame).await?;
}
seg.finish().await?;

Structs§

Fmp4Muxerfmp4
Native fragmented-MP4 muxer for a single video track.
HlsPlaylist
A sliding-window HLS media playlist.
HlsSegmenter
Keyframe-boundary HLS segmenter writing through a StorageBackend.
MpegTsMuxermpegts
Native MPEG-TS muxer: packages H.264 or H.265 video + AAC audio elementary streams into a single-program transport stream.
PassthroughMuxer
A trivial muxer that concatenates frame payloads (elementary stream).
Segment
One segment entry in a media playlist.

Traits§

Muxer
Container muxer: accumulates frames into one segment’s bytes.
Packager
Consumes a live frame stream and produces a packaged rendition.