Crate syeve[−][src]
Expand description
Simple yet efficient video encoding
This is a lossless video codec, aiming at screen capture and anything else you’d want to format in PNG instead of JPEG. It is the equivalent of PNG for video.
As PNG, there are two steps: filtering, and compressing.
The filter transforms the pixels into the differences between adjacent pixels. This way adjacent pixels with the same color have the value 0, and linear gradients become constant series. The filtered image is now easier to compress with a conventional algorithm.
The difference with PNG is that the filter also takes the difference across time, so that if the frames are almost the same, they will be full of zeros.
⚠ unstable, not benchmarked, not fuzz-tested… but promising 😎
let mut buf = Vec::new();
let mut encoder = syeve::Encoder::new((640, 480), 3, syeve::Compression::Brotli(4), 30);
let mut decoder = syeve::Decoder::new();
for i in 0..10 {
let mut frame: Vec<u8> = (0..640*480*3).map(|j| ((i+j)%256) as u8).collect(); // dummy frame
let frame_bak = frame.clone();
encoder.encode(&mut frame, &mut buf).unwrap();
// [...] Transfer `buf` to decoder (e.g. UDP or file storage or avian carrier)
let frame = decoder.decode(&buf).unwrap().pixels;
assert_eq!(frame, frame_bak);
buf.clear();
}
Structs
Enums
Compression algo
Describes the trust we can have in the correctness of a decoded frame