Debian Codegraph @

.cargo/vendor/y4m/README.md

raw
1 # y4m [![Build Status](https://travis-ci.com/image-rs/y4m.png?branch=master)](https://travis-ci.com/github/image-rs/y4m) [![crates.io](https://img.shields.io/crates/v/y4m.svg)](https://crates.io/crates/y4m)
2
3 YUV4MPEG2 (.y4m) Encoder/Decoder. [Format specification](https://wiki.multimedia.cx/index.php?title=YUV4MPEG2).
4
5 ## Usage
6
7 Simple stream copying:
8
9 ```rust
10 extern crate y4m;
11 use std::io;
12
13 let mut infh = io::stdin();
14 let mut outfh = io::stdout();
15 let mut dec = y4m::decode(&mut infh).unwrap();
16 let mut enc = y4m::encode(dec.get_width(), dec.get_height(), dec.get_framerate())
17 .with_colorspace(dec.get_colorspace())
18 .write_header(&mut outfh)
19 .unwrap();
20 loop {
21 match dec.read_frame() {
22 Ok(frame) => if enc.write_frame(&frame).is_err() { break },
23 _ => break,
24 }
25 }
26 ```
27
28 See [API documentation](https://docs.rs/y4m) for overview of all available methods. See also [this example](examples/resize.rs) on how to resize input y4m into grayscale y4m of different resolution:
29
30 ```bash
31 cargo build --release --example resize
32 ffmpeg -i in.mkv -f yuv4mpegpipe - | target/release/examples/resize - 640x360 - | mpv -
33 ```
34
35 ## License
36
37 Library is licensed under [MIT](LICENSE).