5 unstable releases

0.3.2 Mar 4, 2019
0.3.1 Aug 24, 2018
0.3.0 Aug 9, 2018
0.2.0 May 6, 2018
0.1.1 Nov 7, 2015

#4 in Video

Download history 89/week @ 2018-12-20 132/week @ 2018-12-27 153/week @ 2019-01-03 612/week @ 2019-01-10 406/week @ 2019-01-17 451/week @ 2019-01-24 921/week @ 2019-01-31 908/week @ 2019-02-07 665/week @ 2019-02-14 504/week @ 2019-02-21 707/week @ 2019-02-28 673/week @ 2019-03-07 584/week @ 2019-03-14 624/week @ 2019-03-21 481/week @ 2019-03-28

2,555 downloads per month

MIT license

19KB
396 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