This repo contains bindings for the NVENC library. The current bindings target mainly encoding workflows, decoding might be added later (PR welcomed).
The bindings are pre generated using bindgen with some extra regexes for some macros and static declarations.
This crate also exposes bindings for a very small subset of Nvidia's CUDA driver library, only the necessary functions/structures/enum to interact with the encoder as a straightforward way to load a stream of surfaces and encode them and to interop with Vulkan is covered.
The bindings are generated using bindgen which depends on a libclang. Bindgen by default looks for it in these folders on windows:
- C:\LLVM
- C:\Program Files*\LLVM
- C:\MSYS*\MinGW*
- C:\Program Files*\Microsoft Visual Studio\*\BuildTools\VC\Tools\Llvm
Otherwise you can manually set LIBCLANG_PATH environment variable to point to libclang.dll, or use the legion-labs scoop bucket to install llvm:
scoop install llvm
If the cuda feature is enabled (allows decoding), you need to install the CUDA Toolkit. Or on windows
scoop install cuda
On linux you can follow the installation guide depending on your distribution for llvm and cuda.
Use the use-bindgen
feature to use dynamically generated bindings. To regenerate the bundled bindings set the LOCAL_COPY
environment variable along with the use-bindgen
feature.
To run some basic loading tests cargo test [--features=cuda] -- --ignored
, you need to have an Nvidia graphic card with hardware encoding capabilities and proper drivers to pass the tests (refer to Nvidia's documentation for support matrix).
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Refer to License agreement for the use of the NVENC library. And you should check the End User License Agreement, which describes NVIDIA Software License Agreement and CUDA Supplement to Software License Agreement.
The library bundles the nvEncodeAPI.h header file from the NVENC SDK, please refer to the copyright notice at the top of the file for further information about the header distribution.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.