11 unstable releases (5 breaking)

0.6.0 May 12, 2020
0.5.0 Nov 30, 2019
0.3.3 May 22, 2019
0.3.2 Mar 4, 2019
0.1.1 Nov 7, 2015

#2 in Video

Download history 520/week @ 2020-03-16 506/week @ 2020-03-23 661/week @ 2020-03-30 444/week @ 2020-04-06 695/week @ 2020-04-13 782/week @ 2020-04-20 625/week @ 2020-04-27 605/week @ 2020-05-04 1198/week @ 2020-05-11 1113/week @ 2020-05-18 1520/week @ 2020-05-25 864/week @ 2020-06-01 780/week @ 2020-06-08 1291/week @ 2020-06-15 659/week @ 2020-06-22 994/week @ 2020-06-29

2,565 downloads per month
Used in 4 crates

MIT license

20KB
431 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