1
0
Fork 0
mirror of https://github.com/alfg/mp4-rust.git synced 2024-12-22 20:16:27 +00:00
mp4-rust/examples/simple.rs
Data Retriever 3ecfd0cc9d
Cargo fmt and clippy (#73)
* Run cargo clippy --fix

* Run cargo fmt --all
2022-05-31 20:50:49 -07:00

27 lines
627 B
Rust

use std::env;
use std::fs::File;
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() < 2 {
println!("Usage: simple <filename>");
std::process::exit(1);
}
let filename = &args[1];
let f = File::open(filename).unwrap();
let mp4 = mp4::read_mp4(f).unwrap();
println!("Major Brand: {}", mp4.major_brand());
for track in mp4.tracks().values() {
println!(
"Track: #{}({}) {} {}",
track.track_id(),
track.language(),
track.track_type().unwrap(),
track.box_type().unwrap(),
);
}
}