Hardware-accelerated encoding with NVENC
compression
// what it does
Encodes H.264 on the NVIDIA GPU's dedicated NVENC block, offloading work from the CPU entirely. -preset p7 is the slowest/highest-quality of NVENC's p1-p7 presets, and -cq 23 enables constant-quality (VBR) mode analogous to CRF, so quality stays roughly fixed while bitrate varies. Use this on machines with a supported NVIDIA GPU when you want near-real-time encodes at decent quality.
// shell
$ ffmpeg -i input.mp4 -c:v h264_nvenc -preset p7 -cq 23 output.mp4// gotcha
-cq gives true constant quality only when no target bitrate is set — pass -b:v 0 to be explicit; adding a nonzero -b:v switches NVENC to a capped-VBR mode. Consumer GeForce cards also cap the number of concurrent NVENC sessions, so parallel jobs can fail.