...
Carte graphique utilisée : NVIDIA RTX A6000
Pré-requis
Création de l'utilisateur pod
...
Instaler + configurer/autoriser les accès NFS
Installation drivers NVIDIA
Modification des sources list pour l'ajout de contrib + non-free
| Bloc de code | ||
|---|---|---|
| ||
sudo vi /etc/apt/sources.list |
...
| Bloc de code |
|---|
deb http://ftp.fr.debian.org/debian/ bookworm main contrib non-free non-free-firmware deb-src http://ftp.fr.debian.org/debian/ bookworm main contrib non-free non-free-firmware deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware deb-src http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware # bookworm-updates, to get updates before a point release is made; # see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports deb http://ftp.fr.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware deb-src http://ftp.fr.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware |
Ajout des sources "nvidia" pour une installation depuis la distrib des dernières versions
| Bloc de code |
|---|
su - pod mkdir nvidia cd nvidia/ wget https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/cuda-keyring_1.1-1_all.deb sudo dpkg -i cuda-keyring_1.1-1_all.deb sudo apt install nvidia-kernel-open-dkms sudo apt install nvidia-driver sudo apt install cuda-drivers reboot su - pod sudo apt install nvidia-cuda-toolkit reboot su - pod ## POUR VERIFIER LES VERSION INSTALLÉES ## nvidia-smi +---------------------------------------------------------------------------------------+ | NVIDIA-SMI 545.23.08 Driver Version: 545.23.08 CUDA Version: 12.3 | |-----------------------------------------+----------------------+----------------------+ | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+======================+======================| | 0 NVIDIA RTX A6000 On | 00000000:3B:00.0 Off | Off | | 30% 26C P8 15W / 300W | 5MiB / 49140MiB | 0% Default | | | | N/A | +-----------------------------------------+----------------------+----------------------+ |
Installation/compilation/parmétrage de ffmpeg
| Bloc de code |
|---|
su - pod sudo apt install yasm cmake libtool unzip libnuma-dev sudo apt install build-essential yasm cmake libtool libc6 libc6-dev unzip wget libnuma1 libnuma-dev -s ## Pour vérifier qu'il ne manque pas de paquets ## Installer les paquets manquants si nécessaire ## sudo apt install pkg-config sudo apt install libnvidia-encode1 libx264-dev libfdk-aac-dev libmp3lame-dev cd ~/nvidia/ git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git cd nv-codec-headers sudo make install cd .. git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg/ cd ffmpeg/ ./configure --enable-cuda --enable-cuvid --enable-nvdec --enable-nonfree --enable-cuda-nvcc --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --disable-static --enable-shared --enable-gpl --enable-libx264 --enable-libfdk-aac --enable-cuda-llvm --enable-ffnvcodec --enable-libmp3lame make -j 8 sudo make install |
Paramétrage (optimisé) ffmpeg à utiliser dans Pod pour l'encodage GPU
| Bloc de code |
|---|
FFMPEG_CMD = "ffmpeg -hwaccel_device 0 -hwaccel_output_format cuda -hwaccel cuda"
FFMPEG_INPUT = '-hide_banner -i "%(input)s" '
FFMPEG_LEVEL = 0
FFMPEG_PRESET = "p6"
FFMPEG_PROFILE = "high"
FFMPEG_LIBX = "h264_nvenc"
FFMPEG_MP4_ENCODE = (
'%(cut)s -map 0:v:0 %(map_audio)s -c:v %(libx)s -vf "scale_cuda=-2:%(height)s:interp_algo=bicubic:format=yuv420p" '
+ "-preset %(preset)s -profile:v %(profile)s "
+ "-level %(level)s "
+ "-forced-idr 1 "
+ "-b:v %(maxrate)s -maxrate %(maxrate)s -bufsize %(bufsize)s -rc vbr -rc-lookahead 20 -bf 1 "
+ '-force_key_frames "expr:gte(t,n_forced*1)" '
+ '-c:a aac -ar 48000 -b:a %(ba)s -movflags faststart -y -fps_mode passthrough "%(output)s" '
)
FFMPEG_HLS_COMMON_PARAMS = (
"%(cut)s "
+ "-c:v %(libx)s -preset %(preset)s -profile:v %(profile)s "
+ "-level %(level)s "
+ "-forced-idr 1 "
+ '-force_key_frames "expr:gte(t,n_forced*1)" '
+ "-c:a aac -ar 48000 "
)
FFMPEG_HLS_ENCODE_PARAMS = (
'-vf "scale_cuda=-2:%(height)s:interp_algo=bicubic:format=yuv420p" -maxrate %(maxrate)s -b:a:0 %(ba)s -bufsize %(maxrate)s -rc constqp -b:v 0k -rc-lookahead 20 -bf 1 -qp 32 -2pass 1 -multipass 2 -spatial-aq 1 -aq-strength 11 '
+ "-hls_playlist_type vod -hls_time %(hls_time)s -hls_flags single_file "
+ '-master_pl_name "livestream%(height)s.m3u8" '
+ '-y "%(output)s" '
)
FFMPEG_CREATE_THUMBNAIL = (
'-vf "select=between(t\,5\,10)*eq(pict_type\,PICT_TYPE_I)" -frames:v 3 -vsync vfr "%(output)s_%%04d.png"'
)
|
...