8 releases

0.4.0 Aug 31, 2019
0.3.5 Aug 31, 2019
0.3.3 May 22, 2019
0.3.2 Mar 4, 2019
0.1.1 Nov 7, 2015

#3 in Video

Download history 1146/week @ 2019-07-20 605/week @ 2019-07-27 579/week @ 2019-08-03 407/week @ 2019-08-10 412/week @ 2019-08-17 413/week @ 2019-08-24 554/week @ 2019-08-31 509/week @ 2019-09-07 620/week @ 2019-09-14 1165/week @ 2019-09-21 466/week @ 2019-09-28 602/week @ 2019-10-05 880/week @ 2019-10-12 852/week @ 2019-10-19 776/week @ 2019-10-26

2,277 downloads per month
Used in 3 crates

MIT license

20KB
425 lines

y4m Build Status crates.io

YUV4MPEG2 (.y4m) Encoder/Decoder. Format specification.

Usage

Simple stream copying:

extern crate y4m;
use std::io;

let mut infh = io::stdin();
let mut outfh = io::stdout();
let mut dec = y4m::decode(&mut infh).unwrap();
let mut enc = y4m::encode(dec.get_width(), dec.get_height(), dec.get_framerate())
    .with_colorspace(dec.get_colorspace())
    .write_header(&mut outfh)
    .unwrap();
loop {
    match dec.read_frame() {
        Ok(frame) => if enc.write_frame(&frame).is_err() { break },
        _ => break,
    }
}

See API documentation for overview of all available methods. See also this example on how to resize input y4m into grayscale y4m of different resolution:

cargo build --release --example resize
ffmpeg -i in.mkv -f yuv4mpegpipe - | target/release/examples/resize - 640x360 - | mpv -

License

Library is licensed under MIT.

No runtime deps