13 unstable releases (6 breaking)

Uses old Rust 2015

0.7.0 Aug 21, 2020
0.6.1 Jul 23, 2020
0.6.0 May 12, 2020
0.5.0 Nov 30, 2019
0.1.1 Nov 7, 2015

#2 in Video

Download history 876/week @ 2020-05-30 856/week @ 2020-06-06 1283/week @ 2020-06-13 742/week @ 2020-06-20 924/week @ 2020-06-27 1122/week @ 2020-07-04 966/week @ 2020-07-11 1290/week @ 2020-07-18 1071/week @ 2020-07-25 1047/week @ 2020-08-01 1058/week @ 2020-08-08 956/week @ 2020-08-15 842/week @ 2020-08-22 1466/week @ 2020-08-29 1789/week @ 2020-09-05 1601/week @ 2020-09-12

4,509 downloads per month
Used in 5 crates

MIT license

23KB
493 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