mp4-edit
========
This crate provides tools for lossless editing of MP4 files, with a focus on audiobooks.
## Status
> [!WARNING]
> Unstable. The API is likely to change, and more testing is needed.
## Why yet another mp4 parser?
The short answer is I needed one that could handle non-standard mp4s plus some other features I didn't see in existing crates, and this evolved out of my learning the file format. And why not? It's been fun! (See below for a list of alternatives.)
## Usage
See the examples dir for in-depth usage.
## Highlights
- Lossless MP4 editing.
- Duration trimming/slicing[^trimming] (WIP, requires `experimental-trim` feature flag).
- Track interleaving.
- Chapter track builder.
- Easy fast start (it's possible in most cases to insert metadata before `mdat` in a single pass).
- Async API built on `futures` traits[^async] (`tokio` support via `tokio_util::compat`).
## Examples
You may run the examples in this repo as usual with `cargo run --example <EXAMPLE>`, but for most examples you'll want to build them first with `cargo build --example <EXAMPLE> --release` before running them to get good performance.
- **mp4copy**: Makes a copy of the mp4 file, converting it to fast-start if it isn't already.
- **mp4dump**: Useful for seeing what's inside an mp4 file.
- **extract_leaf_atoms**: Generate atom parser test data from an mp4 file.
## Alternatives
Here are some other mp4 crates to consider (in alphabetical order):
- [mp4-atom](https://github.com/kixelated/mp4-atom)
- [mp4-rust](https://github.com/alfg/mp4-rust)
- [mp4ameta](https://github.com/saecki/mp4ameta)
- [mp4parse-rust](https://github.com/mozilla/mp4parse-rust)
- [mtag](https://github.com/insomnimus/mtag)
## License
Licensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or [MIT](LICENSE-MIT) license at your option.
## Contributing
Please open an issue if you have a feature request or a bug report. I'm happy to accept changes in line with the goals
of this crate (editing mp4 bytes).
When opening a pull request, please make a best effort to use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.