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.
## Example
Run a P2P video-conferencing example:
...
...
@@ -12,6 +18,17 @@ Run a P2P video-conferencing example:
(change `127.0.0.1` to the server address)
```rust
// Let `input_raw_frame: Vec<u8>` be an RGB24 bitmap of size 1920*1080
//! 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 😎
//!
//! ```rust
//! 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