<p align="center">
<h1 align="center">rsmp4decrypt</h1>
<p align="center">
MP4 decryption for Rust - Bento4 <code>mp4decrypt</code> as a library and CLI.
</p>
<p align="center">
<a href="https://crates.io/crates/rsmp4decrypt"><img src="https://img.shields.io/crates/v/rsmp4decrypt.svg" alt="Crates.io"></a>
<a href="https://docs.rs/rsmp4decrypt"><img src="https://img.shields.io/docsrs/rsmp4decrypt" alt="docs.rs"></a>
<a href="LICENSE-MIT"><img src="https://img.shields.io/crates/l/rsmp4decrypt.svg" alt="License"></a>
<img src="https://img.shields.io/badge/MSRV-1.88-blue.svg" alt="MSRV 1.88">
</p>
</p>
---
- **Idiomatic API** - small, focused Rust surface over Bento4 decryption
- **CLI parity for core inputs** - accepts `--key`, `--fragments-info`, and `--show-progress`
- **Track ID and KID keys** - use decimal track IDs or 128-bit hexadecimal KIDs
- **File and memory decryption** - decrypt from paths or in-memory buffers
- **Progress callbacks** - report Bento4 progress in library code or through the bundled CLI
- **Reusable context** - build a `Mp4Decryptor` once and reuse it across many decrypt calls
- **Process-isolated file decryption** - run multiple file decrypts in parallel through `IsolatedMp4Decryptor`
- **Async file decryption** - enable the `tokio` feature for `decrypt_file_async` without `spawn_blocking`
- **Typed errors** - all public failures are surfaced through `rsmp4decrypt::Error`
- **Thread-safe usage** - internal serialization keeps Bento4 stable across concurrent callers
- **Vendored native sources** - published crates build from the checked-in `vendor/bento4-src` snapshot
## Installation
```toml
[dependencies]
rsmp4decrypt = "0.2.0"
# Enable the async isolated file API:
# rsmp4decrypt = { version = "0.2.0", features = ["tokio"] }
```
To install the CLI:
```powershell
cargo install rsmp4decrypt
```
## Feature Flags
| `tokio` | Enables `IsolatedMp4Decryptor::decrypt_file_async` using `tokio::process` |
> See the [`examples/`](examples/) directory for file decryption, in-memory decryption, multi-key single-file decryption, progress reporting, threaded isolated file decryption, and Tokio-based async isolated file decryption.
## License
Licensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or [MIT license](LICENSE-MIT) at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in rsmp4decrypt by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Read [Bento4's License](https://raw.githubusercontent.com/axiomatic-systems/Bento4/master/Documents/LICENSE.txt)