Skip to content

Building from source

vcdev edited this page Apr 26, 2023 · 23 revisions

Build process is same both for Windows & Linux.

Building VPF from source

  • Please see README.md for build instructions. If you're facing any troubles with the installation feel free to open an issue!

Investigating build failures

The following steps can help to debug common build problems

  • Run pip install . --verbose in the repository root to get more verbose output about the compilation
  • If pip install . --verbose fails, you can use cmake-gui/cmake-gui.exe on the generated _skbuild folder to inspect CMake cache variables. CMake cache variables can be set during a pip build can be passed using the following environment variables: https://scikit-build.readthedocs.io/en/latest/usage.html#environment-variable-configuration
  • If the CUDA Toolkit can't be found, please check that nvcc/nvcc.exe are in your $PATH environment variable
  • If FFmpeg can't be found please check that you specified, please check that you've set TC_FFMPEG_ROOT via the environment variable SKBUILD_CONFIGURE_OPTIONS="-DTC_FFMPEG_ROOT=C:/path/to/your/ffmpeg/installation/ffmpeg/". On Linux, PKG_CONFIG_PATH environment variable can be used to indicate pkg-config (needs to be installed) where FFmpeg is installed (e.g. https://github.com/NVIDIA/VideoProcessingFramework/blob/ec8caf75c341b9f4a125db59676c6742c8b666fd/docker/Dockerfile.gpu#L51). Also check that your FFmpeg installation has the required header and DLL/LIB files on Windows or *.so files on Linux.

The following steps can help to debug common problems at runtime

  • If the native extension fails to load, please use ldd on Linux or dumpbin /dependents in a Visual Studio Native Tools Command Prompt to analyze missing dependencies. Missing shared libraries paths can be added to PATH environment variable on Windows and LD_LOAD_PATH/LD_LIBRARY_PATHon Linux. Note that on Windows, the pip installer will copy required DLLs to the pip install location so that all needed DLLs should be already discoverable by Python. On Linux, this step is not performed. Please make sure that ffmpeg shared libraries are in your LD_LOAD_PATH/LD_LIBRARY_PATH

  • VPF includes the interface headers of Video Codec SDK 12.0. This implies a certain driver requirement. If you need to use the interface headers of an older Video SDK, please use TC_VIDEO_CODEC_INTERFACE_DIR to indicate the location of the alternative interface headers of the older Video Codec SDK.

Building FFmpeg from source

Detailed instructions can be found at https://trac.ffmpeg.org/wiki/CompilationGuide.

On Ubuntu, ffmpeg can be configured and compiled using the following to produce shared libraries needed by VPF. On Windows, we recommend either cross-compiling on WSL or downloading binary distributions.

git clone https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg

mkdir -p $(pwd)/build_x64_release_shared 
./configure \
 --prefix=$(pwd)/build_x64_release_shared \
 --disable-static \
 --disable-stripping \
 --disable-doc \
 --enable-shared
 
make -j -s && make install

In order to use the compiled FFmepg for VPF, please make sure the library install location is included in your LD_LOAD_PATH/LD_LIBRARY_PATH.