Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create README.md #152

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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::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).