Skip to content

feat(playback): NVENC support for transcoding - #79

Merged
Quick104 merged 3 commits into
Silo-Server:mainfrom
thezak48:feat/nvenc
Jun 8, 2026
Merged

Quick104 merged 3 commits into
Silo-Server:mainfrom
thezak48:feat/nvenc

Conversation

@thezak48

@thezak48 thezak48 commented Jun 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • A new NVIDIA NVENC hardware acceleration option in Playback Settings
  • Added detection logic for NVIDIA GPUs, with preference for NVENC in auto-detection
  • Optional Docker Compose setup for Opt-In enabling of GPU transcoding

Validation

  • Updated tests to cover NVENC hardware acceleration, including argument generation and passthrough logic

Notes

  • Added docker-compose.nvidia.yml for easy NVIDIA GPU support in Docker Compose, with relevant environment variables and override instructions.
  • Updated .env.example and README.md to document how to enable and configure NVIDIA GPU support via Docker Compose and environment variables.

These changes make it much easier for users with NVIDIA GPUs to take advantage of hardware-accelerated video transcoding, both in Docker and native deployments.

AI Use

Github Copilot used to help with detection logic and tests

Summary by CodeRabbit

  • New Features

    • NVIDIA NVENC added as a selectable hardware-acceleration option and supported in transcodes.
  • Documentation

    • Docs and example env updated with an Optional NVIDIA/NVENC section and Docker Compose override plus configurable GPU count.
  • Improvements

    • Hardware-acceleration detection now prefers NVIDIA when available and considers the configured FFmpeg binary.
  • Tests

    • New and expanded tests covering GPU/NVENC detection and NVENC transcode argument behavior.

Copilot AI review requested due to automatic review settings June 7, 2026 23:29
@coderabbitai

coderabbitai Bot commented Jun 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@thezak48, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 54 minutes and 55 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 79effc60-d163-42c3-9e80-0b647bb43d66

📥 Commits

Reviewing files that changed from the base of the PR and between 39ff009672b0687b1ee9e00b25c00aee453474c0 and d0a6de8.

📒 Files selected for processing (2)
  • internal/playback/gpudetect.go
  • internal/playback/gpudetect_test.go
📝 Walkthrough

Walkthrough

Adds optional NVIDIA NVENC support: docker-compose override and .env controls, sysfs and /dev-based NVIDIA detection in ResolveHWAccel("auto"), FFmpeg NVENC probing and caching, NVENC transcode pipeline integration and tests, and admin UI/handler wiring to expose NVENC.

Changes

NVIDIA NVENC Hardware Acceleration

Layer / File(s) Summary
Docker Compose and Environment Configuration
.env.example, README.md, docker-compose.nvidia.yml
Introduces an optional docker-compose.nvidia.yml override with runtime: nvidia and GPU reservations controlled via NVIDIA_GPU_COUNT. .env.example and README document enabling the override manually or via COMPOSE_FILE.
GPU detection and FFmpeg-aware resolution
internal/playback/gpudetect.go
Adds FFmpeg-path-aware detection APIs (DetectHWAccelWithFFmpeg, ResolveHWAccelWithFFmpeg), NVENC probe caching, sysfs and /dev-based NVIDIA checks, and new auto selection order using NVENC probe then QSV then VAAPI.
GPU detection tests
internal/playback/gpudetect_test.go
Adds tests and fake-ffmpeg helpers to validate auto preference ordering, explicit nvenc behavior, NVENC probe requirements, and probe-result caching by ffmpeg path.
FFmpeg NVENC transcode integration
internal/playback/transcode.go
Extends transcode argument building to support NVENC/CUDA (-hwaccel cuda, -hwaccel_output_format cuda), CUDA scaling (scale_cuda), NVENC encoders (h264_nvenc/hevc_nvenc) with rate-control flag variants, GOP/keyframe handling, and subtitle burn-in for CUDA path.
Transcode argument tests
internal/playback/transcode_args_test.go
Expands encoder-blacklist checks for copy modes; adds cases ensuring HWAccel: "nvenc" remains effective for passthrough h264; adds TestBuildFFmpegArgs_NVENCH264UsesCudaPipeline.
API handlers and node wiring
internal/api/handlers/system.go, internal/api/router.go, internal/transcodenode/server.go
Propagates configured FFmpegPath through router and handler constructors and uses it when detecting local node HW capabilities.
Web UI Hardware Acceleration Selection
web/src/pages/admin-settings/PlaybackSettings.tsx
Adds nvenc to the hardware acceleration select options and updates the resolved label to "NVIDIA NVENC".

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.56% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat(playback): NVENC support for transcoding' directly and clearly summarizes the primary change—adding NVIDIA NVENC hardware acceleration support for video transcoding, which is the main feature across all modified files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds NVIDIA NVENC as a supported hardware-accelerated transcoding option across the UI, backend FFmpeg argument builder, GPU auto-detection, and Docker deployment docs.

Changes:

  • Added NVENC option to admin playback settings UI and display formatting.
  • Implemented NVENC/CUDA pipeline support in transcoding args + GPU auto-detection, with new/updated unit tests.
  • Added an optional NVIDIA-specific Docker Compose override and documented .env/Compose usage.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
