This library provides a safe function to decrypt encrypted mp4 data stream using Bento4 SDK.
Add this to your Cargo.toml file.
```toml [dependencies] kdam = "0.1.0"
kdam = { git = "https://github.com/clitic/mp4decrypt.git", branch = "main" } ```
Or add from command line.
bash
$ cargo add mp4decrypt
See docs and examples to know how to use it.
```rust use std::collections::HashMap; use std::io::Write;
fn main() { let mut input = includebytes!("init.mp4").tovec(); input.extend(includebytes!("segment0.m4s"));
let mut keys = HashMap::new();
keys.insert(
"eb676abbcb345e96bbcf616630f1a3da".to_owned(),
"100b6c20940f779a4589152b57d2dacb".to_owned(),
);
let decrypted_data = mp4decrypt::mp4decrypt(&input, keys, None).unwrap();
std::fs::File::create("decrypted.mp4")
.unwrap()
.write_all(&decrypted_data)
.unwrap();
} ```
Dual Licensed