Repository navigation
perf(aws-lambda): cloud renders plan without reading video bytes and start chunks sooner - #6194
Conversation
dbebebf to
407faeb
Compare
Edit accuracy: accurate 271 (base branch 271), smooth 168 of thoseThe gate passes. Quarantined, measured but not gated (0) |
fc20004 to
e5a822f
Compare
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 2 important · 0 nits · head f26b0633
No blockers. The two important items below are follow-ups: both have a narrow trigger, and neither affects the measured paths.
Scope
Audited: ffprobe.ts (stored facts, final-packet probe), videoFrameExtractor.ts (tailFramesFromFinalFrame and the deferred-window count), renderChunk.ts (overlap lifecycle across the capture .catch, screenshot-fallback reset, and finally), encodeStage.ts, frameCapture.ts warmup, deploySite/siteManifest/s3Transport/contentStore, plan and audio logging.
Checked: chunk landed-frame indices are 0-based within the range (parallelCoordinator outputFrameOffset), which matches encodeWhileCapturing's 0..framesInChunk. Adaptive capture retries only recapture missing frames, so frames already fed stay valid. A screenshot-mode retry aborts the encoder before resetForScreenshotRetry wipes workDir.
Trusting: the new tests, which I could not run locally (no bun in the sandbox); CI on this head was still running when I posted. CodeQL's two "network data written to file" alerts on probeFacts.ts are false positives: the file is local ffprobe JSON written to a temp path.
…one per half-core
…unt without a decode
…ce; VFR is not deferred
…an reads it instead of probing
…amp the plan would probe for
One line per audio stage: prepare, groups, mix, master, encode and the peak check, in ms.
…count from stored facts
…windows skip the tail decode
f26b063 to
a8855b8
Compare
There was a problem hiding this comment.
Verdict: APPROVE — 0 resolved, 2 open, 0 new · f26b063 → a8855b8. Rebase only: the patch matches the previous head apart from main's renameWithRetry context lines in audioMixer.ts and the import list. The two important follow-ups (warmup hot loop, ffprobe version skew) are unchanged and still non-blocking.
…ames check ffprobe major
There was a problem hiding this comment.
Verdict: APPROVE — 2 resolved, 0 open, 0 new · a8855b8 → 901dad9. Warmup now skips the sleep only after a successful tick, and the new test pins a dead page. Stored final frames are ignored on an ffprobe major-version mismatch. Legacy facts and the stored ffprobe JSON are still trusted, as the thread reply states. Accepted as partial.
…e the other spawns
…v adds The increase sits on top of main's engine budget, 456055 after heygen-com#6194. Main packs the engine at 435883 bytes and this branch at 436205. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pins a GPU (heygen-com#5976) * fix(engine): software renders reach SwiftShader when VK_DRIVER_FILES pins a GPU ANGLE (and Dawn) load SwiftShader by pointing the Vulkan loader at its ICD through VK_ICD_FILENAMES. The loader ignores VK_ICD_FILENAMES while VK_DRIVER_FILES is set, and still applies VK_LOADER_DRIVERS_SELECT/DISABLE, so on a machine that pins its Vulkan driver that way a --no-browser-gpu render gets ANGLE on the real GPU and assertSwiftShader refuses it. Launch SwiftShader browsers without those three variables. Hardware launches, and environments that set none of them, are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(engine): raise the packed size budget by the 342 bytes launchEnv adds The increase sits on top of main's engine budget, 456055 after heygen-com#6194. Main packs the engine at 435883 bytes and this branch at 436205. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
What changed
A cloud render's plan no longer touches video bytes, and each chunk starts capturing sooner. Six changes, each in the code it names:
sites createstores each video's ffprobe JSON, its final-frame time and its last packet length beside the video, keyed by content hash (like the audio sidecars). The plan reads that instead of probing the file over the network.HF_TAIL_PROBE_SLOTS).canEncodeWhileCapturingno longer excludeslockGopForChunkConcat); output is byte-identical to encoding after capture (new test).[plan] extract phases,[audio] phases(the plan never passed its logger to the audio stage).What I measured (93-cut 4K edit, 6 sources, 22 GB, 840 s, cold functions, real
sites create)sites create(15 s): wall 38.5 / 40.7 / 38.9 s, $0.547 / 0.531 / 0.550, plan 2.5-2.9 s; the 54,000 frames and the audio are identical across the three runs. The released 0.8.190 renders it in 41.9 s / $0.580 (one cold run, the first after a redeploy) with the same frames and audio, so on a single long clip this PR is about 6% faster and 7% cheaper; the big win is the cut-heavy multi-source edit above.What I did NOT exercise
sites createffprobe of the same build as the Lambda's, so they do not exercise a version mismatch.sites createruns again.