web/src/pages/admin-settings/PlaybackSettings.tsx Exposes NVENC in HW accel dropdown and resolved-label formatting.
internal/playback/transcode_args_test.go Extends encoder exclusion lists and adds NVENC pipeline test coverage.
internal/playback/transcode.go Adds NVENC HW accel args, encoders, scaling + subtitle burn-in handling.
internal/playback/gpudetect.go Updates auto-detection preference order and adds NVIDIA detection helpers.
docker-compose.nvidia.yml Introduces an override compose file intended to enable NVIDIA GPU access.
README.md Documents how to enable the NVIDIA compose override.
.env.example Adds example/knobs for layering compose files and NVIDIA GPU count.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docker-compose.nvidia.yml
Comment on lines +1 to +10
services:
silo:
runtime: nvidia
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: ${NVIDIA_GPU_COUNT:-1}
capabilities: [gpu]
Comment on lines +42 to 43
HWAccel string // auto, qsv, vaapi, nvenc, none
HWDevice string // e.g., /dev/dri/renderD128 (default if empty)
Comment on lines +718 to +735
func nvencScaleFilter(res string) string {
switch res {
case "2160p":
return "scale_cuda=w=-2:h=2160:format=nv12"
case "1080p":
return "scale_cuda=w=-2:h=1080:format=nv12"
case "720p":
return "scale_cuda=w=-2:h=720:format=nv12"
case "480p":
return "scale_cuda=w=-2:h=480:format=nv12"
case "420p":
return "scale_cuda=w=-2:h=420:format=nv12"
case "328p":
return "scale_cuda=w=-2:h=328:format=nv12"
default:
return "scale_cuda=format=nv12"
}
}

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/playback/gpudetect.go`:
- Around line 89-92: ResolveHWAccel currently returns "nvenc" when
hasNVIDIADevice() is true without probing ffmpeg; update ResolveHWAccel to run a
cached ffmpeg capability probe (e.g., check ffmpeg -encoders for
h264_nvenc/hevc_nvenc and ffmpeg -hwaccels for cuda, or perform a tiny smoke
transcode) before returning "nvenc", and when the probe fails return "none"
instead; reuse/introduce a short-lived cached result so repeated calls from the
transcode pipeline (transcode.go) use the cached probe outcome and avoid
unhandled ffmpeg failures.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ab5089be-d91a-461b-ab65-391cd567f9c5

📥 Commits

Reviewing files that changed from the base of the PR and between 0c5ec1f34bbf0c26bdba6e248b80c4f1e3e30c13 and f4c3f4f57683f624a89c93b32b4b5d43fdea39ed.

📒 Files selected for processing (7)
  • .env.example
  • README.md
  • docker-compose.nvidia.yml
  • internal/playback/gpudetect.go
  • internal/playback/transcode.go
  • internal/playback/transcode_args_test.go
  • web/src/pages/admin-settings/PlaybackSettings.tsx

Comment thread internal/playback/gpudetect.go Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.env.example (1)

4-6: ⚡ Quick win

Document Windows syntax for COMPOSE_FILE.

The colon separator works on Linux and macOS, but Windows requires a semicolon separator. Consider adding a Windows example or note to prevent user errors on that platform.

📝 Suggested documentation addition
 # Optional: layer compose files through env. Leave unset for CPU-only defaults.
 # Linux/macOS example for enabling NVIDIA override:
 # COMPOSE_FILE=docker-compose.yml:docker-compose.nvidia.yml
+# Windows example:
+# COMPOSE_FILE=docker-compose.yml;docker-compose.nvidia.yml
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.env.example around lines 4 - 6, Add a Windows-specific example/note for the
COMPOSE_FILE env var so users know to use a semicolon separator on Windows;
update the .env.example text around the COMPOSE_FILE comment to include a
Windows example like "COMPOSE_FILE=docker-compose.yml;docker-compose.nvidia.yml"
or an explicit note stating "Windows uses ';' instead of ':'". Ensure the new
line references the COMPOSE_FILE variable so readers on Windows won't mistakenly
use the colon-separated syntax shown for Linux/macOS.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.env.example:
- Around line 4-6: Add a Windows-specific example/note for the COMPOSE_FILE env
var so users know to use a semicolon separator on Windows; update the
.env.example text around the COMPOSE_FILE comment to include a Windows example
like "COMPOSE_FILE=docker-compose.yml;docker-compose.nvidia.yml" or an explicit
note stating "Windows uses ';' instead of ':'". Ensure the new line references
the COMPOSE_FILE variable so readers on Windows won't mistakenly use the
colon-separated syntax shown for Linux/macOS.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 852f45dd-ebcd-430b-a304-68022267abfc

📥 Commits

Reviewing files that changed from the base of the PR and between f4c3f4f57683f624a89c93b32b4b5d43fdea39ed and e1e4c9856960b0322943012bfd713f6cdb11dad1.

📒 Files selected for processing (3)
  • .env.example
  • README.md
  • docker-compose.nvidia.yml

@Quick104
Quick104 merged commit c7963e9 into Silo-Server:main Jun 8, 2026
1 check passed
@thezak48
thezak48 deleted the feat/nvenc branch June 8, 2026 01:30
Quick104 added a commit that referenced this pull request Jun 11, 2026
* feat(playback): NVENC support for transcoding

* fix(playback): probe nvenc before auto-selecting

* fix(playback): use safe NVENC smoke probe dimensions

---------

Co-authored-by: Quick <[email protected]>
Quick104 added a commit that referenced this pull request Jun 17, 2026
* feat(playback): NVENC support for transcoding

* fix(playback): probe nvenc before auto-selecting

* fix(playback): use safe NVENC smoke probe dimensions

---------

Co-authored-by: Quick <[email protected]>
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.

3 participants