@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.
@@ -48,7 +48,7 @@ import {
48
48
  import { HF_AUDIO_GROUP_TAG } from "@hyperframes/core/audio-groups";
49
49
  import { HTML_BODY_CSS_HEIGHT_FIRST_RE, HTML_BODY_CSS_WIDTH_FIRST_RE } from "@hyperframes/parsers";
50
50
  import {
51
- extractMediaMetadata as extractMediaMetadata4,
51
+ extractMediaMetadata as extractMediaMetadata5,
52
52
  resolveConfig as resolveConfig2,
53
53
  closeCaptureSession as closeCaptureSession8,
54
54
  createCaptureSession as createCaptureSession8,
@@ -2158,8 +2158,9 @@ import {
2158
2158
  import { CaptureFailure, classifyCaptureFailure } from "@hyperframes/engine";
2159
2159
 
2160
2160
  // src/services/render/perfSummary.ts
2161
- import { arch, cpus, platform, totalmem } from "node:os";
2161
+ import { arch, platform, totalmem } from "node:os";
2162
2162
  import { fpsToNumber as fpsToNumber2 } from "@hyperframes/core";
2163
+ import { hostCpuCount } from "@hyperframes/engine";
2163
2164
 
2164
2165
  // src/services/render/hdrPerf.ts
2165
2166
  function createHdrPerfCollector() {
@@ -2506,7 +2507,7 @@ function buildRenderPerfSummary(input) {
2506
2507
  host: {
2507
2508
  platform: platform(),
2508
2509
  arch: arch(),
2509
- cpuCount: cpus().length,
2510
+ cpuCount: hostCpuCount(),
2510
2511
  totalMemMb: Math.round(totalmem() / (1024 * 1024)),
2511
2512
  nodeVersion: process.version,
2512
2513
  gpuDisabled: input.gpuDisabled
@@ -5571,7 +5572,12 @@ async function extractAllDeferredFrames(extracted, input) {
5571
5572
  video.videoId,
5572
5573
  range.startTime,
5573
5574
  range.durationSeconds,
5574
- { fps: input.fps, outputDir: dirname5(video.outputDir), format: range.format },
5575
+ {
5576
+ fps: input.fps,
5577
+ outputDir: dirname5(video.outputDir),
5578
+ format: range.format,
5579
+ shownBox: input.shownBoxes?.get(video.videoId)
5580
+ },
5575
5581
  input.signal,
5576
5582
  input.cfg
5577
5583
  ),
@@ -5596,6 +5602,74 @@ async function extractAllDeferredFrames(extracted, input) {
5596
5602
  }
5597
5603
  }
5598
5604
 
5605
+ // src/services/render/videoShownBoxes.ts
5606
+ import {
5607
+ extractMediaMetadata as extractMediaMetadata3,
5608
+ measureVideoShownBoxRanges,
5609
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc2
5610
+ } from "@hyperframes/engine";
5611
+ var SHOWN_BOX_STRIDE_S = 0.25;
5612
+ var MOVING_BOX_HEADROOM = 1.1;
5613
+ async function oversizedVideos(videos, projectDir, compiledDir, canvas) {
5614
+ const sized = await Promise.all(
5615
+ videos.map(async (video) => {
5616
+ if (/^https?:\/\//i.test(video.src)) return false;
5617
+ try {
5618
+ const path = resolveProjectRelativeSrc2(video.src, projectDir, compiledDir);
5619
+ const { width, height } = await extractMediaMetadata3(path);
5620
+ return width > canvas.width || height > canvas.height;
5621
+ } catch {
5622
+ return false;
5623
+ }
5624
+ })
5625
+ );
5626
+ return videos.filter((_, index) => sized[index]);
5627
+ }
5628
+ function shownBoxTimes(videos, fps) {
5629
+ const frame = fps.den / fps.num;
5630
+ const times = /* @__PURE__ */ new Set();
5631
+ for (const { start, end } of videos) {
5632
+ const last = Math.max(start, end - frame);
5633
+ for (let t = start; t < last; t += SHOWN_BOX_STRIDE_S) times.add(t);
5634
+ times.add(last);
5635
+ }
5636
+ return [...times].sort((a, b) => a - b);
5637
+ }
5638
+ async function measureLocalShownBoxes(page, videos, fps, log) {
5639
+ const times = shownBoxTimes(videos, fps);
5640
+ const startedAt = Date.now();
5641
+ try {
5642
+ const ranges = await measureVideoShownBoxRanges(
5643
+ page,
5644
+ videos.map((video) => video.id),
5645
+ times
5646
+ );
5647
+ await page.evaluate(
5648
+ () => window.__hf?.seek?.(0)
5649
+ );
5650
+ const boxes2 = /* @__PURE__ */ new Map();
5651
+ for (const [id, { largest, smallest }] of ranges) {
5652
+ const moves = largest.width !== smallest.width || largest.height !== smallest.height;
5653
+ const grow = moves ? MOVING_BOX_HEADROOM : 1;
5654
+ boxes2.set(id, { width: largest.width * grow, height: largest.height * grow });
5655
+ }
5656
+ log.info("[Render] Measured the boxes videos are shown at", {
5657
+ videos: videos.length,
5658
+ boxed: boxes2.size,
5659
+ seeks: times.length,
5660
+ elapsedMs: Date.now() - startedAt
5661
+ });
5662
+ return boxes2;
5663
+ } catch (error) {
5664
+ log.warn("[Render] Could not measure the boxes videos are shown at; extracting at full size", {
5665
+ error: error instanceof Error ? error.message : String(error),
5666
+ seeks: times.length,
5667
+ elapsedMs: Date.now() - startedAt
5668
+ });
5669
+ return void 0;
5670
+ }
5671
+ }
5672
+
5599
5673
  // src/services/render/segmentVideoFrames.ts
5600
5674
  import { mkdirSync as mkdirSync5, rmSync as rmSync8 } from "node:fs";
5601
5675
  import { join as join12 } from "node:path";
@@ -5620,6 +5694,7 @@ function createSegmentVideoFrames(input) {
5620
5694
  cfg: input.cfg,
5621
5695
  signal: input.abortSignal,
5622
5696
  sourceOf,
5697
+ shownBoxes: input.shownBoxes,
5623
5698
  onMissingFrame: (video, index) => new Error(
5624
5699
  `[Render] video ${JSON.stringify(video.videoId)} has no frame ${index}; it was expected to have ${video.totalFrames} frames.`
5625
5700
  )
@@ -6459,6 +6534,7 @@ import {
6459
6534
  rewriteInlineStyleAssetUrls
6460
6535
  } from "@hyperframes/core";
6461
6536
  import { MAX_AUDIO_GAIN } from "@hyperframes/core/audio-gain";
6537
+ import { CAPTURE_CANVAS_SELECTOR } from "@hyperframes/core/html-in-canvas";
6462
6538
  import { readPlaybackRate } from "@hyperframes/parsers/media-duration";
6463
6539
  import { resolveRateSpec } from "@hyperframes/core/speed-ramp";
6464
6540
  import { gsapCdnDist as gsapCdnDist2, normalizeGsapBaseUrl } from "@hyperframes/core/gsap-cdn";
@@ -7333,7 +7409,7 @@ import {
7333
7409
  isNotMediaPayload,
7334
7410
  NotMediaPayloadError,
7335
7411
  probeMediaProfile,
7336
- resolveProjectRelativeSrc as resolveProjectRelativeSrc2
7412
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc3
7337
7413
  } from "@hyperframes/engine";
7338
7414
  var ASSET_MEDIA_TYPE_MISMATCH = "ASSET_MEDIA_TYPE_MISMATCH";
7339
7415
  var AssetMediaTypeMismatchError = class extends Error {
@@ -7380,7 +7456,7 @@ function dropMediaOutsideProject(input) {
7380
7456
  const roots = [projectDir, compiledDir, join18(workDir, "downloads")];
7381
7457
  const staysInside = ({ id, src }) => {
7382
7458
  if (!src || isRemoteOrInlineSource(src)) return true;
7383
- const path = resolveProjectRelativeSrc2(src, projectDir, compiledDir);
7459
+ const path = resolveProjectRelativeSrc3(src, projectDir, compiledDir);
7384
7460
  if (roots.some((root) => !escapesAssetRoot(path, root))) return true;
7385
7461
  log.warn(`[Render] Media "${id}" source is missing: it is outside the project folder`, { src });
7386
7462
  return false;
@@ -7410,7 +7486,7 @@ async function preflightCompositionAssetMediaTypes(input) {
7410
7486
  const byPath = /* @__PURE__ */ new Map();
7411
7487
  for (const reference of references) {
7412
7488
  if (!reference.src || isRemoteOrInlineSource(reference.src)) continue;
7413
- const resolvedPath = resolveProjectRelativeSrc2(
7489
+ const resolvedPath = resolveProjectRelativeSrc3(
7414
7490
  reference.src,
7415
7491
  input.projectDir,
7416
7492
  input.compiledDir
@@ -7589,7 +7665,7 @@ function runtimeRoot(document2) {
7589
7665
  function detectRenderModeHints(html, pageMotionBlur) {
7590
7666
  const reasons = [];
7591
7667
  const { document: document2 } = parseHTML5(html);
7592
- if (document2.querySelector("canvas[layoutsubtree]")) {
7668
+ if (document2.querySelector(CAPTURE_CANVAS_SELECTOR)) {
7593
7669
  reasons.push({
7594
7670
  code: "htmlInCanvas",
7595
7671
  message: "Detected html-in-canvas API (layoutsubtree canvas). Chrome does not support concurrent drawElementImage across multiple workers; render is pinned to a single worker."
@@ -7597,7 +7673,7 @@ function detectRenderModeHints(html, pageMotionBlur) {
7597
7673
  } else if (pageMotionBlur !== "off" && runtimeRoot(document2)?.getAttribute("data-motion-blur") === "on") {
7598
7674
  reasons.push({
7599
7675
  code: "captureMotionBlur",
7600
- message: 'Detected capture motion blur (data-motion-blur="on"), which draws each frame with html-in-canvas; routed through screenshot capture mode.'
7676
+ 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.'
7601
7677
  });
7602
7678
  }
7603
7679
  if (document2.querySelector("iframe")) {
@@ -8338,13 +8414,26 @@ async function localizeRemoteMediaSources(html, downloadDir) {
8338
8414
  if (m[1]) urlSet.add(m[1]);
8339
8415
  }
8340
8416
  }
8341
- return downloadAndRewriteUrls(
8417
+ const localized = await downloadAndRewriteUrls(
8342
8418
  urlSet,
8343
8419
  html,
8344
8420
  join19(downloadDir, REMOTE_MEDIA_SUBDIR),
8345
8421
  "Remote media download failed",
8346
8422
  "Localized remote media source(s)"
8347
8423
  );
8424
+ return { ...localized, html: dropBindingOnLocalizedMedia(localized.html) };
8425
+ }
8426
+ function dropBindingOnLocalizedMedia(html) {
8427
+ if (!html.includes("data-var-src")) return html;
8428
+ const { document: document2 } = parseHTML5(html);
8429
+ let changed = false;
8430
+ for (const el of document2.querySelectorAll("video[data-var-src], audio[data-var-src]")) {
8431
+ if (el.closest("[data-variable-values]")) continue;
8432
+ if (!el.getAttribute("src")?.startsWith(`${REMOTE_MEDIA_SUBDIR}/`)) continue;
8433
+ el.removeAttribute("data-var-src");
8434
+ changed = true;
8435
+ }
8436
+ return changed ? document2.toString() : html;
8348
8437
  }
8349
8438
  async function localizeRemoteImageSources(html, downloadDir) {
8350
8439
  const urlSet = /* @__PURE__ */ new Set();
@@ -9615,7 +9704,7 @@ async function runProbeStage(input) {
9615
9704
  );
9616
9705
  const hasVariableMedia = hasVariableBoundMedia(compiled.html, job.config.variables);
9617
9706
  const hasInsertedMedia = hasRuntimeMediaChanges(compiled.html);
9618
- const needsBrowser = cfg.videoLayerPassthrough || probeRequiresBrowser({
9707
+ const needsBrowser = cfg.videoLayerPassthrough || input.measuresShownBoxes === true || probeRequiresBrowser({
9619
9708
  durationSeconds: composition.duration,
9620
9709
  unresolvedCompositionCount: compiled.unresolvedCompositions.length,
9621
9710
  hasAutoStart,
@@ -9634,6 +9723,7 @@ async function runProbeStage(input) {
9634
9723
  if (hasScriptedAudio) reasons.push("scripted audio volume");
9635
9724
  if (hasInsertedMedia) reasons.push("runtime-created or source-mutated media");
9636
9725
  if (hasVariableMedia) reasons.push("variable-bound media source(s)");
9726
+ if (input.measuresShownBoxes) reasons.push("video(s) larger than the canvas");
9637
9727
  log.info("Launching browser for composition probe...", {
9638
9728
  reasons
9639
9729
  });
@@ -10135,7 +10225,7 @@ import {
10135
10225
  createFrameLookupTable as createFrameLookupTable3,
10136
10226
  detectTransfer,
10137
10227
  extractAllVideoFrames,
10138
- extractMediaMetadata as extractMediaMetadata3,
10228
+ extractMediaMetadata as extractMediaMetadata4,
10139
10229
  gradingKeepsSdr as gradingKeepsSdr2,
10140
10230
  isVideoPastTimelineEnd,
10141
10231
  isHdrColorSpace as isHdrColorSpace2,
@@ -10143,7 +10233,7 @@ import {
10143
10233
  resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
10144
10234
  resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
10145
10235
  isHttpUrl as isHttpUrl2,
10146
- resolveProjectRelativeSrc as resolveProjectRelativeSrc3,
10236
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc4,
10147
10237
  runVideoExtractionWithRetry as runVideoExtractionWithRetry2,
10148
10238
  safeVideoExtractionSourceIdentity,
10149
10239
  videoAudioId as videoAudioId2
@@ -10354,7 +10444,7 @@ function applyVideoExtractionFailurePolicy(result, policy, log) {
10354
10444
  }
10355
10445
  async function probeColorSpaceSafely(path, log) {
10356
10446
  try {
10357
- const meta = await extractMediaMetadata3(path);
10447
+ const meta = await extractMediaMetadata4(path);
10358
10448
  return meta.colorSpace;
10359
10449
  } catch (error) {
10360
10450
  log?.warn("HDR color-space probe failed; treating source as SDR", {
@@ -10376,6 +10466,7 @@ async function runExtractVideosStage(input) {
10376
10466
  assertNotAborted,
10377
10467
  materializeSymlinks,
10378
10468
  deferRangeExtraction,
10469
+ shownBoxes,
10379
10470
  urlByAbsentLocalPath,
10380
10471
  skipFrameExtractionIds = []
10381
10472
  } = input;
@@ -10397,10 +10488,10 @@ async function runExtractVideosStage(input) {
10397
10488
  log?.info("Probing video color spaces...", { videoCount: composition.videos.length });
10398
10489
  const probeFailures = await Promise.all(
10399
10490
  composition.videos.map(async (v) => {
10400
- const videoPath = resolveProjectRelativeSrc3(v.src, projectDir, compiledDir);
10491
+ const videoPath = resolveProjectRelativeSrc4(v.src, projectDir, compiledDir);
10401
10492
  if (!existsSync13(videoPath)) return null;
10402
10493
  try {
10403
- const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await extractMediaMetadata3(videoPath), retries: 0 } : await runVideoExtractionWithRetry2(() => extractMediaMetadata3(videoPath), {
10494
+ const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await extractMediaMetadata4(videoPath), retries: 0 } : await runVideoExtractionWithRetry2(() => extractMediaMetadata4(videoPath), {
10404
10495
  signal: abortSignal,
10405
10496
  maxTransientRetries: extractionPolicy.maxTransientRetries,
10406
10497
  onRetry: () => {
@@ -10435,7 +10526,7 @@ async function runExtractVideosStage(input) {
10435
10526
  if (probesHdr && composition.images.length > 0) {
10436
10527
  const probed = await Promise.all(
10437
10528
  composition.images.map(async (img) => {
10438
- const imgPath = resolveProjectRelativeSrc3(img.src, projectDir, compiledDir);
10529
+ const imgPath = resolveProjectRelativeSrc4(img.src, projectDir, compiledDir);
10439
10530
  if (!existsSync13(imgPath)) return null;
10440
10531
  const colorSpace = await probeColorSpaceSafely(imgPath, log);
10441
10532
  if (isHdrColorSpace2(colorSpace)) {
@@ -10477,6 +10568,7 @@ async function runExtractVideosStage(input) {
10477
10568
  maxTransientRetries: extractionPolicy.maxTransientRetries,
10478
10569
  collectProbeFailures: extractionPolicy.failureMode === "enforce",
10479
10570
  deferRangeExtraction,
10571
+ shownBoxes,
10480
10572
  contentKeyedDirs: [join22(compiledDir, REMOTE_MEDIA_SUBDIR)],
10481
10573
  urlByAbsentLocalPath,
10482
10574
  onProgress: ({ planned = 0, done = 0 }) => {
@@ -10554,10 +10646,10 @@ async function appendVideoAudioFromProbe(input) {
10554
10646
  );
10555
10647
  const probed = await Promise.all(
10556
10648
  videos.map(async (video) => {
10557
- const path = isHttpUrl2(video.src) ? video.src : resolveProjectRelativeSrc3(video.src, projectDir, compiledDir);
10649
+ const path = isHttpUrl2(video.src) ? video.src : resolveProjectRelativeSrc4(video.src, projectDir, compiledDir);
10558
10650
  const readFrom = urlByAbsentLocalPath?.get(path) ?? path;
10559
10651
  if (!isHttpUrl2(readFrom) && !existsSync13(readFrom)) return null;
10560
- const metadata = await extractMediaMetadata3(readFrom);
10652
+ const metadata = await extractMediaMetadata4(readFrom);
10561
10653
  const window2 = await resolveFinalFrameExtractionWindow2(
10562
10654
  readFrom,
10563
10655
  video,
@@ -10581,7 +10673,7 @@ import {
10581
10673
  buildVideoLayerInput,
10582
10674
  isHttpUrl as isHttpUrl3,
10583
10675
  qualifyVideoLayer,
10584
- resolveProjectRelativeSrc as resolveProjectRelativeSrc4
10676
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc5
10585
10677
  } from "@hyperframes/engine";
10586
10678
  var SAMPLES = 9;
10587
10679
  function inspectVideoLayout(id, w, h, time) {
@@ -10643,7 +10735,7 @@ async function planVideoLayerPassthrough(input) {
10643
10735
  if (!q.qualifies) return { reason: q.reason };
10644
10736
  const { video } = q;
10645
10737
  if (isHttpUrl3(video.src)) return { reason: "remote_source" };
10646
- const path = resolveProjectRelativeSrc4(video.src, input.projectDir, input.compiledDir);
10738
+ const path = resolveProjectRelativeSrc5(video.src, input.projectDir, input.compiledDir);
10647
10739
  if (!existsSync14(path)) return { reason: "source_missing" };
10648
10740
  const layout = await probeVideoLayout(input.page, video.id, input.canvas, input.duration);
10649
10741
  if ("reason" in layout) return layout;
@@ -12026,8 +12118,8 @@ import { Worker } from "node:worker_threads";
12026
12118
  import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
12027
12119
  import { dirname as dirname11, join as join28 } from "node:path";
12028
12120
  import { createRequire } from "node:module";
12121
+ import { usableCpuCount } from "@hyperframes/engine";
12029
12122
  import { existsSync as existsSync18 } from "node:fs";
12030
- import { cpus as cpus2 } from "node:os";
12031
12123
  function resolveWorkerEntry(explicit) {
12032
12124
  if (explicit && explicit.length > 0) {
12033
12125
  return { path: explicit, isTs: explicit.endsWith(".ts") };
@@ -12059,7 +12151,7 @@ function buildExecArgv(entryIsTs) {
12059
12151
  return inherited;
12060
12152
  }
12061
12153
  async function createShaderTransitionWorkerPool(opts) {
12062
- const cpuCount = Math.max(1, cpus2().length);
12154
+ const cpuCount = Math.max(1, usableCpuCount());
12063
12155
  const size = Math.max(1, Math.min(opts.size, cpuCount));
12064
12156
  const log = opts.log ?? {};
12065
12157
  const { path: entry, isTs: entryIsTs } = resolveWorkerEntry(opts.workerEntryPath);
@@ -14516,6 +14608,12 @@ async function executeRenderPipeline(input) {
14516
14608
  );
14517
14609
  const subTimelineWaitMemo = {};
14518
14610
  const staticDedupMemo = {};
14611
+ const largerThanCanvas = await oversizedVideos(
14612
+ composition.videos,
14613
+ projectDir,
14614
+ join32(workDir, "compiled"),
14615
+ { width: outputWidth, height: outputHeight }
14616
+ );
14519
14617
  const probeResult = await observeRenderStage(
14520
14618
  observability,
14521
14619
  "browser_probe",
@@ -14523,6 +14621,7 @@ async function executeRenderPipeline(input) {
14523
14621
  () => runProbeStage({
14524
14622
  projectDir,
14525
14623
  workDir,
14624
+ measuresShownBoxes: largerThanCanvas.length > 0,
14526
14625
  job,
14527
14626
  cfg,
14528
14627
  forceScreenshot: captureForceScreenshot,
@@ -14548,6 +14647,7 @@ async function executeRenderPipeline(input) {
14548
14647
  compositionHash = computeCompositionObservabilityHash(compiled.html);
14549
14648
  fileServer = probeResult.fileServer;
14550
14649
  probeSession = probeResult.probeSession;
14650
+ const shownBoxes = largerThanCanvas.length > 0 && probeSession?.isInitialized ? await measureLocalShownBoxes(probeSession.page, largerThanCanvas, job.config.fps, log) : void 0;
14551
14651
  job.strictVariablesChecked = probeResult.strictVariablesChecked;
14552
14652
  lastBrowserConsole = probeResult.lastBrowserConsole;
14553
14653
  let resolvedCaptureBeyondViewport = probeSession?.options.captureBeyondViewport;
@@ -14653,6 +14753,7 @@ async function executeRenderPipeline(input) {
14653
14753
  // Local staging can use links; distributed plan() alone requires real copies.
14654
14754
  materializeSymlinks: false,
14655
14755
  deferRangeExtraction: windowVideoFrames ? true : void 0,
14756
+ shownBoxes,
14656
14757
  onProgress
14657
14758
  })
14658
14759
  );
@@ -14882,7 +14983,8 @@ async function executeRenderPipeline(input) {
14882
14983
  rootDir: workDir,
14883
14984
  cfg,
14884
14985
  injectorOptions: frameCacheOptions(cfg, workerCount),
14885
- abortSignal: executionSignal
14986
+ abortSignal: executionSignal,
14987
+ shownBoxes
14886
14988
  }),
14887
14989
  workDir,
14888
14990
  (bytes) => updateCaptureObservability({ videoFrameWindowPeakBytes: bytes })
@@ -14904,6 +15006,7 @@ async function executeRenderPipeline(input) {
14904
15006
  () => extractAllDeferredFrames(extracted, {
14905
15007
  fps: job.config.fps,
14906
15008
  cfg,
15009
+ shownBoxes,
14907
15010
  signal: executionSignal,
14908
15011
  maxTransientRetries: resolveVideoExtractionPolicy().maxTransientRetries,
14909
15012
  onProgress: (done, total) => reportExtractProgress(job, done, total, onProgress)
@@ -15646,7 +15749,7 @@ async function executeRenderPipeline(input) {
15646
15749
  completedSegments = await validateCompletedSegments(
15647
15750
  existing,
15648
15751
  segmentPlanHash,
15649
- (path) => probeSegmentFrameCount(path, extractMediaMetadata4)
15752
+ (path) => probeSegmentFrameCount(path, extractMediaMetadata5)
15650
15753
  );
15651
15754
  log.info(`[Render] resuming: ${completedSegments.size} segments complete`, {
15652
15755
  segmentDir
@@ -37,6 +37,7 @@ export declare function extractAllDeferredFrames(extracted: ExtractedFrames[], i
37
37
  cfg: Pick<EngineConfig, "ffmpegProcessTimeout">;
38
38
  signal?: AbortSignal;
39
39
  sourceOf?: (video: ExtractedFrames) => string;
40
+ shownBoxes?: ReadonlyMap<string, ShownBox>;
40
41
  maxTransientRetries?: number;
41
42
  onProgress?: (framesDone: number, framesTotal: number) => void;
42
43
  }): Promise<void>;
@@ -1,4 +1,4 @@
1
- import { createVideoFrameInjector, type BeforeCaptureHook, type EngineConfig, type ExtractedFrames, type VideoElement } from "@hyperframes/engine";
1
+ import { createVideoFrameInjector, type BeforeCaptureHook, type EngineConfig, type ExtractedFrames, type ShownBox, type VideoElement } from "@hyperframes/engine";
2
2
  import { extractDeferredFrames } from "./deferredVideoFrames.js";
3
3
  import type { SegmentSlice } from "./segmentPlan.js";
4
4
  export interface SegmentWorkerFrames {
@@ -36,6 +36,7 @@ export declare function createSegmentVideoFrames(input: {
36
36
  injectorOptions: Parameters<typeof createVideoFrameInjector>[1];
37
37
  abortSignal?: AbortSignal;
38
38
  sourceOf?: (video: ExtractedFrames) => string;
39
+ shownBoxes?: ReadonlyMap<string, ShownBox>;
39
40
  extractFrames?: FrameExtractor;
40
41
  }): SegmentVideoFrames;
41
42
  export {};
@@ -27,7 +27,7 @@
27
27
  * machines (symlinks don't survive S3 / GCS round-trips). Default
28
28
  * `false` preserves the in-process renderer's symlink behavior.
29
29
  */
30
- import { type CaptureVideoMetadataHint, type EngineConfig, type ExtractionResult, type FrameLookupTable, type HdrTransfer, type VideoExtractionFailureKind, type VideoColorSpace, classifyVideoExtractionError, extractAllVideoFrames } from "@hyperframes/engine";
30
+ import { type CaptureVideoMetadataHint, type EngineConfig, type ExtractionResult, type FrameLookupTable, type HdrTransfer, type VideoExtractionFailureKind, type VideoColorSpace, classifyVideoExtractionError, extractAllVideoFrames, type ShownBox } from "@hyperframes/engine";
31
31
  import { type RenderJob } from "../../renderOrchestrator.js";
32
32
  import { type CompositionMetadata } from "../shared.js";
33
33
  import type { ProgressCallback } from "../../renderOrchestrator.js";
@@ -52,6 +52,7 @@ export interface ExtractVideosStageInput {
52
52
  */
53
53
  materializeSymlinks?: boolean;
54
54
  deferRangeExtraction?: boolean;
55
+ shownBoxes?: ReadonlyMap<string, ShownBox>;
55
56
  skipFrameExtractionIds?: readonly string[];
56
57
  urlByAbsentLocalPath?: ReadonlyMap<string, string>;
57
58
  onProgress?: ProgressCallback;
@@ -34,6 +34,7 @@ import type { RenderConfig, RenderJob } from "../../renderOrchestrator.js";
34
34
  export interface ProbeStageInput {
35
35
  projectDir: string;
36
36
  workDir: string;
37
+ measuresShownBoxes?: boolean;
37
38
  recordReferenceBackground?: CaptureOptions["recordReferenceBackground"];
38
39
  job: RenderJob;
39
40
  cfg: EngineConfig;
@@ -0,0 +1,21 @@
1
+ import { type ShownBox, type VideoElement } from "@hyperframes/engine";
2
+ import type { Page } from "puppeteer-core";
3
+ import type { ProducerLogger } from "../../logger.js";
4
+ /** Local videos whose source is larger than the canvas: only these can be extracted smaller. */
5
+ export declare function oversizedVideos(videos: readonly VideoElement[], projectDir: string, compiledDir: string, canvas: {
6
+ width: number;
7
+ height: number;
8
+ }): Promise<VideoElement[]>;
9
+ /** Each video's first and last frame and every stride between, in composition seconds, ascending. */
10
+ export declare function shownBoxTimes(videos: readonly VideoElement[], fps: {
11
+ num: number;
12
+ den: number;
13
+ }): number[];
14
+ /**
15
+ * The box to extract each video at: the largest it is drawn at, plus headroom when it moves. Undefined when
16
+ * the measure fails, and every video then keeps its full size.
17
+ */
18
+ export declare function measureLocalShownBoxes(page: Page, videos: readonly VideoElement[], fps: {
19
+ num: number;
20
+ den: number;
21
+ }, log: ProducerLogger): Promise<Map<string, ShownBox> | undefined>;
@@ -40,7 +40,7 @@ interface PoolLogger {
40
40
  error?: (msg: string, meta?: Record<string, unknown>) => void;
41
41
  }
42
42
  export interface ShaderTransitionPoolOptions {
43
- /** Number of worker threads. Clamped to [1, cpus().length]. */
43
+ /** Number of worker threads. Clamped to [1, usableCpuCount()]. */
44
44
  size: number;
45
45
  /** Optional logger; falls back to no-op. */
46
46
  log?: PoolLogger;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/producer",
3
- "version": "0.9.39",
3
+ "version": "0.9.41",
4
4
  "description": "HTML-to-video rendering engine using Chrome's BeginFrame API",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,11 +35,11 @@
35
35
  "postcss": "^8.4.0",
36
36
  "puppeteer": "~25.11.0",
37
37
  "puppeteer-core": "^25.11.0",
38
- "@hyperframes/engine": "0.9.39",
39
- "@hyperframes/lint": "0.9.39",
40
- "@hyperframes/core": "0.9.39",
41
- "@hyperframes/parsers": "0.9.39",
42
- "@hyperframes/studio-server": "0.9.39"
38
+ "@hyperframes/core": "0.9.41",
39
+ "@hyperframes/engine": "0.9.41",
40
+ "@hyperframes/lint": "0.9.41",
41
+ "@hyperframes/studio-server": "0.9.41",
42
+ "@hyperframes/parsers": "0.9.41"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "^25.0.10",
@@ -48,7 +48,7 @@
48
48
  "tsx": "^4.21.0",
49
49
  "typescript": "^5.7.2",
50
50
  "vitest": "^4.1.11",
51
- "@hyperframes/aws-lambda": "0.9.39"
51
+ "@hyperframes/aws-lambda": "0.9.41"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=22"