Installation ============ From PyPI --------- .. code-block:: pip install spdl From source ----------- To install SPDL, you need ``uv``. Please check out `the official documentation `_ for the installation instruction. The following command will build and install ``spdl`` Python package. .. code-block:: uv pip install . -v .. note:: Make sure to use ``-v`` to see the log from the actual build process. The build front end by defaults hide the log of build process. The build process first downloads/builds/installs some third-party dependencies, then it builds SPDL and its binding code. Build can be customized through the environment variables; - ``SPDL_USE_CUDA=1``: Enable CUDA integration, such as background data transfer. - ``SPDL_USE_NVCODEC=1``: Enable `NVIDIA VIDEO CODEC `_ integration, i.e. GPU video decoder and direct CUDA memory placement - ``SPDL_USE_TRACING=1``: Enable `Perfetto `_ integration for performance profiling. - ``SPDL_USE_FFMPEG_VERSION``: Specify the version of FFmpeg you want to use to reduce the build time. By default, SPDL compiles against FFmpeg 4, 5, 6 and 7, and pick available one at run time. See `setup.py `_ for the up-to-date available options. To rebuild the extension module of SPDL IO, you can do the following. .. code-block:: uv pip uninstall spdl_io uv pip install -v --no-cache --refresh --upgrade . Requirements ------------ * Supported OS: Linux, macOS * Build requirements - C++20 compiler (Tested on GCC 11 and Clang 15) - CMake, Ninja - (Optional) CUDA Toolkit * Runtime Requirements and dependencies - Python 3.10+ - NumPy - (Optional) PyTorch - (Optional) Numba - (Optional) Jax - (Optional) CUDA runtime Dependencies ------------ The libspdl uses the following third party libraries, which are fetched and built automatically during the build process. * `{fmt} `_ (`MIT `_) * `gflags `_ (`BSD-3 `_) * `glog `_ (`BSD-3 `_) * `libzip `_ (`BSD-3 `_) and its dependency `zlib `_ (`Zlib `_) * `nanobind `_ (`BSD-3 `_) and its dependency `robin-map `_ (`MIT `_) * `FFmpeg `_ (`LGPL `_ †) .. note:: **†** FFmpeg is a dual-licensed software. One can choose LGPL or GPL. When building ``libspdl``, pre-built LGPL version of FFmpeg library files are downloaded and linked against ``libspdl``. These FFmpeg library files are compiled in a way that no GPL component is used and runtime search path is not hard-coded. Therefore, the resulting ``libspdl`` is not obliged to be GPL, and users can (need to) provide own FFmpeg library files. Users are free to dynamically link GPL or non-distributable version of FFmpeg libraries. However, please note that linking a non-LGPL binary might change the condition for redistribution of your application. Optional Dependencies --------------------- * `Perfetto `_ (`Apache 2.0 `_) * `CUDA Toolkit `_ †† (`CUDA Toolkit EULA `_) and the following family of libraries covered by the same EULA * `nvJPEG `_ * `NPP `_ * The header files of `Video Codec SDK `_ †† The header files of video codec SDK (``nvcuvid.h`` and ``cuviddec.h``), which are distributed under MIT license, is used when compiling SPDL with hardware video decoder enabled. .. note:: **††** This software contains source code provided by NVIDIA Corporation. Building with Free-Threaded Python ---------------------------------- To build SPDL with Free-Threaded Python, the following manual changes are required. We intend to incorporate these changes in build process, once Python 3.13 and FT-aware nanobind is released. 1. Add ``FREE_THREADED`` to ``nanobind_add_module``. Please refer to `the doc `_.