From 42f46dcf936ed42a25118bda67d66dd0237e5df4 Mon Sep 17 00:00:00 2001 From: Artur Klesun Date: Fri, 9 Apr 2021 14:42:52 +0300 Subject: [PATCH 1/2] Create README.md --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..5f165c20 --- /dev/null +++ b/README.md @@ -0,0 +1,41 @@ +### Installation + +First add the dependency to your `Cargo.toml` +```toml +[dependencies] +... +ffmpeg = "0.3.0" +``` +Then update (will likely [take a while](https://stackoverflow.com/questions/53361052/how-do-i-debug-cargo-build-hanging-at-updating-crates-io-index) due to size of downloaded ffmpeg lib) +```bash +cargo update +``` + +### Usage + +```rust +use std::{fs::File}; + +fn main() { + ffmpeg::init().unwrap(); + let file = File::open("path/to/your/video/file.mkv").unwrap(); + match ffmpeg::format::io::input(file) { + Ok(context) => { + for (k, v) in context.metadata().iter() { + println!("{}: {}", k, v); + } + } + Err(error) => println!("error: {}", error), + } +} +``` +By running it via: +```bash +cargo run +``` +The output is: +``` +error: failed to run custom build command for `ffmpeg-sys v4.2.1` +``` + +For more examples see [`/examples/`](https://github.com/meh/rust-ffmpeg/blob/master/examples/metadata.rs). From 6e713a5f194c35107adffbc0c7dcd9930fa42362 Mon Sep 17 00:00:00 2001 From: Artur Klesun Date: Fri, 9 Apr 2021 15:06:23 +0300 Subject: [PATCH 2/2] Correct: ffmpeg::format::io::input -> ffmpeg::format::input --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f165c20..4664ab0e 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ use std::{fs::File}; fn main() { ffmpeg::init().unwrap(); let file = File::open("path/to/your/video/file.mkv").unwrap(); - match ffmpeg::format::io::input(file) { + match ffmpeg::format::input(file) { Ok(context) => { for (k, v) in context.metadata().iter() { println!("{}: {}", k, v);