Building FFmpeg on Windows 10 with Visual Studio 2019 with support for NVidia hardware acceleration for encoding and decoding

NVidia publishes instructions for building FFmpeg here. Yes, you will need to create an account to get the instructions (and the CUDA SDK).

Open visual studio x64 native tools command prompt.

Instead of running export PATH=... in the msys2 terminal I had to update the INCLUDE and LIB environment variables before starting the msys2 terminal.

set INCLUDE=E:\SrcCode\Repos\nv_sdk;%INCLUDE%

set LIB=E:\SrcCode\Repos\nv_sdk;%LIB%

I then used the following command to start the msys2 terminal:

msys2_shell.cmd -msys2 -full-path -where e:\SrcCode\Repos

You should replace e:\SrcCode\Repos with the directory from which you cloned  FFmpeg (see NVidia's building FFmpeg instructions here).

NOTE: The instructions say to install pkg-config with pacman. If you have already installed pkgconf then you can't install pkg-conf (it is not needed).

This will open an msys2 terminal in which you can build ffmpeg. I used the following command:

./configure --enable-nonfree --enable-cuda-nvcc --enable-libnpp --toolchain=msvc

If there are errors, check the log file. The log file will be stored, from the directory into which you cloned FFmpeg, in ffbuild/configure.log (e.g., /e/SrcCode/Repos/FFmpeg/ffbuild/configure.log).

Addendum

To list installed packages from an msys2 terminal:

pacman -S -l

To install yasm.exe from an msys2 terminal:

pacman -S yasm

The video editor I use can't use hardware acceleration with the latest NVidia drivers. So I installed older ones (version 375_63WHQL)


No comments:

Post a Comment