
xdltF4HvfjE) went offline. The DEBs from the oficinadotux repository (16/18/19) and the compilation gist from 2017 remain only as historical material at the end. Today the approach is the proprietary driver + FFmpeg with ffnvcodec (headers 13.1.15, Linux driver ≥ 610) — and, most of the time, without downloading the proprietary SDK.NVENC is still the same NVIDIA hardware block: it takes H.264/HEVC/AV1 off the CPU and sends it to the GPU's ASIC. What changed is the packaging. In 2017 you compiled FFmpeg against the SDK. In 2026 FFmpeg talks to the driver through nv-codec-headers (MIT). First check whether the binary you already have lists the encoders; compile only if they are missing.
What changed since 2017
- Ubuntu 24.04 LTS ships FFmpeg 6.1.1; 26.04 LTS ships 8.0.1 (universe).
- The current Video Codec SDK is 13.1. The public headers are at
nv-codec-headers13.1.15 — minimum driver 610. - Old presets (
llhq,slowas an NVENC preset name) gave way top1…p7. - In addition to
h264_nvencandhevc_nvencthere isav1_nvenc(Ada / RTX 40 and newer). - NPP in FFmpeg is deprecated with CUDA greater than 12.8. NVIDIA calls for
scale_cuda, notscale_npp. Avoid--enable-libnpp. - OBS on Linux talks to NVENC through the driver. Compiling FFmpeg is no longer a prerequisite for recording/streaming in OBS.
Check the GPU and driver
Without the proprietary driver there is no NVENC. Nouveau does not count. Details on how the GPU works: How graphics cards work.
nvidia-smi
# Driver Version e o nome da GPU. Para headers 13.1: driver ≥ 610.
ffmpeg -hide_banner -encoders | grep nvenc
ffmpeg -hide_banner -decoders | grep cuvid
ffmpeg -hide_banner -hwaccels | grep -E 'cuda|nvdec'
If you see h264_nvenc / hevc_nvenc (and av1_nvenc on Ada+), the system's FFmpeg is already suitable. Also install the driver's encode/decode libraries:
# Ubuntu
sudo apt install libnvidia-decode libnvidia-encode
# Debian (nomes com sufixo 1)
sudo apt install libnvcuvid1 libnvidia-encode1
For those who do not have the driver yet:
ubuntu-drivers devices
sudo ubuntu-drivers install
# ou um ramo específico, ex.: sudo apt install nvidia-driver-570
sudo reboot
Shortcut: Ubuntu's ffmpeg
sudo apt update
sudo apt install ffmpeg
ffmpeg -version
ffmpeg -hide_banner -encoders | grep nvenc
Debian/Ubuntu compile FFmpeg with libffmpeg-nvenc-dev (MIT headers only). NVENC/NVDEC are included through autodetection; the NVIDIA libraries are a suggested, not mandatory, package dependency. That is why the binary lists the encoders even on a machine without a GPU — and fails at runtime if the driver is absent.
If grep nvenc returns nothing, you have a build without ffnvcodec (snap, an old static binary, an odd PPA). Then use jellyfin-ffmpeg or compile.
Shortcut 2: jellyfin-ffmpeg
The jellyfin-ffmpeg is FFmpeg 7.1.x / 8.1.x already linked with NVENC, QSV, and VA-API. You can install the package by itself, without the Jellyfin server. In 2026: jellyfin-ffmpeg7 (7.1.4) and jellyfin-ffmpeg8 (8.1.1).
curl -fsSL https://repo.jellyfin.org/install-debuntu.sh | sudo bash
sudo apt install jellyfin-ffmpeg7 libnvidia-decode libnvidia-encode
/usr/lib/jellyfin-ffmpeg/ffmpeg -hide_banner -encoders | grep nvenc
The binary lives in /usr/lib/jellyfin-ffmpeg/ffmpeg, it does not replace Ubuntu's /usr/bin/ffmpeg . Use the full path (or an alias) when you want guaranteed NVENC support.
Compiling: official NVIDIA 13.1 recipe
Documentation: Using FFmpeg with NVIDIA GPU Hardware Acceleration (SDK 13.1). Official FFmpeg repositories are now at code.ffmpeg.org.
Useful when you want FFmpeg 8 on 24.04, CUDA filters, or an isolated prefix without touching the system package.
sudo apt update
sudo apt -y install git build-essential pkg-config nasm clang
libx264-dev libx265-dev libopus-dev libvpx-dev libmp3lame-dev
libass-dev libfreetype6-dev libgnutls28-dev
mkdir -p ~/src && cd ~/src
git clone https://code.ffmpeg.org/FFmpeg/nv-codec-headers.git
cd nv-codec-headers
# driver < 610: git checkout n12.2.72.0
sudo make install
cd ..
git clone https://code.ffmpeg.org/FFmpeg/FFmpeg.git
cd FFmpeg
# master quebra de vez em quando; pin numa release:
# git checkout n8.0.1
./configure --prefix="$PWD/build"
--enable-gpl --enable-nonfree
--disable-static --enable-shared
--nvcc=clang
--enable-libx264 --enable-libx265 --enable-libopus
--enable-libvpx --enable-libmp3lame --enable-libass --enable-gnutls
make -j"$(nproc)"
make install
export PATH="$PWD/build/bin:$PATH"
export LD_LIBRARY_PATH="$PWD/build/lib:${LD_LIBRARY_PATH:-}"
ffmpeg -hide_banner -encoders | grep nvenc
ffmpeg -hide_banner -filters | grep cuda
The flag --enable-nonfree is included because FFmpeg treats NVENC as nonfree when redistributing the binary. The headers are MIT; the proprietary blob is the driver. Do not enable --enable-libnpp. The CUDA runtime is not mandatory — FFmpeg uses the driver API.
To persist the local prefix, add this to ~/.bashrc:
export PATH="$HOME/src/FFmpeg/build/bin:$PATH"
export LD_LIBRARY_PATH="$HOME/src/FFmpeg/build/lib:${LD_LIBRARY_PATH:-}"
Do not install in /usr on top of the package ffmpeg. The prefix build/ avoids fighting with apt.
Using the encoders
Entire pipeline on the GPU (CUDA decode → NVENC encode), without going back through RAM:
ffmpeg -y -hwaccel cuda -hwaccel_output_format cuda
-i entrada.mp4
-c:v h264_nvenc -preset p4 -b:v 5M -fps_mode passthrough
-c:a copy
saida.mp4
HEVC (Maxwell 2nd gen+) and AV1 (Ada / RTX 40+):
# HEVC qualidade (arquivo, não live)
ffmpeg -y -hwaccel cuda -hwaccel_output_format cuda -i entrada.mp4
-c:v hevc_nvenc -preset p6 -tune hq -rc vbr -cq 23 -b:v 0
-c:a copy saida.mkv
# AV1
ffmpeg -y -hwaccel cuda -hwaccel_output_format cuda -i entrada.mp4
-c:v av1_nvenc -preset p5 -tune hq -rc constqp -qp 28
-c:a copy saida.mkv
Resize on the GPU with scale_cuda (replacement for scale_npp):
ffmpeg -y -hwaccel cuda -hwaccel_output_format cuda -i entrada.mp4
-vf scale_cuda=1280:720:interp_algo=bilinear
-c:v h264_nvenc -preset p4 -b:v 4M -c:a copy saida.mp4
Presets: p1 faster / lower quality, p7 slower / better. p4 is the default. Tune: hq (file), ll / ull (live), uhq (HEVC/AV1, Turing+, more VRAM).
Multiple GPUs: -hwaccel_device 1 or CUDA_VISIBLE_DEVICES=1. List: nvidia-smi -L.
OBS Studio
In current OBS, the “NVIDIA NVENC” encoder appears automatically when the proprietary driver is running. It does not depend on the FFmpeg you compiled. OBS Flatpak uses its own runtime: the NVIDIA Flatpak package (org.freedesktop.Platform.GL.nvidia-…) needs to match the host driver.
On the CLI, the equivalent of “record the screen with NVENC” is still FFmpeg; OBS is the UI. SimpleScreenRecorder has fallen behind — if you still use it, migrate to OBS or FFmpeg itself.
Hardware by generation
h264_nvenc— Kepler (GTX 600) onward.hevc_nvenc— Maxwell 2nd gen (GTX 900) onward; 10-bit becomes decent on Pascal+.av1_nvenc— Ada (RTX 40) and Blackwell (RTX 50).
The limit of 3 simultaneous sessions on GeForce was removed in driver 456.71 (2020). If an encode refuses a session, update the driver before blaming FFmpeg.
History (2017)
The workflow back then — SDK 6/7, FFmpeg 3.2.1, a gist script, DEB for Ubuntu 16/18/19 — is archived at:
- compilation gist (FFmpeg 3.2.1 + SDK 7.0.1)
- oficinadotux (16/18/19 binaries)
- gitlab.com/jniltinho/docker-ffmpeg
Do not use these binaries on Ubuntu 24.04/26.04. The YouTube video accompanying the original post is no longer available.
Summary: nvidia-smi running, ffmpeg -encoders | grep nvenc listed, encode with -hwaccel cuda -hwaccel_output_format cuda and scale_cuda. Compile only if Ubuntu's package or jellyfin-ffmpeg is not enough.