Skip to main content

Crate mp4forge

Crate mp4forge 

Source
Expand description

MP4 and ISOBMFF toolkit with low-level building blocks and thin ergonomic helpers.

The default surface is synchronous. Enable the optional async feature when you want the additive Tokio-based library companions for seekable readers and writers. That async surface is intended for supported seekable Tokio I/O such as tokio::fs::File and seekable in-memory cursors, and it supports normal multithreaded tokio::spawn use for independent-file library work. The CLI remains on the synchronous path.

Enable the optional decrypt feature when you want the additive decryption input and progress types plus the feature-gated decryption surface. That landed surface covers the Common Encryption family, PIFF compatibility, OMA DCF, Marlin IPMP, and the retained IAEC protected-movie path while keeping the CLI on the synchronous path. Enable both decrypt and async when you want the additive file-backed async decrypt companions on top of the existing synchronous in-memory decrypt helpers.

Enable the optional mux feature when you want the additive mux task surface plus the retained low-level helpers underneath it. The mux surface exposes track-based MuxRequest helpers for sync and async real MP4 assembly, path-first repeated track-spec parsing aligned with the sync-only CLI, internal chunk and duration coordination on top of one mux event graph, retained low-level staged payload-copy helpers, the public mp4forge::mux::sample_reader module built on staged mux plans, the public mp4forge::mux::inspect module for path-first direct-ingest inspection and export plus additive packet-focused reports, and the public mp4forge::mux::rewrite module for rewriting extracted AVC/HEVC/VVC sample payloads back into Annex B plus additive AV1, AAC ADTS, and MHAS elementary export helpers. Those sample-reader helpers can also expose stable text or subtitle track identity when you construct them with companion MuxTrackConfig values. The current path-first mux surface accepts one repeated input path with optional selector suffixes such as #video, #audio, #text, or #track:ID. Path-only MP4 inputs import every supported track from that source, while the landed path-only raw auto-detection currently covers MP4, supported AVI audio streams plus H.263/JPEG/PNG/MPEG-4 Part 2/H.264/AVC1 video streams, supported MPEG-PS MPEG audio streams plus MPEG-4 Part 2/H.264/H.265/VVC video streams, supported MPEG-TS MPEG audio streams plus AAC LATM/MHAS plus AC-3/E-AC-3/AC-4/DTS/TrueHD audio plus MPEG-2/AV1/AVS3/MPEG-4 Part 2/H.264/H.265/VVC video streams, AAC ADTS, AAC LATM, MP3, AC-3, E-AC-3, AC-4, AMR, AMR-WB, QCP voice audio, DTS core audio, Dolby TrueHD, leading-sync MHAS MPEG-H, IAMF, H.263 elementary video, MPEG-2 elementary video, MPEG-4 Part 2 elementary video, H.264 Annex B, H.265 Annex B, VVC Annex B, raw AV1 OBU, raw AV1 Annex B, IVF-backed AV1, IVF-backed VP8, IVF-backed VP9, IVF-backed VP10, JPEG still images, WAVE/AIFF/AIFC PCM, native FLAC, Ogg-backed FLAC, Ogg-backed Opus, Ogg-backed Vorbis, Ogg-backed Speex, Ogg-backed Theora, and CAF-backed ALAC. Broader DTS-family sample-entry variants remain supported through MP4 track import, and broader truthful demux-backed input paths continue to land behind that same public shape.

Re-exports§

pub use fourcc::FourCc;
pub use header::BoxInfo;
pub use header::HeaderError;
pub use header::HeaderForm;
pub use header::LARGE_HEADER_SIZE;
pub use header::SMALL_HEADER_SIZE;

Modules§

async_ioasync
Tokio-based async I/O traits for the additive library-side async surface. Tokio-based async I/O traits for the library-side async surface.
bitio
Bit-level reader and writer helpers used by the codec layer. Bit-level reader and writer helpers used by the descriptor codec.
boxes
Box definitions and registry helpers. Box definitions and box-specific codecs.
cli
Command-line routing and reusable command formatters. Reusable command-line routing and formatters.
codec
Descriptor-driven binary codec primitives. Descriptor-driven binary codec support for MP4 boxes.
decryptdecrypt
Feature-gated synchronous decryption types and helpers. Feature-gated synchronous decryption types and helpers.
encryption
Resolved common-encryption metadata helpers built on typed box models. Resolved common-encryption metadata helpers built on typed MP4 boxes.
extract
Path-based box extraction helpers, including typed convenience reads. Path-based box extraction helpers built on the structure walker.
fourcc
Four-character box identifier support. Four-character box identifier support.
header
MP4 box header parsing and encoding helpers. MP4 box header parsing, encoding, and seek helpers.
muxmux
Feature-gated mux planning, real container assembly, and staged payload-copy helpers. Feature-gated mux planning, real MP4 container assembly, and sample-reader helpers.
probe
File-summary helpers built on the extraction and box layers. File-summary helpers built on the extraction and box layers, with byte-slice convenience entry points for in-memory probe flows.
rewrite
Path-based typed payload rewrite helpers built on the writer layer. Path-based typed payload rewrite helpers built on the writer layer.
sidx
Fragmented top-level sidx analysis, planning, and rewrite helpers. Top-level sidx helpers for fragmented MP4 files.
stringify
Stable field-order string rendering for descriptor-backed boxes. Stable text rendering for descriptor-backed boxes.
walk
Depth-first structure walking with path tracking and lazy payload access. Depth-first box traversal with path tracking and lazy payload access.
writer
Box-writing helpers with header backfill support. Box-writing helpers with header backfill and raw-copy support.

Macros§

codec_field