INT 21h

Hi, I am Vladimir Smagin, SysAdmin and Kaptain. Telegram / LinkedIn / Email / GIT / RSS / GPG / Надежный хостинг в Селектел
Select language

Использование видеокарты Nvidia для кодировки видео

№ 11779 В разделе Sysadmin от July 6th, 2022,
В подшивках:

Первое что нужно сделать это поставить дрова nvidia. Разумеется, без них ничего работать не будет. Тажке нужно поставить дополнительные зависимости для сборки ffmpeg:

sudo apt-get install build-essential yasm cmake libtool libc6 libc6-dev unzip wget libnuma1 libnuma-dev nvidia-cuda-toolkit

Теперь можно смело идти сюда и выполнять сборку под вашу ОС https://docs.nvidia.com/video-technologies/video-codec-sdk/ffmpeg-with-nvidia-gpu/.

На всякий случай копипастну сюда:

FFmpeg with NVIDIA GPU acceleration is supported on all Linux platforms.

To compile FFmpeg on Linux, do the following:

  • Clone ffnvcodec
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
  • Install ffnvcodec
cd nv-codec-headers && sudo make install && cd –
  • Clone FFmpeg’s public GIT repository.
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg/
  • Install necessary packages.
sudo apt-get install build-essential yasm cmake libtool libc6 libc6-dev unzip wget libnuma1 libnuma-dev
  • Configure
./configure --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
  • Compile
make -j 8
  • Install the libraries.
sudo make install

Вы можете собрать новый пакет с вкомпиленой поддержкой cuda, но я не стал заморачиваться, поставил ffmpeg из репозитория и поверх него через make install катанул мою сборку. Да, оно захерится при следующем обновлении ОС, собирайте пакет и не смотрите какой я ленивый.

По ссылке выше даны примеры использования. А от себя могу показать такой способ для сливания кучи записей с рега в одну ffmpeg -i concat:"$(ls -1 | tr '\n' '|')" -c:a aac -c:v h264_nvenc -b:v 5M output.mp4

Нет комментариев »

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Облачная платформа
Яндекс.Метрика

Fortune cookie: The cruelest of creatures' the crab With claws that can pinch you or stab, And then when you dine On crab and white wine It gets you as well with the tab.