@hyperframes/producer 0.9.39 → 0.9.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ import {
31
31
  import { HF_AUDIO_GROUP_TAG } from "@hyperframes/core/audio-groups";
32
32
  import { HTML_BODY_CSS_HEIGHT_FIRST_RE, HTML_BODY_CSS_WIDTH_FIRST_RE } from "@hyperframes/parsers";
33
33
  import {
34
- extractMediaMetadata as extractMediaMetadata4,
34
+ extractMediaMetadata as extractMediaMetadata5,
35
35
  resolveConfig as resolveConfig2,
36
36
  closeCaptureSession as closeCaptureSession8,
37
37
  createCaptureSession as createCaptureSession8,
@@ -2145,8 +2145,9 @@ import {
2145
2145
  import { CaptureFailure, classifyCaptureFailure } from "@hyperframes/engine";
2146
2146
 
2147
2147
  // src/services/render/perfSummary.ts
2148
- import { arch, cpus, platform, totalmem } from "node:os";
2148
+ import { arch, platform, totalmem } from "node:os";
2149
2149
  import { fpsToNumber as fpsToNumber2 } from "@hyperframes/core";
2150
+ import { hostCpuCount } from "@hyperframes/engine";
2150
2151
 
2151
2152
  // src/services/render/hdrPerf.ts
2152
2153
  function createHdrPerfCollector() {
@@ -2493,7 +2494,7 @@ function buildRenderPerfSummary(input) {
2493
2494
  host: {
2494
2495
  platform: platform(),
2495
2496
  arch: arch(),
2496
- cpuCount: cpus().length,
2497
+ cpuCount: hostCpuCount(),
2497
2498
  totalMemMb: Math.round(totalmem() / (1024 * 1024)),
2498
2499
  nodeVersion: process.version,
2499
2500
  gpuDisabled: input.gpuDisabled
@@ -5558,7 +5559,12 @@ async function extractAllDeferredFrames(extracted, input) {
5558
5559
  video.videoId,
5559
5560
  range.startTime,
5560
5561
  range.durationSeconds,
5561
- { fps: input.fps, outputDir: dirname5(video.outputDir), format: range.format },
5562
+ {
5563
+ fps: input.fps,
5564
+ outputDir: dirname5(video.outputDir),
5565
+ format: range.format,
5566
+ shownBox: input.shownBoxes?.get(video.videoId)
5567
+ },
5562
5568
  input.signal,
5563
5569
  input.cfg
5564
5570
  ),
@@ -5583,6 +5589,74 @@ async function extractAllDeferredFrames(extracted, input) {
5583
5589
  }
5584
5590
  }
5585
5591
 
5592
+ // src/services/render/videoShownBoxes.ts
5593
+ import {
5594
+ extractMediaMetadata as extractMediaMetadata3,
5595
+ measureVideoShownBoxRanges,
5596
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc2
5597
+ } from "@hyperframes/engine";
5598
+ var SHOWN_BOX_STRIDE_S = 0.25;
5599
+ var MOVING_BOX_HEADROOM = 1.1;
5600
+ async function oversizedVideos(videos, projectDir, compiledDir, canvas) {
5601
+ const sized = await Promise.all(
5602
+ videos.map(async (video) => {
5603
+ if (/^https?:\/\//i.test(video.src)) return false;
5604
+ try {
5605
+ const path = resolveProjectRelativeSrc2(video.src, projectDir, compiledDir);
5606
+ const { width, height } = await extractMediaMetadata3(path);
5607
+ return width > canvas.width || height > canvas.height;
5608
+ } catch {
5609
+ return false;
5610
+ }
5611
+ })
5612
+ );
5613
+ return videos.filter((_, index) => sized[index]);
5614
+ }
5615
+ function shownBoxTimes(videos, fps) {
5616
+ const frame = fps.den / fps.num;
5617
+ const times = /* @__PURE__ */ new Set();
5618
+ for (const { start, end } of videos) {
5619
+ const last = Math.max(start, end - frame);
5620
+ for (let t = start; t < last; t += SHOWN_BOX_STRIDE_S) times.add(t);
5621
+ times.add(last);
5622
+ }
5623
+ return [...times].sort((a, b) => a - b);
5624
+ }
5625
+ async function measureLocalShownBoxes(page, videos, fps, log) {
5626
+ const times = shownBoxTimes(videos, fps);
5627
+ const startedAt = Date.now();
5628
+ try {
5629
+ const ranges = await measureVideoShownBoxRanges(
5630
+ page,
5631
+ videos.map((video) => video.id),
5632
+ times
5633
+ );
5634
+ await page.evaluate(
5635
+ () => window.__hf?.seek?.(0)
5636
+ );
5637
+ const boxes2 = /* @__PURE__ */ new Map();
5638
+ for (const [id, { largest, smallest }] of ranges) {
5639
+ const moves = largest.width !== smallest.width || largest.height !== smallest.height;
5640
+ const grow = moves ? MOVING_BOX_HEADROOM : 1;
5641
+ boxes2.set(id, { width: largest.width * grow, height: largest.height * grow });
5642
+ }
5643
+ log.info("[Render] Measured the boxes videos are shown at", {
5644
+ videos: videos.length,
5645
+ boxed: boxes2.size,
5646
+ seeks: times.length,
5647
+ elapsedMs: Date.now() - startedAt
5648
+ });
5649
+ return boxes2;
5650
+ } catch (error) {
5651
+ log.warn("[Render] Could not measure the boxes videos are shown at; extracting at full size", {
5652
+ error: error instanceof Error ? error.message : String(error),
5653
+ seeks: times.length,
5654
+ elapsedMs: Date.now() - startedAt
5655
+ });
5656
+ return void 0;
5657
+ }
5658
+ }
5659
+
5586
5660
  // src/services/render/segmentVideoFrames.ts
5587
5661
  import { mkdirSync as mkdirSync5, rmSync as rmSync8 } from "node:fs";
5588
5662
  import { join as join12 } from "node:path";
@@ -5607,6 +5681,7 @@ function createSegmentVideoFrames(input) {
5607
5681
  cfg: input.cfg,
5608
5682
  signal: input.abortSignal,
5609
5683
  sourceOf,
5684
+ shownBoxes: input.shownBoxes,
5610
5685
  onMissingFrame: (video, index) => new Error(
5611
5686
  `[Render] video ${JSON.stringify(video.videoId)} has no frame ${index}; it was expected to have ${video.totalFrames} frames.`
5612
5687
  )
@@ -6446,6 +6521,7 @@ import {
6446
6521
  rewriteInlineStyleAssetUrls
6447
6522
  } from "@hyperframes/core";
6448
6523
  import { MAX_AUDIO_GAIN } from "@hyperframes/core/audio-gain";
6524
+ import { CAPTURE_CANVAS_SELECTOR } from "@hyperframes/core/html-in-canvas";
6449
6525
  import { readPlaybackRate } from "@hyperframes/parsers/media-duration";
6450
6526
  import { resolveRateSpec } from "@hyperframes/core/speed-ramp";
6451
6527
  import { gsapCdnDist as gsapCdnDist2, normalizeGsapBaseUrl } from "@hyperframes/core/gsap-cdn";
@@ -7320,7 +7396,7 @@ import {
7320
7396
  isNotMediaPayload,
7321
7397
  NotMediaPayloadError,
7322
7398
  probeMediaProfile,
7323
- resolveProjectRelativeSrc as resolveProjectRelativeSrc2
7399
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc3
7324
7400
  } from "@hyperframes/engine";
7325
7401
  var ASSET_MEDIA_TYPE_MISMATCH = "ASSET_MEDIA_TYPE_MISMATCH";
7326
7402
  var AssetMediaTypeMismatchError = class extends Error {
@@ -7367,7 +7443,7 @@ function dropMediaOutsideProject(input) {
7367
7443
  const roots = [projectDir, compiledDir, join18(workDir, "downloads")];
7368
7444
  const staysInside = ({ id, src }) => {
7369
7445
  if (!src || isRemoteOrInlineSource(src)) return true;
7370
- const path = resolveProjectRelativeSrc2(src, projectDir, compiledDir);
7446
+ const path = resolveProjectRelativeSrc3(src, projectDir, compiledDir);
7371
7447
  if (roots.some((root) => !escapesAssetRoot(path, root))) return true;
7372
7448
  log.warn(`[Render] Media "${id}" source is missing: it is outside the project folder`, { src });
7373
7449
  return false;
@@ -7397,7 +7473,7 @@ async function preflightCompositionAssetMediaTypes(input) {
7397
7473
  const byPath = /* @__PURE__ */ new Map();
7398
7474
  for (const reference of references) {
7399
7475
  if (!reference.src || isRemoteOrInlineSource(reference.src)) continue;
7400
- const resolvedPath = resolveProjectRelativeSrc2(
7476
+ const resolvedPath = resolveProjectRelativeSrc3(
7401
7477
  reference.src,
7402
7478
  input.projectDir,
7403
7479
  input.compiledDir
@@ -7576,7 +7652,7 @@ function runtimeRoot(document2) {
7576
7652
  function detectRenderModeHints(html, pageMotionBlur) {
7577
7653
  const reasons = [];
7578
7654
  const { document: document2 } = parseHTML5(html);
7579
- if (document2.querySelector("canvas[layoutsubtree]")) {
7655
+ if (document2.querySelector(CAPTURE_CANVAS_SELECTOR)) {
7580
7656
  reasons.push({
7581
7657
  code: "htmlInCanvas",
7582
7658
  message: "Detected html-in-canvas API (layoutsubtree canvas). Chrome does not support concurrent drawElementImage across multiple workers; render is pinned to a single worker."
@@ -7584,7 +7660,7 @@ function detectRenderModeHints(html, pageMotionBlur) {
7584
7660
  } else if (pageMotionBlur !== "off" && runtimeRoot(document2)?.getAttribute("data-motion-blur") === "on") {
7585
7661
  reasons.push({
7586
7662
  code: "captureMotionBlur",
7587
- message: 'Detected capture motion blur (data-motion-blur="on"), which draws each frame with html-in-canvas; routed through screenshot capture mode.'
7663
+ message: 'Detected motion blur (data-motion-blur="on"), drawn per frame with an SVG filter or, on the capture tier, html-in-canvas; routed through screenshot capture mode.'
7588
7664
  });
7589
7665
  }
7590
7666
  if (document2.querySelector("iframe")) {
@@ -8325,13 +8401,26 @@ async function localizeRemoteMediaSources(html, downloadDir) {
8325
8401
  if (m[1]) urlSet.add(m[1]);
8326
8402
  }
8327
8403
  }
8328
- return downloadAndRewriteUrls(
8404
+ const localized = await downloadAndRewriteUrls(
8329
8405
  urlSet,
8330
8406
  html,
8331
8407
  join19(downloadDir, REMOTE_MEDIA_SUBDIR),
8332
8408
  "Remote media download failed",
8333
8409
  "Localized remote media source(s)"
8334
8410
  );
8411
+ return { ...localized, html: dropBindingOnLocalizedMedia(localized.html) };
8412
+ }
8413
+ function dropBindingOnLocalizedMedia(html) {
8414
+ if (!html.includes("data-var-src")) return html;
8415
+ const { document: document2 } = parseHTML5(html);
8416
+ let changed = false;
8417
+ for (const el of document2.querySelectorAll("video[data-var-src], audio[data-var-src]")) {
8418
+ if (el.closest("[data-variable-values]")) continue;
8419
+ if (!el.getAttribute("src")?.startsWith(`${REMOTE_MEDIA_SUBDIR}/`)) continue;
8420
+ el.removeAttribute("data-var-src");
8421
+ changed = true;
8422
+ }
8423
+ return changed ? document2.toString() : html;
8335
8424
  }
8336
8425
  async function localizeRemoteImageSources(html, downloadDir) {
8337
8426
  const urlSet = /* @__PURE__ */ new Set();
@@ -9605,7 +9694,7 @@ async function runProbeStage(input) {
9605
9694
  );
9606
9695
  const hasVariableMedia = hasVariableBoundMedia(compiled.html, job.config.variables);
9607
9696
  const hasInsertedMedia = hasRuntimeMediaChanges(compiled.html);
9608
- const needsBrowser = cfg.videoLayerPassthrough || probeRequiresBrowser({
9697
+ const needsBrowser = cfg.videoLayerPassthrough || input.measuresShownBoxes === true || probeRequiresBrowser({
9609
9698
  durationSeconds: composition.duration,
9610
9699
  unresolvedCompositionCount: compiled.unresolvedCompositions.length,
9611
9700
  hasAutoStart,
@@ -9624,6 +9713,7 @@ async function runProbeStage(input) {
9624
9713
  if (hasScriptedAudio) reasons.push("scripted audio volume");
9625
9714
  if (hasInsertedMedia) reasons.push("runtime-created or source-mutated media");
9626
9715
  if (hasVariableMedia) reasons.push("variable-bound media source(s)");
9716
+ if (input.measuresShownBoxes) reasons.push("video(s) larger than the canvas");
9627
9717
  log.info("Launching browser for composition probe...", {
9628
9718
  reasons
9629
9719
  });
@@ -10157,7 +10247,7 @@ import {
10157
10247
  createFrameLookupTable as createFrameLookupTable3,
10158
10248
  detectTransfer,
10159
10249
  extractAllVideoFrames,
10160
- extractMediaMetadata as extractMediaMetadata3,
10250
+ extractMediaMetadata as extractMediaMetadata4,
10161
10251
  gradingKeepsSdr as gradingKeepsSdr2,
10162
10252
  isVideoPastTimelineEnd,
10163
10253
  isHdrColorSpace as isHdrColorSpace2,
@@ -10165,7 +10255,7 @@ import {
10165
10255
  resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
10166
10256
  resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
10167
10257
  isHttpUrl as isHttpUrl2,
10168
- resolveProjectRelativeSrc as resolveProjectRelativeSrc3,
10258
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc4,
10169
10259
  runVideoExtractionWithRetry as runVideoExtractionWithRetry2,
10170
10260
  safeVideoExtractionSourceIdentity,
10171
10261
  videoAudioId as videoAudioId2
@@ -10381,7 +10471,7 @@ function applyVideoExtractionFailurePolicy(result, policy, log) {
10381
10471
  }
10382
10472
  async function probeColorSpaceSafely(path, log) {
10383
10473
  try {
10384
- const meta = await extractMediaMetadata3(path);
10474
+ const meta = await extractMediaMetadata4(path);
10385
10475
  return meta.colorSpace;
10386
10476
  } catch (error) {
10387
10477
  log?.warn("HDR color-space probe failed; treating source as SDR", {
@@ -10403,6 +10493,7 @@ async function runExtractVideosStage(input) {
10403
10493
  assertNotAborted,
10404
10494
  materializeSymlinks,
10405
10495
  deferRangeExtraction,
10496
+ shownBoxes,
10406
10497
  urlByAbsentLocalPath,
10407
10498
  skipFrameExtractionIds = []
10408
10499
  } = input;
@@ -10424,10 +10515,10 @@ async function runExtractVideosStage(input) {
10424
10515
  log?.info("Probing video color spaces...", { videoCount: composition.videos.length });
10425
10516
  const probeFailures = await Promise.all(
10426
10517
  composition.videos.map(async (v) => {
10427
- const videoPath = resolveProjectRelativeSrc3(v.src, projectDir, compiledDir);
10518
+ const videoPath = resolveProjectRelativeSrc4(v.src, projectDir, compiledDir);
10428
10519
  if (!existsSync13(videoPath)) return null;
10429
10520
  try {
10430
- const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await extractMediaMetadata3(videoPath), retries: 0 } : await runVideoExtractionWithRetry2(() => extractMediaMetadata3(videoPath), {
10521
+ const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await extractMediaMetadata4(videoPath), retries: 0 } : await runVideoExtractionWithRetry2(() => extractMediaMetadata4(videoPath), {
10431
10522
  signal: abortSignal,
10432
10523
  maxTransientRetries: extractionPolicy.maxTransientRetries,
10433
10524
  onRetry: () => {
@@ -10462,7 +10553,7 @@ async function runExtractVideosStage(input) {
10462
10553
  if (probesHdr && composition.images.length > 0) {
10463
10554
  const probed = await Promise.all(
10464
10555
  composition.images.map(async (img) => {
10465
- const imgPath = resolveProjectRelativeSrc3(img.src, projectDir, compiledDir);
10556
+ const imgPath = resolveProjectRelativeSrc4(img.src, projectDir, compiledDir);
10466
10557
  if (!existsSync13(imgPath)) return null;
10467
10558
  const colorSpace = await probeColorSpaceSafely(imgPath, log);
10468
10559
  if (isHdrColorSpace2(colorSpace)) {
@@ -10504,6 +10595,7 @@ async function runExtractVideosStage(input) {
10504
10595
  maxTransientRetries: extractionPolicy.maxTransientRetries,
10505
10596
  collectProbeFailures: extractionPolicy.failureMode === "enforce",
10506
10597
  deferRangeExtraction,
10598
+ shownBoxes,
10507
10599
  contentKeyedDirs: [join22(compiledDir, REMOTE_MEDIA_SUBDIR)],
10508
10600
  urlByAbsentLocalPath,
10509
10601
  onProgress: ({ planned = 0, done = 0 }) => {
@@ -10581,10 +10673,10 @@ async function appendVideoAudioFromProbe(input) {
10581
10673
  );
10582
10674
  const probed = await Promise.all(
10583
10675
  videos.map(async (video) => {
10584
- const path = isHttpUrl2(video.src) ? video.src : resolveProjectRelativeSrc3(video.src, projectDir, compiledDir);
10676
+ const path = isHttpUrl2(video.src) ? video.src : resolveProjectRelativeSrc4(video.src, projectDir, compiledDir);
10585
10677
  const readFrom = urlByAbsentLocalPath?.get(path) ?? path;
10586
10678
  if (!isHttpUrl2(readFrom) && !existsSync13(readFrom)) return null;
10587
- const metadata = await extractMediaMetadata3(readFrom);
10679
+ const metadata = await extractMediaMetadata4(readFrom);
10588
10680
  const window2 = await resolveFinalFrameExtractionWindow2(
10589
10681
  readFrom,
10590
10682
  video,
@@ -10608,7 +10700,7 @@ import {
10608
10700
  buildVideoLayerInput,
10609
10701
  isHttpUrl as isHttpUrl3,
10610
10702
  qualifyVideoLayer,
10611
- resolveProjectRelativeSrc as resolveProjectRelativeSrc4
10703
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc5
10612
10704
  } from "@hyperframes/engine";
10613
10705
  var SAMPLES = 9;
10614
10706
  function inspectVideoLayout(id, w, h, time) {
@@ -10670,7 +10762,7 @@ async function planVideoLayerPassthrough(input) {
10670
10762
  if (!q.qualifies) return { reason: q.reason };
10671
10763
  const { video } = q;
10672
10764
  if (isHttpUrl3(video.src)) return { reason: "remote_source" };
10673
- const path = resolveProjectRelativeSrc4(video.src, input.projectDir, input.compiledDir);
10765
+ const path = resolveProjectRelativeSrc5(video.src, input.projectDir, input.compiledDir);
10674
10766
  if (!existsSync14(path)) return { reason: "source_missing" };
10675
10767
  const layout = await probeVideoLayout(input.page, video.id, input.canvas, input.duration);
10676
10768
  if ("reason" in layout) return layout;
@@ -12053,8 +12145,8 @@ import { Worker } from "node:worker_threads";
12053
12145
  import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
12054
12146
  import { dirname as dirname11, join as join28 } from "node:path";
12055
12147
  import { createRequire } from "node:module";
12148
+ import { usableCpuCount } from "@hyperframes/engine";
12056
12149
  import { existsSync as existsSync18 } from "node:fs";
12057
- import { cpus as cpus2 } from "node:os";
12058
12150
  function resolveWorkerEntry(explicit) {
12059
12151
  if (explicit && explicit.length > 0) {
12060
12152
  return { path: explicit, isTs: explicit.endsWith(".ts") };
@@ -12086,7 +12178,7 @@ function buildExecArgv(entryIsTs) {
12086
12178
  return inherited;
12087
12179
  }
12088
12180
  async function createShaderTransitionWorkerPool(opts) {
12089
- const cpuCount = Math.max(1, cpus2().length);
12181
+ const cpuCount = Math.max(1, usableCpuCount());
12090
12182
  const size = Math.max(1, Math.min(opts.size, cpuCount));
12091
12183
  const log = opts.log ?? {};
12092
12184
  const { path: entry, isTs: entryIsTs } = resolveWorkerEntry(opts.workerEntryPath);
@@ -14543,6 +14635,12 @@ async function executeRenderPipeline(input) {
14543
14635
  );
14544
14636
  const subTimelineWaitMemo = {};
14545
14637
  const staticDedupMemo = {};
14638
+ const largerThanCanvas = await oversizedVideos(
14639
+ composition.videos,
14640
+ projectDir,
14641
+ join32(workDir, "compiled"),
14642
+ { width: outputWidth, height: outputHeight }
14643
+ );
14546
14644
  const probeResult = await observeRenderStage(
14547
14645
  observability,
14548
14646
  "browser_probe",
@@ -14550,6 +14648,7 @@ async function executeRenderPipeline(input) {
14550
14648
  () => runProbeStage({
14551
14649
  projectDir,
14552
14650
  workDir,
14651
+ measuresShownBoxes: largerThanCanvas.length > 0,
14553
14652
  job,
14554
14653
  cfg,
14555
14654
  forceScreenshot: captureForceScreenshot,
@@ -14575,6 +14674,7 @@ async function executeRenderPipeline(input) {
14575
14674
  compositionHash = computeCompositionObservabilityHash(compiled.html);
14576
14675
  fileServer = probeResult.fileServer;
14577
14676
  probeSession = probeResult.probeSession;
14677
+ const shownBoxes = largerThanCanvas.length > 0 && probeSession?.isInitialized ? await measureLocalShownBoxes(probeSession.page, largerThanCanvas, job.config.fps, log) : void 0;
14578
14678
  job.strictVariablesChecked = probeResult.strictVariablesChecked;
14579
14679
  lastBrowserConsole = probeResult.lastBrowserConsole;
14580
14680
  let resolvedCaptureBeyondViewport = probeSession?.options.captureBeyondViewport;
@@ -14680,6 +14780,7 @@ async function executeRenderPipeline(input) {
14680
14780
  // Local staging can use links; distributed plan() alone requires real copies.
14681
14781
  materializeSymlinks: false,
14682
14782
  deferRangeExtraction: windowVideoFrames ? true : void 0,
14783
+ shownBoxes,
14683
14784
  onProgress
14684
14785
  })
14685
14786
  );
@@ -14909,7 +15010,8 @@ async function executeRenderPipeline(input) {
14909
15010
  rootDir: workDir,
14910
15011
  cfg,
14911
15012
  injectorOptions: frameCacheOptions(cfg, workerCount),
14912
- abortSignal: executionSignal
15013
+ abortSignal: executionSignal,
15014
+ shownBoxes
14913
15015
  }),
14914
15016
  workDir,
14915
15017
  (bytes) => updateCaptureObservability({ videoFrameWindowPeakBytes: bytes })
@@ -14931,6 +15033,7 @@ async function executeRenderPipeline(input) {
14931
15033
  () => extractAllDeferredFrames(extracted, {
14932
15034
  fps: job.config.fps,
14933
15035
  cfg,
15036
+ shownBoxes,
14934
15037
  signal: executionSignal,
14935
15038
  maxTransientRetries: resolveVideoExtractionPolicy().maxTransientRetries,
14936
15039
  onProgress: (done, total) => reportExtractProgress(job, done, total, onProgress)
@@ -15673,7 +15776,7 @@ async function executeRenderPipeline(input) {
15673
15776
  completedSegments = await validateCompletedSegments(
15674
15777
  existing,
15675
15778
  segmentPlanHash,
15676
- (path) => probeSegmentFrameCount(path, extractMediaMetadata4)
15779
+ (path) => probeSegmentFrameCount(path, extractMediaMetadata5)
15677
15780
  );
15678
15781
  log.info(`[Render] resuming: ${completedSegments.size} segments complete`, {
15679
15782
  segmentDir
@@ -19073,7 +19176,6 @@ async function plan(projectDir, config, planDir, options = {}) {
19073
19176
  // src/services/distributed/renderChunk.ts
19074
19177
  import { randomBytes } from "node:crypto";
19075
19178
  import { existsSync as existsSync29, mkdirSync as mkdirSync19, readFileSync as readFileSync14, readdirSync as readdirSync11, rmSync as rmSync17, writeFileSync as writeFileSync13 } from "node:fs";
19076
- import { cpus as cpus3 } from "node:os";
19077
19179
  import { join as join45 } from "node:path";
19078
19180
  import {
19079
19181
  assertSwiftShader,
@@ -19089,7 +19191,8 @@ import {
19089
19191
  measureVideoShownBoxes,
19090
19192
  probeBeginFrameLiveness as probeBeginFrameLiveness2,
19091
19193
  readWebGlVendorInfoFromCanvas,
19092
- resolveConfig as resolveConfig4
19194
+ resolveConfig as resolveConfig4,
19195
+ usableCpuCount as usableCpuCount2
19093
19196
  } from "@hyperframes/engine";
19094
19197
 
19095
19198
  // src/services/distributed/planV2.ts
@@ -20515,7 +20618,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
20515
20618
  const captureSession = session;
20516
20619
  session = null;
20517
20620
  verifyStarted = Date.now();
20518
- overlap.current = canEncodeWhileCapturing(encodeInput, chunkWorkerCount, cpus3().length) ? encodeWhileCapturing(encodeInput, framesInChunk) : null;
20621
+ overlap.current = canEncodeWhileCapturing(encodeInput, chunkWorkerCount, usableCpuCount2()) ? encodeWhileCapturing(encodeInput, framesInChunk) : null;
20519
20622
  await observeRenderStage(
20520
20623
  new RenderObservabilityRecorder({ pipelineStartMs: start, log }),
20521
20624
  "capture_chunk",