Repository navigation
perf(producer): --gpu renders encode while frames are captured - #6631
Merged
Merged
Conversation
Contributor
Edit accuracy: accurate 271 (base branch 271), smooth 152 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (2)
|
Contributor
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 0 important · 0 nits · head 224f7ce6
Scope
I diffed buildEncoderArgs against buildStreamingArgs. The GPU branches match, including the vaapi -vaapi_device unshift (which sits before -c:v) and the SDR filter/even-pad. The only differences are the input args and -xerror. spawnStreamingEncoder resolves the GPU encoder with getCachedGpuEncoder the same way the disk path does. A failed overlap still falls back to runEncodeStage. The fails-without-fix test is named. All workflows are green on this head.
3 tasks done
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 28, 2026
miguel-heygen
force-pushed
the
perf/gpu-encode-while-capturing
branch
2 times, most recently
from
October 28, 2026 08:23
b22b23a to
a98075d
Compare
miguel-heygen
force-pushed
the
perf/gpu-encode-while-capturing
branch
from
October 28, 2026 08:45
a98075d to
169eaa8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Multi-worker mp4 renders with
--gpunow encode while frames are still being captured, as software encodes already do. The encode left after capture drops to about zero.Why
#5952 added encode-while-capturing for multi-worker disk captures but limited it to software libx264. With
--gpu, the hardware encoder waited until every frame was captured and then encoded them all serially. That made--gpuslower than the default on a fast Mac: VideoToolbox spent 6.1 s after a 42 s film's capture finished, while overlapped libx264 had 0.1 s left.The exclusion's stated reason was that overlap reuses the streaming encoder, which had to build the same arguments as the disk encoder. For the GPU encoders it already does: both builders emit identical arguments from
-c:von, for videotoolbox, nvenc, qsv, vaapi and amf. A new test pins that.Why under 100 lines
One lever: the GPU encoder joins the existing encode-while-capturing path, which already builds the same encoder args. The change is dropping one exclusion, with a test that pins the args match.
Related work
Refs #5952.
How
canEncodeWhileCapturingdrops itsuseGpu !== truecondition. Everything else is unchanged: h264 from JPEG frames, not HDR, not chunked, not png/gif, and capture must leave a core free. If the overlapped encode fails, the frames are still encoded after capture as before.Test plan
encodeWhileCapturing.test.ts(GPU renders are eligible) anddeliveryEncoderOptions.test.ts(disk and streaming builders emit the same GPU arguments for all five GPU encoders).encodeWhileCapturing.test.ts > runs only when the capture workers leave a core free for the encoder(1 failed / 4 passed with only the tests applied). The argument-parity test passes on main too; it guards the invariant this change relies on.tsc --noEmit(engine, producer) exit 0; enginedeliveryEncoderOptions.test.ts9 passed; producerencodeWhileCapturing.test.ts5 passed; oxfmt and oxlint clean.Before / after
hyperframes render --gpu, published[email protected]vs the same bundle with only this change, Apple M4 Pro (14 cores, 24 GB, VideoToolbox), repo fixtures, interleaved, medians.wall - compiledrops compile, which is network-bound for these fixtures.style-11-prod, 1080x1920, 14 s, 4 workersoverlay-montage-prod+ one mix-blend layer, 42 s, 4 workersOutput: VideoToolbox output is not byte-stable on its own (two runs of main on the first fixture gave two different files), so this compares timing only. Encoder, arguments and settings are unchanged.