Skip to content

feat(webrtc-sys): enable NVENC hardware encoding on Windows#991

Closed
sionzee wants to merge 1 commit intolivekit:mainfrom
evobug-com:nvenc-windows
Closed

feat(webrtc-sys): enable NVENC hardware encoding on Windows#991
sionzee wants to merge 1 commit intolivekit:mainfrom
evobug-com:nvenc-windows

Conversation

@sionzee
Copy link
Copy Markdown

@sionzee sionzee commented Apr 4, 2026

// accidentally opened PR

The NVIDIA NVENC encoder code already exists in webrtc-sys (h264/h265 encoder impls, cuda_context with Windows LoadLibrary support, NvCodec SDK) but was only compiled on Linux. This enables it on Windows too.

Requires CUDA Toolkit headers at build time (set CUDA_HOME or use default install path). At runtime, loads nvcuda.dll from the GPU driver.

The VideoEncoderFactory composite pattern automatically tries NVIDIA first, falling back to software encoders if CUDA is unavailable.

The NVIDIA NVENC encoder code already exists in webrtc-sys (h264/h265
encoder impls, cuda_context with Windows LoadLibrary support, NvCodec SDK)
but was only compiled on Linux. This enables it on Windows too.

Requires CUDA Toolkit headers at build time (set CUDA_HOME or use default
install path). At runtime, loads nvcuda.dll from the GPU driver.

The VideoEncoderFactory composite pattern automatically tries NVIDIA first,
falling back to software encoders if CUDA is unavailable.
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 39a211f71a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +172 to +174
.file("src/nvidia/NvCodec/NvCodec/NvDecoder/NvDecoder.cpp")
.file("src/nvidia/NvCodec/NvCodec/NvEncoder/NvEncoder.cpp")
.file("src/nvidia/NvCodec/NvCodec/NvEncoder/NvEncoderCuda.cpp")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Link CUDA/NVCUVID symbols for Windows NVENC build

When cuda.h is found on Windows, this block compiles NvDecoder.cpp/NvEncoder*.cpp and enables USE_NVIDIA_VIDEO_CODEC, but the Windows path never adds equivalent symbol resolution for CUDA/NVDEC (nvcuda/nvcuvid) while the Linux path explicitly wires lazy-load stubs via add_lazy_load_so(..., ["cuda", "nvcuvid"]). In CUDA-enabled Windows builds this can surface as unresolved external symbols for cu*/cuvid* during final linking, so the feature being enabled here may fail to build unless explicit Windows linking or lazy-load shims are added.

Useful? React with 👍 / 👎.

@sionzee sionzee closed this Apr 4, 2026
@sionzee sionzee deleted the nvenc-windows branch April 4, 2026 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants