All-Intra HEVC (NVENC) growing-file ingest #161

Open
zgaetano wants to merge 0 commits from feat/nvenc-hevc-ingest into main
Owner

Summary

Adds GPU-accelerated All-Intra HEVC (NVENC) as an opt-in capture/master codec for growing-file edit-while-record, offloading the ingest encode from CPU to the L4.

This change is additive — the default recorder codec stays prores_hq; hevc_nvenc is selected per-recorder.

Changes

  • node-agent (handleSidecarStart): accepts useGpu; attaches NVIDIA runtime + DeviceRequests + NVIDIA_VISIBLE_DEVICES/DRIVER_CAPABILITIES when set. No-op for CPU codecs.
  • mam-api (recorders start): derives useGpu from recording_codec (hevc_nvenc/h264_nvenc); passes it to remote sidecar + local docker spawn.
  • capture (capture-manager): validated all-intra HEVC config — -bf 0 -forced-idr 1 -g 600 -force_key_frames expr:1 -profile:v main10 (NVENC rejects -g 1).
  • capture Dockerfile: nvenc-enabled ffmpeg build; removes --pkg-config-flags="--static" which broke x265 detection and prevented the image from building.

Validation (on L4, zampp2)

  • All-Intra HEVC NVENC encode — all frames I, 10-bit Main 10
  • Container = fragmented MOV works; MXF rejects HEVC (use frag-MOV)
  • Growing file decodable while being written (edit-while-record property)

Regression sweep (all green)

  • web GUI playback, upload capture, SRT capture, RTMP capture, SDI capture

Still pending before relying on HEVC for growing workflows

  • Human: confirm Premiere can edit the growing frag-MOV over SMB
  • NVENC HEVC is 4:2:0 only — 4:2:2 mezzanine workflows stay on ProRes/CPU

🤖 Generated with Claude Code

## Summary Adds GPU-accelerated **All-Intra HEVC (NVENC)** as an opt-in capture/master codec for growing-file edit-while-record, offloading the ingest encode from CPU to the L4. This change is **additive** — the default recorder codec stays `prores_hq`; `hevc_nvenc` is selected per-recorder. ## Changes - **node-agent** (`handleSidecarStart`): accepts `useGpu`; attaches NVIDIA runtime + `DeviceRequests` + `NVIDIA_VISIBLE_DEVICES`/`DRIVER_CAPABILITIES` when set. No-op for CPU codecs. - **mam-api** (`recorders` start): derives `useGpu` from `recording_codec` (`hevc_nvenc`/`h264_nvenc`); passes it to remote sidecar + local docker spawn. - **capture** (`capture-manager`): validated all-intra HEVC config — `-bf 0 -forced-idr 1 -g 600 -force_key_frames expr:1 -profile:v main10` (NVENC rejects `-g 1`). - **capture Dockerfile**: nvenc-enabled ffmpeg build; removes `--pkg-config-flags="--static"` which broke x265 detection and prevented the image from building. ## Validation (on L4, zampp2) - ✅ All-Intra HEVC NVENC encode — all frames `I`, 10-bit Main 10 - ✅ Container = fragmented MOV works; **MXF rejects HEVC** (use frag-MOV) - ✅ Growing file decodable while being written (edit-while-record property) ## Regression sweep (all green) - ✅ web GUI playback, ✅ upload capture, ✅ SRT capture, ✅ RTMP capture, ✅ SDI capture ## Still pending before relying on HEVC for growing workflows - ⏳ Human: confirm Premiere can edit the growing frag-MOV over SMB - NVENC HEVC is 4:2:0 only — 4:2:2 mezzanine workflows stay on ProRes/CPU 🤖 Generated with [Claude Code](https://claude.com/claude-code)
zgaetano added 3 commits 2026-05-29 14:02:54 -04:00
Phase 0.2 of the NVENC All-Intra HEVC ingest plan.

node-agent/handleSidecarStart:
- Accept useGpu: true in the sidecar start body
- When useGpu: adds Runtime=nvidia, DeviceRequests=[gpu], and injects
  NVIDIA_VISIBLE_DEVICES=all + NVIDIA_DRIVER_CAPABILITIES=video,compute,utility
  into the container env. CPU-codec recorders are unaffected (useGpu defaults false).

mam-api/recorders (start endpoint):
- Derive useGpu from recorder.recording_codec — true for hevc_nvenc/h264_nvenc
- Pass useGpu to remote sidecar start body
- Apply same Runtime/DeviceRequests to the local Docker spawn path

capture/capture-manager:
- Update hevc_nvenc codec entry with all-intra flags:
  -g 1 -bf 0 (every frame IDR, no B-frames — required for growing-file
  edit-while-record), -rc vbr, -profile:v main10, pixFmt p010le (10-bit 4:2:0)

Next: validation gate (§8) — test MXF OP1a then fragmented MOV on one
DeckLink channel, mount in Premiere while recording.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
NVENC rejects -g 1 ("GopLength > numBFrames+1" at InitializeEncoder), so
true all-intra is achieved with -bf 0 -forced-idr 1 -g 600 plus
-force_key_frames expr:1 (forces an IDR on every frame). ffprobe confirms
all frames are pict_type=I. Container is fragmented MOV; MXF muxing of HEVC
fails on this ffmpeg build ("Operation not permitted").

Validated end-to-end via direct ffmpeg on zampp2/L4:
hevc, Main 10, 1920x1080, yuv420p10le, ptypes=[IIIIII...]

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Brings the node-local NVENC ffmpeg build into the branch and fixes it:
- multi-stage build with nv-codec-headers + --enable-nvenc/--enable-cuvid
- removes --pkg-config-flags="--static", which broke x265 detection
  ("ERROR: x265 not found using pkg-config") and prevented the image from
  ever building. Shared linking is used; runtime stage already apt-installs
  the shared codec libs (libx265-199 etc).
- self-validating: build fails if nvenc encoders are absent.

Rebuilt image confirmed to expose hevc_nvenc/h264_nvenc/av1_nvenc on the L4.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This branch is already included in the target branch. There is nothing to merge.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/nvenc-hevc-ingest:feat/nvenc-hevc-ingest
git checkout feat/nvenc-hevc-ingest

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout main
git merge --no-ff feat/nvenc-hevc-ingest
git checkout feat/nvenc-hevc-ingest
git rebase main
git checkout main
git merge --ff-only feat/nvenc-hevc-ingest
git checkout feat/nvenc-hevc-ingest
git rebase main
git checkout main
git merge --no-ff feat/nvenc-hevc-ingest
git checkout main
git merge --squash feat/nvenc-hevc-ingest
git checkout main
git merge --ff-only feat/nvenc-hevc-ingest
git checkout main
git merge feat/nvenc-hevc-ingest
git push origin main
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: WildDragonLLC/dragonflight#161
No description provided.