
Encode With NVENC in FFmpeg on NVIDIA GPUs
Encode with h264_nvenc and hevc_nvenc in FFmpeg 7.1 on NVIDIA GPUs: driver needs, a working command, quality settings, session limits and fixes.
Tag
8 posts

Encode with h264_nvenc and hevc_nvenc in FFmpeg 7.1 on NVIDIA GPUs: driver needs, a working command, quality settings, session limits and fixes.

Ask the CUDA runtime for a block size that maximizes theoretical occupancy with cudaOccupancyMaxPotentialBlockSize, and learn why you must still time it.

Build with -g -G, set breakpoints inside a kernel, switch focus between blocks and threads, inspect variables and use conditional breakpoints with cuda-gdb.

Run compute-sanitizer with memcheck, racecheck, initcheck and synccheck to catch out-of-bounds accesses, shared memory races, leaks and uninitialized reads.

Label phases of a CUDA program with NVTX push and pop ranges, the C++ scoped_range helper and domains, so Nsight Systems shows your names beside the kernels.

Run ncu on one kernel, pick sections like SpeedOfLight and WarpStateStats, read the results and follow the rules for turning counters into a specific fix.

Capture a CUDA timeline with nsys profile, read kernel, copy and API rows, find gaps and serialized streams, and print summary tables from the command line.

A working method for faster CUDA kernels: classify the bottleneck, fix memory access, tune occupancy and divergence, overlap transfers and verify each change.