24 releases
0.7.1 |
|
---|---|
0.6.11 | Apr 22, 2025 |
0.6.10 | Mar 6, 2025 |
0.5.1 | Nov 9, 2023 |
0.1.0 | Jul 16, 2023 |
#77 in Video
4,468 downloads per month
Used in vvdecli
2MB
40K
SLoC
Rust bindings for VVdeC
This crate provides Safe Rust bindings for VVdeC.
A simple VVC decoder application can be implemented using the snippet below as a starting point:
use vvdec::{Decoder, Error, Frame, PlaneComponent};
fn main() -> Result<(), Error> {
// You can also use Decoder::builder() if customizations are needed.
let mut decoder = Decoder::new()?;
// Process incoming VVC input bitsteram
while let Some(data) = get_input_data() {
decoder.decode(data)?.map(process_frame);
}
// Flush at the end
while let Some(frame) = decoder.flush()? {
process_frame(frame);
}
Ok(())
}
fn get_input_data() -> Option<&'static [u8]> {
return Some(&[0; 64]); // Replace this with real VVC bitstream data.
}
fn process_frame(frame: Frame) {
// Use decoded frame
let y_plane = frame.plane(PlaneComponent::Y).unwrap();
let y_plane_data: &[u8] = y_plane.as_ref();
// ...
}
Vendored build
If VVdeC is not installed in the system, a vendored copy will be built, which requires CMake.
VVdeC-rs
Rust bindings for VVdeC.
Sub-projects:
- vvdec-sys: unsafe bindings generated by bindgen
- vvdec: the safe bindings on top of vvdec-sys
- vvdecli: CLI application using the safe bindings to decode VVC Annex-B files into YUV4MPEG (Y4M).
Installing the CLI
In order to build, either VVdeC >= 3.0 needs to be installed and be found via pkg-config, or a VVdeC will be compiled while building vvdec-sys, which requires CMake.
Then, the CLI app can be installed with cargo install vvdecli
.
If you have FFmpeg installed, you can then test vvdecli and play VVC with
vvdecli -i ./tests/short.vvc | ffplay -
License
This crate is license under the BSD-3-Clause-Clear license, to maintain compatibility with VVdeC's license.
Dependencies
~0.2–3MB
~64K SLoC