Expand description
§rave-nvcodec
NVDEC/NVENC hardware codec wrappers for RAVE.
rave-nvcodec implements GPU decode and encode stages over NVIDIA Video Codec
SDK APIs with CUDA-device-pointer based frame flow.
§Scope
- NVDEC decode wrapper (
NvDecoder) implementingFrameDecoder - NVENC encode wrapper (
NvEncoder) implementingFrameEncoder - Encoder configuration (
NvEncConfig) - Raw FFI bindings for CUDA Video Codec SDK (
sysmodule)
§Public API Highlights
NvDecoder::new(ctx, source, codec)NvEncoder::new(cuda_context, sink, config)NvEncConfigfor resolution/fps/bitrate/GOP/B-frame/pitch settings
§Typical Usage
use std::sync::Arc;
use rave_core::codec_traits::{BitstreamSink, BitstreamSource};
use rave_core::context::GpuContext;
use rave_core::error::Result;
use rave_core::ffi_types::cudaVideoCodec;
use rave_nvcodec::nvdec::NvDecoder;
fn make_decoder(ctx: Arc<GpuContext>, source: Box<dyn BitstreamSource>) -> Result<NvDecoder> {
NvDecoder::new(ctx, source, cudaVideoCodec::HEVC)
}§Runtime Requirements
- NVIDIA driver libraries (
libcuda,libnvcuvid,libnvidia-encode) - Compatible CUDA toolkit + Video Codec SDK runtime
- Linux/WSL link search paths must include locations for NVIDIA driver libs
§Notes
- Decode output and encode input are GPU-resident NV12 frames.
- Encode path caches resource registration by device pointer to avoid per-frame registration overhead.
- This crate performs FFI-heavy work; all unsafe boundaries are isolated in
codec modules and
sys.
§Stub mode
When the rave_nvcodec_stub cfg is active (set by build.rs when the
NVIDIA Video Codec SDK headers or libraries are not found), the nvdec
and nvenc modules are replaced with stubs that return
EngineError::Decode /
EngineError::Encode immediately.
This allows the workspace to build and run tests on CI runners without a
GPU or NVIDIA drivers installed.