Installing nvcc on Devuan to enable NVENC for hardware encoding
Hello, I'm incompetent.
Using the above, which is a Nextcloud app, was so convenient, and since hardware encoding can also be enabled, I decided to install it on this occasion.
https://developers.play.jp/entry/2022/11/18/181357#NVIDIA-のドライバーをインストール
Referring to this site, I will install the latest version as much as possible.
Install necessary packages
sudo apt install autoconf automake bzip2 libbz2-dev cmake libfreetype6-dev gcc g++ git libtool make pkg-config zlib1g-dev nasm
Create directories
mkdir bin ffmpeg_build ffmpeg_sources
To install it as a test, so that I can revert it at any time, I decided to put it in a general user's home directory.
Move directories, and save the latest nv-codec-headers with wget, extract it, and build it.
Then, save the ffmpeg source code.
cd ~/ffmpeg_sources/
wget https://github.com/FFmpeg/nv-codec-headers/releases/download/n12.2.72.0/nv-codec-headers-12.2.72.0.tar.gz
ls -la
tar xf nv-codec-headers-12.2.72.0.tar.gz
ls -la
cd nv-codec-headers-12.2.72.0
make PREFIX=$HOME/ffmpeg_build
make install PREFIX=$HOME/ffmpeg_build
cd ..
wget https://ffmpeg.org/releases/ffmpeg-7.0.1.tar.gz
ls -la
tar xf ffmpeg-7.0.1.tar.gz
ls -la
Then, install nvidia-cuda-toolkit. Just in case, I'm deleting anything that's already installed midway.
wget https://developer.download.nvidia.com/compute/cuda/12.5.0/local_installers/cuda_12.5.0_555.42.02_linux.run
ls -la
sudo apt remove nvidia-cuda-toolkit
ls -la
chmod +x cuda_12.5.0_555.42.02_linux.run
sudo ./cuda_12.5.0_555.42.02_linux.run --silent --override --toolkit --no-opengl-libs
nvcc -V
At this point, I check if the path is set, and since it's not, I'll add it to /etc/profile.
which nvcc
export PATH="/usr/local/cuda/bin:${PATH}"
which nvcc
sudo ldconfig
sudo vim /etc/profile
I added it as follows.
In the image, the destination where the final executable exists has already been added, but...
The reason why I didn't specify it with $HOME is that it applies to everything, so if it's root, it will look in /home/root/bin, so I'm putting it in for the current execution user.
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "$(id -u)" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
export PATH
export PATH="/usr/local/cuda/bin:${PATH}"
export PATH="/home/haturatu/bin:${PATH}"
~~~~
After that, I will perform the build process.
Check inside the library midway.
cd nv-codec-headers-12.2.72.0
make PREFIX=$HOME/ffmpeg_build
make install PREFIX=$HOME/ffmpeg_build
cd ~/ffmpeg_sources
ls -la
cd ffmpeg-7.0.1
ls -la /usr/local/cuda/include
ls -la /usr/local/cuda/lib64
CFLAGS="-O3 -I/usr/local/cuda/include" LDFLAGS="-L/usr/local/cuda/lib64" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --pkg-config-flags="--static" --bindir="$HOME/bin" --enable-nonfree --enable-gpl --enable-cuda-nvcc --enable-libnpp --disable-debug --disable-doc --enable-static
make -j 8
make install
This is done, but the path is not yet pointing to the new executable location.
ffmpeg
ls ../bin
cd ~
ls bin
./bin/ffmpeg
which ffmpeg
ls bin
Specify the path.
export PATH="/home/haturatu/bin:${PATH}"
which ffmpeg
sudo vim /etc/profile
#↑Here, I added the PATH for the aforementioned part.
This concludes it.
Since hardware encoding can now be successfully performed with ffmpeg, I checked it from the Nextcloud side as well, and it became comfortable to a level where I could clearly feel the difference... or so it seems!?
Since I have each executable, if I have time, I'll try to take an encoding benchmark. See you next time.