Skip to main content

Crate ff_stream

Crate ff_stream 

Source
Expand description

§ff-stream

HLS and DASH adaptive streaming output - the Rust way.

This crate provides segmented HLS and DASH output along with ABR (Adaptive Bitrate) ladder generation. It exposes a safe, ergonomic Builder API and completely hides FFmpeg muxer internals.

§Features

  • HLS Output: Segmented HLS with configurable segment duration and keyframe interval
  • DASH Output: Segmented DASH with configurable segment duration
  • ABR Ladder: Multi-rendition HLS / DASH from a single input in one call
  • Builder Pattern: Consuming builders with validation in build()

§Usage

§HLS Output

use ff_stream::HlsOutput;
use std::time::Duration;

HlsOutput::new("/var/www/hls")
    .input("source.mp4")
    .segment_duration(Duration::from_secs(6))
    .keyframe_interval(48)
    .build()?
    .write()?;

§DASH Output

use ff_stream::DashOutput;
use std::time::Duration;

DashOutput::new("/var/www/dash")
    .input("source.mp4")
    .segment_duration(Duration::from_secs(4))
    .build()?
    .write()?;

§ABR Ladder

use ff_stream::{AbrLadder, Rendition};

AbrLadder::new("source.mp4")
    .add_rendition(Rendition { width: 1920, height: 1080, bitrate: 6_000_000 })
    .add_rendition(Rendition { width: 1280, height:  720, bitrate: 3_000_000 })
    .add_rendition(Rendition { width:  854, height:  480, bitrate: 1_500_000 })
    .hls("/var/www/hls")?;

§Module Structure

§Status

The public API is stable. HLS and DASH muxing are fully implemented via the FFmpeg HLS/DASH muxers. write() / hls() / dash() perform real encode-and-mux operations against the filesystem.

Re-exports§

pub use abr::AbrLadder;
pub use abr::Rendition;
pub use dash::DashOutput;
pub use error::StreamError;
pub use hls::HlsOutput;

Modules§

abr
Adaptive bitrate (ABR) ladder for multi-rendition HLS / DASH output.
dash
DASH segmented output builder.
error
Unified error type for the ff-stream crate. Error types for streaming operations.
hls
HLS segmented output builder.