11<p align =" center " >
22 <h1 align =" center " >mp4forge</h1 >
33 <p align =" center " >
4- Rust library and CLI for inspecting, extracting, probing, and rewriting MP4 box structures.
4+ Rust library and CLI for inspecting, extracting, probing, muxing, and rewriting MP4 structures.
55 </p >
66 <p align =" center " >
77 <a href="https://crates.io/crates/mp4forge"><img src="https://img.shields.io/crates/v/mp4forge.svg" alt="Crates.io"></a>
2121- Thin typed path-based helpers and byte-slice convenience wrappers for common extraction, rewrite, and probe flows
2222- Fragmented top-level ` sidx ` analysis, planning, and rewrite APIs for supported layouts
2323- Feature-gated decryption APIs and a sync-only ` decrypt ` CLI for the supported protected MP4 families
24- - Built-in CLI for ` decrypt ` , ` dump ` , ` extract ` , ` probe ` , ` psshdump ` , ` edit ` , and ` divide `
24+ - Built-in CLI for ` decrypt ` , ` divide ` , ` dump ` , ` edit ` , ` extract ` , ` mux ` , ` probe ` , and ` psshdump `
2525- Shared-fixture coverage for regular MP4, fragmented MP4, encrypted init segments, QuickTime-style metadata cases, and derived real codec fixtures for additional codec-family coverage
2626
2727## Installation
2828
2929``` toml
3030[dependencies ]
31- mp4forge = " 0.7 .0"
31+ mp4forge = " 0.8 .0"
3232
3333# With optional features:
34- # mp4forge = { version = "0.7.0", features = ["async"] }
35- # mp4forge = { version = "0.7.0", features = ["decrypt"] }
36- # mp4forge = { version = "0.7.0", features = ["decrypt", "async"] }
37- # mp4forge = { version = "0.7.0", features = ["serde"] }
34+ # mp4forge = { version = "0.8.0", features = ["async"] }
35+ # mp4forge = { version = "0.8.0", features = ["decrypt"] }
36+ # mp4forge = { version = "0.8.0", features = ["decrypt", "async"] }
37+ # mp4forge = { version = "0.8.0", features = ["mux"] }
38+ # mp4forge = { version = "0.8.0", features = ["mux", "async"] }
39+ # mp4forge = { version = "0.8.0", features = ["serde"] }
3840```
3941
4042Install the CLI from crates.io:
@@ -68,6 +70,14 @@ feature flags:
6870 IPMP ACBC and ACGK OD-track movies, and the retained IAEC protected-movie path. When combined
6971 with ` async ` , it also enables the additive file-backed Tokio async decrypt companions, while the
7072 CLI remains on the synchronous path.
73+ - ` mux ` : enables the additive mux task surface and the retained low-level helpers underneath it.
74+ The library path covers the narrow public ` MuxRequest ` model with repeated track specs plus
75+ optional ` segment_duration ` or ` fragment_duration ` , real ` ftyp ` /` moov ` /` mdat ` writing for sync
76+ callers, additive async real-container writing when combined with ` async ` , internal chunk and
77+ duration coordination on one mux event graph, the retained low-level seekable and progressive
78+ payload assembly helpers, and one-sample-at-a-time seekable or progressive readers. It also
79+ enables the sync-only ` mux ` CLI route for one output MP4 built from repeated
80+ path-first ` --track ` inputs.
7181- ` serde ` : derives ` Serialize ` and ` Deserialize ` for the reusable public report structs under
7282 ` mp4forge::cli::probe ` and ` mp4forge::cli::dump ` , along with their nested public codec-detail,
7383 media-characteristics, ` FieldValue ` , and ` FourCc ` data. This is intended for library-side report
@@ -85,6 +95,7 @@ COMMAND:
8595 dump display the MP4 box tree
8696 edit rewrite selected boxes
8797 extract extract raw boxes by type or path
98+ mux merge one video track plus audio, text, and subtitle tracks into one MP4
8899 psshdump summarize pssh boxes
89100 probe summarize an MP4 file
90101```
@@ -94,9 +105,37 @@ sync-only, accepts repeated `--key ID:KEY`, optional `--fragments-info FILE`, an
94105` --show-progress ` , and reuses the same library decryption surface that backs the feature-gated
95106sync and async APIs.
96107
97- ` divide ` currently targets fragmented inputs with up to one AVC video track and one MP4A audio
98- track, including encrypted wrappers that preserve those original sample-entry formats. Pass
99- ` -validate ` when you want the same probe-driven layout checks without creating any output files.
108+ ` mux ` is available when the crate is built with ` --features mux ` . The CLI route stays sync-only
109+ and accepts repeated ` --track ` inputs, one required positional output path, and at most one of
110+ ` --segment_duration ` or ` --fragment_duration ` . The current public ` --track ` grammar is path-first:
111+ ` PATH ` imports one raw source or every supported track from one MP4 source, while
112+ ` PATH#video ` , ` PATH#audio ` , ` PATH#audio:N ` , ` PATH#text ` , ` PATH#text:N ` , and ` PATH#track:ID `
113+ select one specific track from a containerized source. The landed path-only auto-detection
114+ currently covers MP4, supported AVI audio streams plus H.263/JPEG/PNG/MPEG-4 Part 2/H.264/AVC1 video streams, supported
115+ MPEG-PS MPEG audio streams plus LPCM audio plus MPEG-4 Part 2/H.264/H.265/VVC video streams, supported MPEG-TS
116+ 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
117+ ADTS, MP3, AC-3, E-AC-3, AC-4, AMR, AMR-WB, QCP voice audio, DTS core audio, AAC LATM, Dolby
118+ TrueHD, leading-sync MHAS MPEG-H, IAMF, H.263 elementary video, MPEG-2 elementary video, MPEG-4 Part 2 elementary video,
119+ 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,
120+ JPEG still images, PNG still images, WAVE/AIFF/AIFC PCM, native FLAC, Ogg-backed FLAC,
121+ Ogg-backed Opus, Ogg-backed Vorbis, Ogg-backed Speex, Ogg-backed Theora, and CAF-backed ALAC.
122+ Broader DTS-family
123+ sample-entry variants remain supported through MP4 track import, and the broader demux-backed
124+ path-only families continue to move over behind the same public shape.
125+ MP4-track merges continue to cover the broader registered sample-entry families because they
126+ preserve encoded sample-entry bytes from the source file, and mixed video/audio/text/subtitle jobs
127+ retain imported handler names and languages on the real MP4 path. The matching sync and async
128+ library entry points use the same ` MuxRequest ` surface, while the retained lower-level mux helpers
129+ remain available separately when you need staged planning or payload-copy behavior without the
130+ task-level request layer. The public ` mp4forge::mux::sample_reader ` helpers can also expose stable
131+ text or subtitle track identity when you construct them with companion ` MuxTrackConfig ` values.
132+
133+ ` divide ` currently targets fragmented inputs with up to one video track from AVC, HEVC, Dolby
134+ Vision on HEVC, AV1, VP8, or VP9 and one audio track from MP4A-based audio, Opus, AC-3,
135+ E-AC-3, AC-4, ALAC, DTS-family entries, FLAC, IAMF, MPEG-H, or PCM, including encrypted wrappers
136+ that preserve those original sample-entry formats. Subtitle and text tracks remain unsupported in
137+ the current divide output model. Pass ` -validate ` when you want the same probe-driven layout
138+ checks without creating any output files.
100139
101140` dump ` defaults to the existing human-readable tree view. Pass ` -format json ` or ` -format yaml ` for
102141deterministic structured tree export with stable ` payload_fields ` for supported boxes; ` -full ` and
@@ -124,8 +163,9 @@ per-chunk, bitrate, and IDR aggregation, or use `mp4forge::probe::ProbeOptions`
124163when you need the same control programmatically.
125164
126165> See the [ ` examples/ ` ] ( ./examples ) directory for the crate's low-level and high-level API usage
127- > patterns, including the feature-gated decrypt example and the Tokio-based async library example
128- > behind the optional ` async ` feature.
166+ > patterns, including the feature-gated decrypt example, the feature-gated real-mux and
167+ > mux/sample-reader examples, and the Tokio-based async library example behind the optional
168+ > ` async ` feature.
129169
130170## License
131171
0 commit comments