Repository navigation
feat(playback): NVENC support for transcoding - #79
Conversation
|
Warning Review limit reached
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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 39ff009672b0687b1ee9e00b25c00aee453474c0 and d0a6de8. 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds 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. ChangesNVIDIA NVENC Hardware Acceleration
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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.
| services: | ||
| silo: | ||
| runtime: nvidia | ||
| deploy: | ||
| resources: | ||
| reservations: | ||
| devices: | ||
| - driver: nvidia | ||
| count: ${NVIDIA_GPU_COUNT:-1} | ||
| capabilities: [gpu] |
| HWAccel string // auto, qsv, vaapi, nvenc, none | ||
| HWDevice string // e.g., /dev/dri/renderD128 (default if empty) |
| 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" | ||
| } | ||
| } |
There was a problem hiding this comment.
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.exampleREADME.mddocker-compose.nvidia.ymlinternal/playback/gpudetect.gointernal/playback/transcode.gointernal/playback/transcode_args_test.goweb/src/pages/admin-settings/PlaybackSettings.tsx
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.env.example (1)
4-6: ⚡ Quick winDocument 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.exampleREADME.mddocker-compose.nvidia.yml
* 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]>
* 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]>
Summary
Validation
Notes
docker-compose.nvidia.ymlfor easy NVIDIA GPU support in Docker Compose, with relevant environment variables and override instructions..env.exampleandREADME.mdto 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
Documentation
Improvements
Tests