Enable NVENC for FFMPEG

Based on this Article: https://www.cyberciti.biz/faq/how-to-install-ffmpeg-with-nvidia-gpu-acceleration-on-linux/

To enable NVENC to use the h264_nvenc encoder for example you have to compile ffmpeg yourself.

Requirements: You have installed the standard Nvidia drivers.

Use nvidia-detect to find the right driver for you.

If you want cuda support aswell install the nvidia-cuda-toolkit

Create a compilation directory:

mkdir ~/nvidia/ && cd ~/nvidia/
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git

Compile the missing headers (ffnvcodec):

cd nv-codec-headers && sudo make install

Download FFMPEG Source Code:

cd ~/nvidia/
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg/`

Install the compilation tools:

sudo apt install build-essential yasm cmake libtool libc6 libc6-dev unzip wget libnuma1 libnuma-dev`

Configure FFMPEG to compile with nvenc and cuda enabled. (You can remove the cuda flags if you only need nvenc):

PKG_CONFIG_PATH="~/nvidia/nv-codec-headers" ./configure --enable-nonfree --enable-cuda-nvcc --enable-cuda-llvm --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 

Compile FFMPEG:

make -j $(nproc)

Now there should be a executeable created:

ls -l ffmpels -l ffmpe`g
./ffmpeg

If you want you can install this executable:

make install

Now you can use cuda hardware acceleration and the nvenc codec

Update:

Or just grab the latest release from Jellyfin ffmpeg:

Releases · jellyfin/jellyfin-ffmpeg
FFmpeg for Jellyfin. Contribute to jellyfin/jellyfin-ffmpeg development by creating an account on GitHub.
Impressum/Legal Disclosure Datenschutzerklärung/Privacy Policy Firefish