@@ -277,6 +277,16 @@ export default defineCommand({
277277 "memory thrash on constrained machines. Default: auto-detected from " +
278278 "total RAM (<= 8 GB). Env: PRODUCER_LOW_MEMORY_MODE." ,
279279 } ,
280+ "experimental-fast-capture" : {
281+ type : "boolean" ,
282+ description :
283+ "EXPERIMENTAL. Capture frames via Chrome's drawElementImage API " +
284+ "instead of Page.captureScreenshot — reads DOM paint records directly, " +
285+ "~46% faster on GPU. Transparent (PNG) renders on SwiftShader (Docker) " +
286+ "auto-fall back to screenshot capture. Incompatible with page-side " +
287+ "shader compositing. Default: false. Env: PRODUCER_EXPERIMENTAL_FAST_CAPTURE." ,
288+ default : false ,
289+ } ,
280290 } ,
281291 // `run` is the citty handler for `hyperframes render` — sequential flag
282292 // validation + render dispatch. Inherited CRITICAL on main (CRAP 1290);
@@ -393,6 +403,13 @@ export default defineCommand({
393403 process . env . PRODUCER_LOW_MEMORY_MODE = args [ "low-memory-mode" ] ? "true" : "false" ;
394404 }
395405
406+ // ── Override: experimental fast capture (drawElementImage) ───────────
407+ if ( args [ "experimental-fast-capture" ] != null ) {
408+ process . env . PRODUCER_EXPERIMENTAL_FAST_CAPTURE = args [ "experimental-fast-capture" ]
409+ ? "true"
410+ : "false" ;
411+ }
412+
396413 // ── Validate max-concurrent-renders ─────────────────────────────────
397414 if ( args [ "max-concurrent-renders" ] != null ) {
398415 const parsed = parseInt ( args [ "max-concurrent-renders" ] , 10 ) ;
@@ -590,6 +607,7 @@ export default defineCommand({
590607 entryFile,
591608 outputResolution,
592609 pageSideCompositing : args [ "page-side-compositing" ] !== false ,
610+ experimentalFastCapture : args [ "experimental-fast-capture" ] === true ,
593611 pageNavigationTimeoutMs,
594612 protocolTimeout,
595613 playerReadyTimeout,
@@ -643,6 +661,8 @@ interface RenderOptions {
643661 /** Output resolution preset; see `resolveDeviceScaleFactor` for constraints. */
644662 outputResolution ?: CanvasResolution ;
645663 pageSideCompositing ?: boolean ;
664+ /** EXPERIMENTAL. drawElementImage frame capture (--experimental-fast-capture). */
665+ experimentalFastCapture ?: boolean ;
646666 /**
647667 * Puppeteer `page.goto()` timeout for the entry HTML, in milliseconds.
648668 * When omitted, the engine default (60s) applies. Surfaced as
@@ -877,6 +897,7 @@ async function renderDocker(
877897 entryFile : options . entryFile ,
878898 outputResolution : options . outputResolution ,
879899 pageSideCompositing : options . pageSideCompositing ,
900+ experimentalFastCapture : options . experimentalFastCapture ,
880901 pageNavigationTimeoutMs : options . pageNavigationTimeoutMs ,
881902 } ,
882903 } ) ;
0 commit comments