s4m_media_packager/lib.rs
1//! Media Packager Library
2//!
3//! A trait-based library for fragmenting and packaging multi-resolution MP4 files
4//! into DASH/HLS formats using FFmpeg and Bento4.
5//!
6//! # Features
7//!
8//! - Parallel demuxing with FFmpeg
9//! - Parallel fragmentation with Bento4 (mp4fragment)
10//! - DASH/HLS packaging with Bento4 (mp4dash)
11//! - Configurable naming templates
12//! - Automatic temporary file management
13//! - One-time runtime binary checks with helpful error messages
14//! - Comprehensive tracing and logging
15//!
16//! # Example
17//!
18//! ```rust,no_run
19//! use std::path::PathBuf;
20//!
21//! use s4m_media_packager::{LogConfig, MediaPipeline, MediaPipelineConfig, init_tracing};
22//!
23//! #[tokio::main]
24//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
25//! // Initialize tracing
26//! init_tracing(LogConfig::development())?;
27//!
28//! let pipeline = MediaPipeline::new()?;
29//! let inputs = vec![
30//! PathBuf::from("video_270p.mp4"),
31//! PathBuf::from("video_720p.mp4"),
32//! ];
33//! let config = MediaPipelineConfig::default();
34//! let output_dir = PathBuf::from("./output");
35//!
36//! let result = pipeline.execute(inputs, config, output_dir).await?;
37//! println!("Packaged to: {:?}", result.output_dir);
38//! Ok(())
39//! }
40//! ```
41mod bento4;
42// pub mod command;
43mod config;
44pub mod error;
45mod ffmpeg;
46mod pipeline;
47mod runtime;
48mod tracing_config;
49
50//TODO: Dev and test Command module that cerate custom command configurations for
51// packaging and fragmenting
52// mod command;
53// pub use command::{Bento4CommandBuilder, CommandConfig, FfmpegCommandBuilder, TemplateEngine};
54pub use config::MediaPipelineConfig;
55pub use error::{MediaPackagerError, Result};
56pub use pipeline::{MediaPipeline, PackageResult};
57pub use tracing_config::{LogConfig, init_tracing, init_tracing_from_env};