Skip to main content

Module nvenc

Module nvenc 

Source
Expand description

NVIDIA NVENC hardware H.264 / HEVC / AV1 encoder loaded via runtime libcuda / libnvidia-encode. NVENC hardware H.264 / HEVC / AV1 encoder: CUDA-bound sessions that encode packed BGRA or RGBA frames from the X11 host and Wayland readback paths, or Wayland dmabufs in place.

The module dynamically loads libcuda, libnvidia-encode, and libEGL at runtime, negotiates the NVENC API version against the installed driver (set-once per process), and stamps every NVENCAPI struct with the exact NV_ENC_*_VER word the negotiated SDK defines, so one binary drives drivers from NVENC 10.0 (~R445) through 13.0. Frames reach the GPU two ways: a zero-copy dmabuf import (EGLImage → CUDA, the mapped plane registered with NVENC in place as pitch-linear memory or as a CUDA array), and a pinned host→device upload of packed BGRA / RGBA. Color is converted on the GPU either way. The codec is a session parameter: the same rate control, GOP, VUI, and latency posture is programmed into whichever of the three codec configurations the device offers, and a codec the device lacks (AV1 before Ada) is refused at open so the caller falls back. Sessions reconfigure resolution and rate control in place, so a resize or bitrate change costs a few milliseconds instead of a full rebuild.

Structs§

NvencEncoder
A live NVENC encoder session with its CUDA context and interop resources.