windowsffmpegcudanvenc

ffmpeg ERROR: libnpp not found in windows


I`m trying to compile ffmpeg in windows with nvidia libraries for hardware acceleration using MinGW/msys. tried to follow the instruction on nvidias website (section: Getting Started with FFmpeg/libav using NVIDIA GPUs). configured with --enable-nonfree --disable-shared --enable-nvenc --enable-cuda --enable-cuvid --enable-libnpp --extra-cflags=-Ilocal/include --extra-cflags=-I../common/inc --extra-ldflags=-L../common/lib/x64 --prefix=ffmpeg but stopped at "ERROR: libnpp not found." where common folder is downloaded from NVIDIA Video Codec SDK but there is no npp libs or header files. is there any solution for that? thanks for edvice.


Solution

  • I managed to successfuly cross compile ffmpeg under linux targeting Windows 64 bit with --enable-libnpp included.

    My environment is Ubuntu Server 16.10 64bit.
    After a fresh installation I installed MinGW using the command:

    sudo apt-get install mingw-w64
    

    First I successfully compiled the Linux version with the --enable-libnpp option activated following the instructions on the NVIDIA dev site Compile Ffmpeg with NVIDIA Video Codec SDK.
    In order to do that you need to install the CUDA Toolkit. Just follow the instructions and the package installer will create the symbolic links (I have the CUDA Toolkit 8.0):

    /usr/local/cuda/include/ -> /usr/local/cuda-8.0/targets/x86_64-linux/include
    /usr/local/cuda/lib64/ -> /usr/local/cuda-8.0/targets/x86_64-linux/lib

    This should provide Configure the right path to find the correct libraries and headers.
    The command line I have used to compile the linux version of ffmpeg is:

    ./configure --enable-nonfree --disable-shared --enable-nvenc --enable-cuda --enable-cuvid --enable-libnpp --extra-cflags=-I/usr/local/cuda/include/ --extra-ldflags=-L/usr/local/cuda/lib64/
    

    The problem you got is that when using cross-compilation you need to provide Configure the right path where to find headers and library for the Windows version of the libnpp library.
    From the CUDA Toolkit Download page mentioned above I simply downloaded the exe(local) version of the Windows package.
    Under the root of my working folder I created a folder called tmp where I copied the subfolders I found under npp_dev inside the package cuda_8.0.61_win10.exe:

    cuda_8.0.61_win10.exe\npp_dev\lib -> tmp/lib  
    cuda_8.0.61_win10.exe\npp_dev\include -> tmp/include
    

    As final step I launched Configure once again using the following parameters:

    ./configure --arch=x86_64 --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32- --pkg-config=pkg-config --enable-nonfree --disable-shared --enable-nvenc --enable-cuda --enable-cuvid --enable-libnpp --extra-cflags=-I/usr/local/include --extra-cflags=-I/usr/local/cuda/include/ --extra-ldflags=-L/usr/local/cuda/lib64/ --extra-cflags=-I../tmp/include/ --extra-ldflags=-L../tmp/lib/x64/
    

    The compilation completed successully. When I copied the ffmpeg.exe file to Windows and tried to execute it I got an errore message saying the executable was missing some npp_*.dll.
    From the package cuda_8.0.61_win10.exe I copied all the dlls included into the folder npp\bin to the same directory I put ffmpeg.exe.
    After that the application run normally and a simple conversion from a 4K file completed as expected.