~ $ ffmpeg -version
ffmpeg version git-2024-05-04-38f67a3 Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
configuration: --prefix=/usr/local --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --bindir=/usr/local/bin --pkg-config-flags=--static --enable-gpl --enable-version3 --enable-nonfree --enable-libfreetype --enable-pic --enable-libx264 --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libtheora --enable-libvpx --enable-libass --extra-libs='-lm -lz -lpthread'
libavutil 59. 16.101 / 59. 16.101
libavcodec 61. 5.103 / 61. 5.103
libavformat 61. 3.103 / 61. 3.103
libavdevice 61. 2.100 / 61. 2.100
libavfilter 10. 2.101 / 10. 2.101
libswscale 8. 2.100 / 8. 2.100
libswresample 5. 2.100 / 5. 2.100
libpostproc 58. 2.100 / 58. 2.100

この状態だとffmpegのnvencが使えてない。nv-codecはインストールしてるので
--enable-nvencや--enable-cuda-nvccをつけてビルドかな

~ $ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Mar_28_02:18:24_PDT_2024
Cuda compilation tools, release 12.4, V12.4.131
Build cuda_12.4.r12.4/compiler.34097967_0

ビルドオプションに
--extra-cflags=-I/usr/local/cuda/include
--extra-ldflags=-L/usr/local/cuda/lib64
あたりでビルドしないとエラー吐きそうかなとか、まあいじって楽しんでるよ😆