Skip to content

Instantly share code, notes, and snippets.

@Alyetama
Last active February 11, 2022 14:40
Show Gist options
  • Save Alyetama/d07c8048820511e31b2300aa7953eda9 to your computer and use it in GitHub Desktop.
Save Alyetama/d07c8048820511e31b2300aa7953eda9 to your computer and use it in GitHub Desktop.
Install NVIDIA video codec SDK for ffmpeg
#!/bin/sh
# Check if this CUDA version is compatibile with your setup before running. If not, replace the links accordingly
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.6.0/local_installers/cuda-repo-ubuntu2004-11-6-local_11.6.0-510.39.01-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-6-local_11.6.0-510.39.01-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-6-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
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/
sudo apt-get install build-essential yasm cmake libtool libc6 libc6-dev unzip wget libnuma1 libnuma-dev -y
cd ffmpeg
./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
make -j 8
sudo make install
echo ">>> Usage: ffmpeg -hwaccel cuda -i input.file output.file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment