@hyperframes/producer 0.9.39 → 0.9.40

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.
@@ -95,7 +95,7 @@ import {
95
95
  import { HF_AUDIO_GROUP_TAG } from "@hyperframes/core/audio-groups";
96
96
  import { HTML_BODY_CSS_HEIGHT_FIRST_RE, HTML_BODY_CSS_WIDTH_FIRST_RE } from "@hyperframes/parsers";
97
97
  import {
98
- extractMediaMetadata as extractMediaMetadata4,
98
+ extractMediaMetadata as extractMediaMetadata5,
99
99
  resolveConfig as resolveConfig2,
100
100
  closeCaptureSession as closeCaptureSession8,
101
101
  createCaptureSession as createCaptureSession8,
@@ -1423,6 +1423,7 @@ import { CaptureFailure, classifyCaptureFailure } from "@hyperframes/engine";
1423
1423
 
1424
1424
  // src/services/render/perfSummary.ts
1425
1425
  import { fpsToNumber as fpsToNumber2 } from "@hyperframes/core";
1426
+ import { hostCpuCount } from "@hyperframes/engine";
1426
1427
  function pushWorkerDedupPerfs(results, sink) {
1427
1428
  for (const r of results) {
1428
1429
  if (r.perf) sink.push(r.perf);
@@ -1791,6 +1792,13 @@ async function extractDeferredFrames(input) {
1791
1792
  );
1792
1793
  }
1793
1794
 
1795
+ // src/services/render/videoShownBoxes.ts
1796
+ import {
1797
+ extractMediaMetadata as extractMediaMetadata3,
1798
+ measureVideoShownBoxRanges,
1799
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc2
1800
+ } from "@hyperframes/engine";
1801
+
1794
1802
  // src/services/render/segmentVideoFrames.ts
1795
1803
  import {
1796
1804
  createFrameLookupTable as createFrameLookupTable2,
@@ -3097,7 +3105,7 @@ import {
3097
3105
  isNotMediaPayload,
3098
3106
  NotMediaPayloadError,
3099
3107
  probeMediaProfile,
3100
- resolveProjectRelativeSrc as resolveProjectRelativeSrc2
3108
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc3
3101
3109
  } from "@hyperframes/engine";
3102
3110
  var ASSET_MEDIA_TYPE_MISMATCH = "ASSET_MEDIA_TYPE_MISMATCH";
3103
3111
  var AssetMediaTypeMismatchError = class extends Error {
@@ -3144,7 +3152,7 @@ function dropMediaOutsideProject(input) {
3144
3152
  const roots = [projectDir, compiledDir, join8(workDir, "downloads")];
3145
3153
  const staysInside = ({ id, src }) => {
3146
3154
  if (!src || isRemoteOrInlineSource(src)) return true;
3147
- const path = resolveProjectRelativeSrc2(src, projectDir, compiledDir);
3155
+ const path = resolveProjectRelativeSrc3(src, projectDir, compiledDir);
3148
3156
  if (roots.some((root) => !escapesAssetRoot(path, root))) return true;
3149
3157
  log.warn(`[Render] Media "${id}" source is missing: it is outside the project folder`, { src });
3150
3158
  return false;
@@ -3174,7 +3182,7 @@ async function preflightCompositionAssetMediaTypes(input) {
3174
3182
  const byPath = /* @__PURE__ */ new Map();
3175
3183
  for (const reference of references) {
3176
3184
  if (!reference.src || isRemoteOrInlineSource(reference.src)) continue;
3177
- const resolvedPath = resolveProjectRelativeSrc2(
3185
+ const resolvedPath = resolveProjectRelativeSrc3(
3178
3186
  reference.src,
3179
3187
  input.projectDir,
3180
3188
  input.compiledDir
@@ -5379,7 +5387,7 @@ async function runProbeStage(input) {
5379
5387
  );
5380
5388
  const hasVariableMedia = hasVariableBoundMedia(compiled.html, job.config.variables);
5381
5389
  const hasInsertedMedia = hasRuntimeMediaChanges(compiled.html);
5382
- const needsBrowser = cfg.videoLayerPassthrough || probeRequiresBrowser({
5390
+ const needsBrowser = cfg.videoLayerPassthrough || input.measuresShownBoxes === true || probeRequiresBrowser({
5383
5391
  durationSeconds: composition.duration,
5384
5392
  unresolvedCompositionCount: compiled.unresolvedCompositions.length,
5385
5393
  hasAutoStart,
@@ -5398,6 +5406,7 @@ async function runProbeStage(input) {
5398
5406
  if (hasScriptedAudio) reasons.push("scripted audio volume");
5399
5407
  if (hasInsertedMedia) reasons.push("runtime-created or source-mutated media");
5400
5408
  if (hasVariableMedia) reasons.push("variable-bound media source(s)");
5409
+ if (input.measuresShownBoxes) reasons.push("video(s) larger than the canvas");
5401
5410
  log.info("Launching browser for composition probe...", {
5402
5411
  reasons
5403
5412
  });
@@ -5931,7 +5940,7 @@ import {
5931
5940
  createFrameLookupTable as createFrameLookupTable3,
5932
5941
  detectTransfer,
5933
5942
  extractAllVideoFrames,
5934
- extractMediaMetadata as extractMediaMetadata3,
5943
+ extractMediaMetadata as extractMediaMetadata4,
5935
5944
  gradingKeepsSdr as gradingKeepsSdr2,
5936
5945
  isVideoPastTimelineEnd,
5937
5946
  isHdrColorSpace as isHdrColorSpace2,
@@ -5939,7 +5948,7 @@ import {
5939
5948
  resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
5940
5949
  resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
5941
5950
  isHttpUrl as isHttpUrl2,
5942
- resolveProjectRelativeSrc as resolveProjectRelativeSrc3,
5951
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc4,
5943
5952
  runVideoExtractionWithRetry as runVideoExtractionWithRetry2,
5944
5953
  safeVideoExtractionSourceIdentity,
5945
5954
  videoAudioId as videoAudioId2
@@ -6155,7 +6164,7 @@ function applyVideoExtractionFailurePolicy(result, policy, log) {
6155
6164
  }
6156
6165
  async function probeColorSpaceSafely(path, log) {
6157
6166
  try {
6158
- const meta = await extractMediaMetadata3(path);
6167
+ const meta = await extractMediaMetadata4(path);
6159
6168
  return meta.colorSpace;
6160
6169
  } catch (error) {
6161
6170
  log?.warn("HDR color-space probe failed; treating source as SDR", {
@@ -6177,6 +6186,7 @@ async function runExtractVideosStage(input) {
6177
6186
  assertNotAborted,
6178
6187
  materializeSymlinks,
6179
6188
  deferRangeExtraction,
6189
+ shownBoxes,
6180
6190
  urlByAbsentLocalPath,
6181
6191
  skipFrameExtractionIds = []
6182
6192
  } = input;
@@ -6198,10 +6208,10 @@ async function runExtractVideosStage(input) {
6198
6208
  log?.info("Probing video color spaces...", { videoCount: composition.videos.length });
6199
6209
  const probeFailures = await Promise.all(
6200
6210
  composition.videos.map(async (v) => {
6201
- const videoPath = resolveProjectRelativeSrc3(v.src, projectDir, compiledDir);
6211
+ const videoPath = resolveProjectRelativeSrc4(v.src, projectDir, compiledDir);
6202
6212
  if (!existsSync9(videoPath)) return null;
6203
6213
  try {
6204
- const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await extractMediaMetadata3(videoPath), retries: 0 } : await runVideoExtractionWithRetry2(() => extractMediaMetadata3(videoPath), {
6214
+ const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await extractMediaMetadata4(videoPath), retries: 0 } : await runVideoExtractionWithRetry2(() => extractMediaMetadata4(videoPath), {
6205
6215
  signal: abortSignal,
6206
6216
  maxTransientRetries: extractionPolicy.maxTransientRetries,
6207
6217
  onRetry: () => {
@@ -6236,7 +6246,7 @@ async function runExtractVideosStage(input) {
6236
6246
  if (probesHdr && composition.images.length > 0) {
6237
6247
  const probed = await Promise.all(
6238
6248
  composition.images.map(async (img) => {
6239
- const imgPath = resolveProjectRelativeSrc3(img.src, projectDir, compiledDir);
6249
+ const imgPath = resolveProjectRelativeSrc4(img.src, projectDir, compiledDir);
6240
6250
  if (!existsSync9(imgPath)) return null;
6241
6251
  const colorSpace = await probeColorSpaceSafely(imgPath, log);
6242
6252
  if (isHdrColorSpace2(colorSpace)) {
@@ -6278,6 +6288,7 @@ async function runExtractVideosStage(input) {
6278
6288
  maxTransientRetries: extractionPolicy.maxTransientRetries,
6279
6289
  collectProbeFailures: extractionPolicy.failureMode === "enforce",
6280
6290
  deferRangeExtraction,
6291
+ shownBoxes,
6281
6292
  contentKeyedDirs: [join12(compiledDir, REMOTE_MEDIA_SUBDIR)],
6282
6293
  urlByAbsentLocalPath,
6283
6294
  onProgress: ({ planned = 0, done = 0 }) => {
@@ -6355,10 +6366,10 @@ async function appendVideoAudioFromProbe(input) {
6355
6366
  );
6356
6367
  const probed = await Promise.all(
6357
6368
  videos.map(async (video) => {
6358
- const path = isHttpUrl2(video.src) ? video.src : resolveProjectRelativeSrc3(video.src, projectDir, compiledDir);
6369
+ const path = isHttpUrl2(video.src) ? video.src : resolveProjectRelativeSrc4(video.src, projectDir, compiledDir);
6359
6370
  const readFrom = urlByAbsentLocalPath?.get(path) ?? path;
6360
6371
  if (!isHttpUrl2(readFrom) && !existsSync9(readFrom)) return null;
6361
- const metadata = await extractMediaMetadata3(readFrom);
6372
+ const metadata = await extractMediaMetadata4(readFrom);
6362
6373
  const window2 = await resolveFinalFrameExtractionWindow2(
6363
6374
  readFrom,
6364
6375
  video,
@@ -6381,7 +6392,7 @@ import {
6381
6392
  buildVideoLayerInput,
6382
6393
  isHttpUrl as isHttpUrl3,
6383
6394
  qualifyVideoLayer,
6384
- resolveProjectRelativeSrc as resolveProjectRelativeSrc4
6395
+ resolveProjectRelativeSrc as resolveProjectRelativeSrc5
6385
6396
  } from "@hyperframes/engine";
6386
6397
 
6387
6398
  // src/services/render/stages/audioStage.ts
@@ -7518,6 +7529,9 @@ import {
7518
7529
  initializeSession as initializeSession6
7519
7530
  } from "@hyperframes/engine";
7520
7531
 
7532
+ // src/services/shaderTransitionWorkerPool.ts
7533
+ import { usableCpuCount } from "@hyperframes/engine";
7534
+
7521
7535
  // src/services/render/stages/encodeStage.ts
7522
7536
  import {
7523
7537
  copyFileSync as copyFileSync4,
@@ -12190,7 +12204,6 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
12190
12204
  // src/services/distributed/renderChunk.ts
12191
12205
  import { randomBytes } from "node:crypto";
12192
12206
  import { existsSync as existsSync23, mkdirSync as mkdirSync14, readFileSync as readFileSync12, readdirSync as readdirSync9, rmSync as rmSync11, writeFileSync as writeFileSync12 } from "node:fs";
12193
- import { cpus } from "node:os";
12194
12207
  import { join as join32 } from "node:path";
12195
12208
  import {
12196
12209
  assertSwiftShader,
@@ -12206,7 +12219,8 @@ import {
12206
12219
  measureVideoShownBoxes,
12207
12220
  probeBeginFrameLiveness as probeBeginFrameLiveness2,
12208
12221
  readWebGlVendorInfoFromCanvas,
12209
- resolveConfig as resolveConfig5
12222
+ resolveConfig as resolveConfig5,
12223
+ usableCpuCount as usableCpuCount2
12210
12224
  } from "@hyperframes/engine";
12211
12225
  import { readWebGlVendorInfoFromCanvas as readWebGlVendorInfoFromCanvas2 } from "@hyperframes/engine";
12212
12226
  var LEGACY_DISTRIBUTED_VP9_CPU_USED = 2;
@@ -12736,7 +12750,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
12736
12750
  const captureSession = session;
12737
12751
  session = null;
12738
12752
  verifyStarted = Date.now();
12739
- overlap.current = canEncodeWhileCapturing(encodeInput, chunkWorkerCount, cpus().length) ? encodeWhileCapturing(encodeInput, framesInChunk) : null;
12753
+ overlap.current = canEncodeWhileCapturing(encodeInput, chunkWorkerCount, usableCpuCount2()) ? encodeWhileCapturing(encodeInput, framesInChunk) : null;
12740
12754
  await observeRenderStage(
12741
12755
  new RenderObservabilityRecorder({ pipelineStartMs: start, log }),
12742
12756
  "capture_chunk",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "0.1.0",
3
3
  "buildId": "dev",
4
- "sha256": "7dc17433766284f678076b4c1cf80ef4a34d88cd34e193ec2966c48a338810be",
4
+ "sha256": "15ceaa5025a85e0af724e23a20ae8e6671c67c1680fa0c9736708f42f1676e3f",
5
5
  "artifacts": {
6
6
  "iife": "hyperframe.runtime.iife.js",
7
7
  "esm": "hyperframe.runtime.mjs"