Hi,
I’ve followed this guide to install cuda-nvcc and libnpp with ffmpeg.
I’m on Windows 10, running msys2 and mingw64, with a GTX 1080.
This guide is outdated for me, on certain parts at least.
This reply is my attempt to help others to compile, with a couple of questions at the end.
Corrections to the compilation guide:
-
the path to the bin folder of the NVIDIA GPU Computing Toolkit is directly added to the path as you can see it in the Environement variables when installating it:
-
the path to the Visual studio 12 might be correct but not for Visual studio 2019:
export PATH="/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64":$PATH
Btw is it still relevant to have a guide which uses Microsoft Visual Studio 12.0 for windows?
- As pointed out in the commonly faced issues and tips to resolve them, i am running mingw64 :
Open the x64 Native Tools Command Prompt for VS 2017
:
cd C:\dev\msys64
msys2_shell.cmd -mingw64 -use-full-path
And also passing the correct flags corresponding to my graphic card to nvcc :
--nvccflags="-gencode arch=compute_52,code=sm_52 -O2"
I have also passed the extra --extra-ldflags to the linker like this : --extra-ldflags=-libpath:"PathToStuff"
( as pointed here too).
- I have renamed the mingw64 linker to avoid confusion with MSVC linker :
mv /usr/bin/link.exe /usr/bin/link.exe.bak
# then
which link
#gives me
/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/link
- ('ve copied the content of the folders:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.5\include
to C:\dev\msys64\ThirdParty\ffmpeg\nv_sdk\include
and
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.5\lib\x64
to C:\dev\msys64\ThirdParty\ffmpeg\nv_sdk\lib
Using 1) to 5), I’ve configured FFmpeg version 4.3.3 with the following:
Open the x64 Native Tools Command Prompt for VS 2017
:
cd C:\dev\msys64
msys2_shell.cmd -mingw64 -use-full-path
In the mingw64 shell :
cd /ThirdParty/ffmpeg/FFmpeg-n4.3.3
./configure \
--toolchain=msvc \
--prefix="/ThirdParty/ffmpeg/ffmpeg_build" \
--target-os=mingw64 \
--arch=x86_64 \
--extra-ldflags=-libpath:"/ThirdParty/ffmpeg/nv_sdk/lib" \
--extra-cflags=-I"/ThirdParty/ffmpeg/nv_sdk/include" \
--nvccflags="-gencode arch=compute_52,code=sm_52 -O2" \
--toolchain=msvc \
--enable-cuda-nvcc \
--enable-libnpp \
--enable-shared \
--enable-avresample \
--pkg-config=pkg-config \
--disable-debug \
--disable-w32threads \
--enable-dxva2 \
--enable-d3d11va \
--enable-nonfree \
--enable-gpl \
--disable-doc \
--logfile=config.log
How can I compile FFmpeg with more flags such as those:
--enable-libopencore_amrwb \
--enable-libopenjpeg \
--enable-libopus \
--enable-librtmp \
--enable-libsoxr \
--enable-libspeex \
--enable-libsrt \
--enable-libtheora \
--enable-libvorbis \
--enable-libx264 \
--enable-libx265 \
--enable-libxvid \
--enable-libvpx \
--enable-libwebp \
--enable-libxml2 \
--enable-openal \
--enable-pic \
--enable-postproc \
--enable-runtime-cpudetect \
--enable-swresample \
--enable-version3 \
--enable-vulkan \
--enable-zlib \
Is using msvc
it seems like it’s not possible to include them straight.
Do I need to recompile them individually?
Best,
P