@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.
- package/dist/distributed.js +31 -17
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +68 -68
- package/dist/index.js +114 -25
- package/dist/public-server.js +111 -22
- package/dist/services/render/deferredVideoFrames.d.ts +1 -0
- package/dist/services/render/segmentVideoFrames.d.ts +2 -1
- package/dist/services/render/stages/extractVideosStage.d.ts +2 -1
- package/dist/services/render/stages/probeStage.d.ts +1 -0
- package/dist/services/render/videoShownBoxes.d.ts +21 -0
- package/dist/services/shaderTransitionWorkerPool.d.ts +1 -1
- package/package.json +7 -7
package/dist/public-server.js
CHANGED
|
@@ -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
|
|
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,
|
|
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:
|
|
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
|
-
{
|
|
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
|
)
|
|
@@ -7333,7 +7408,7 @@ import {
|
|
|
7333
7408
|
isNotMediaPayload,
|
|
7334
7409
|
NotMediaPayloadError,
|
|
7335
7410
|
probeMediaProfile,
|
|
7336
|
-
resolveProjectRelativeSrc as
|
|
7411
|
+
resolveProjectRelativeSrc as resolveProjectRelativeSrc3
|
|
7337
7412
|
} from "@hyperframes/engine";
|
|
7338
7413
|
var ASSET_MEDIA_TYPE_MISMATCH = "ASSET_MEDIA_TYPE_MISMATCH";
|
|
7339
7414
|
var AssetMediaTypeMismatchError = class extends Error {
|
|
@@ -7380,7 +7455,7 @@ function dropMediaOutsideProject(input) {
|
|
|
7380
7455
|
const roots = [projectDir, compiledDir, join18(workDir, "downloads")];
|
|
7381
7456
|
const staysInside = ({ id, src }) => {
|
|
7382
7457
|
if (!src || isRemoteOrInlineSource(src)) return true;
|
|
7383
|
-
const path =
|
|
7458
|
+
const path = resolveProjectRelativeSrc3(src, projectDir, compiledDir);
|
|
7384
7459
|
if (roots.some((root) => !escapesAssetRoot(path, root))) return true;
|
|
7385
7460
|
log.warn(`[Render] Media "${id}" source is missing: it is outside the project folder`, { src });
|
|
7386
7461
|
return false;
|
|
@@ -7410,7 +7485,7 @@ async function preflightCompositionAssetMediaTypes(input) {
|
|
|
7410
7485
|
const byPath = /* @__PURE__ */ new Map();
|
|
7411
7486
|
for (const reference of references) {
|
|
7412
7487
|
if (!reference.src || isRemoteOrInlineSource(reference.src)) continue;
|
|
7413
|
-
const resolvedPath =
|
|
7488
|
+
const resolvedPath = resolveProjectRelativeSrc3(
|
|
7414
7489
|
reference.src,
|
|
7415
7490
|
input.projectDir,
|
|
7416
7491
|
input.compiledDir
|
|
@@ -9615,7 +9690,7 @@ async function runProbeStage(input) {
|
|
|
9615
9690
|
);
|
|
9616
9691
|
const hasVariableMedia = hasVariableBoundMedia(compiled.html, job.config.variables);
|
|
9617
9692
|
const hasInsertedMedia = hasRuntimeMediaChanges(compiled.html);
|
|
9618
|
-
const needsBrowser = cfg.videoLayerPassthrough || probeRequiresBrowser({
|
|
9693
|
+
const needsBrowser = cfg.videoLayerPassthrough || input.measuresShownBoxes === true || probeRequiresBrowser({
|
|
9619
9694
|
durationSeconds: composition.duration,
|
|
9620
9695
|
unresolvedCompositionCount: compiled.unresolvedCompositions.length,
|
|
9621
9696
|
hasAutoStart,
|
|
@@ -9634,6 +9709,7 @@ async function runProbeStage(input) {
|
|
|
9634
9709
|
if (hasScriptedAudio) reasons.push("scripted audio volume");
|
|
9635
9710
|
if (hasInsertedMedia) reasons.push("runtime-created or source-mutated media");
|
|
9636
9711
|
if (hasVariableMedia) reasons.push("variable-bound media source(s)");
|
|
9712
|
+
if (input.measuresShownBoxes) reasons.push("video(s) larger than the canvas");
|
|
9637
9713
|
log.info("Launching browser for composition probe...", {
|
|
9638
9714
|
reasons
|
|
9639
9715
|
});
|
|
@@ -10135,7 +10211,7 @@ import {
|
|
|
10135
10211
|
createFrameLookupTable as createFrameLookupTable3,
|
|
10136
10212
|
detectTransfer,
|
|
10137
10213
|
extractAllVideoFrames,
|
|
10138
|
-
extractMediaMetadata as
|
|
10214
|
+
extractMediaMetadata as extractMediaMetadata4,
|
|
10139
10215
|
gradingKeepsSdr as gradingKeepsSdr2,
|
|
10140
10216
|
isVideoPastTimelineEnd,
|
|
10141
10217
|
isHdrColorSpace as isHdrColorSpace2,
|
|
@@ -10143,7 +10219,7 @@ import {
|
|
|
10143
10219
|
resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
|
|
10144
10220
|
resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
|
|
10145
10221
|
isHttpUrl as isHttpUrl2,
|
|
10146
|
-
resolveProjectRelativeSrc as
|
|
10222
|
+
resolveProjectRelativeSrc as resolveProjectRelativeSrc4,
|
|
10147
10223
|
runVideoExtractionWithRetry as runVideoExtractionWithRetry2,
|
|
10148
10224
|
safeVideoExtractionSourceIdentity,
|
|
10149
10225
|
videoAudioId as videoAudioId2
|
|
@@ -10354,7 +10430,7 @@ function applyVideoExtractionFailurePolicy(result, policy, log) {
|
|
|
10354
10430
|
}
|
|
10355
10431
|
async function probeColorSpaceSafely(path, log) {
|
|
10356
10432
|
try {
|
|
10357
|
-
const meta = await
|
|
10433
|
+
const meta = await extractMediaMetadata4(path);
|
|
10358
10434
|
return meta.colorSpace;
|
|
10359
10435
|
} catch (error) {
|
|
10360
10436
|
log?.warn("HDR color-space probe failed; treating source as SDR", {
|
|
@@ -10376,6 +10452,7 @@ async function runExtractVideosStage(input) {
|
|
|
10376
10452
|
assertNotAborted,
|
|
10377
10453
|
materializeSymlinks,
|
|
10378
10454
|
deferRangeExtraction,
|
|
10455
|
+
shownBoxes,
|
|
10379
10456
|
urlByAbsentLocalPath,
|
|
10380
10457
|
skipFrameExtractionIds = []
|
|
10381
10458
|
} = input;
|
|
@@ -10397,10 +10474,10 @@ async function runExtractVideosStage(input) {
|
|
|
10397
10474
|
log?.info("Probing video color spaces...", { videoCount: composition.videos.length });
|
|
10398
10475
|
const probeFailures = await Promise.all(
|
|
10399
10476
|
composition.videos.map(async (v) => {
|
|
10400
|
-
const videoPath =
|
|
10477
|
+
const videoPath = resolveProjectRelativeSrc4(v.src, projectDir, compiledDir);
|
|
10401
10478
|
if (!existsSync13(videoPath)) return null;
|
|
10402
10479
|
try {
|
|
10403
|
-
const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await
|
|
10480
|
+
const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await extractMediaMetadata4(videoPath), retries: 0 } : await runVideoExtractionWithRetry2(() => extractMediaMetadata4(videoPath), {
|
|
10404
10481
|
signal: abortSignal,
|
|
10405
10482
|
maxTransientRetries: extractionPolicy.maxTransientRetries,
|
|
10406
10483
|
onRetry: () => {
|
|
@@ -10435,7 +10512,7 @@ async function runExtractVideosStage(input) {
|
|
|
10435
10512
|
if (probesHdr && composition.images.length > 0) {
|
|
10436
10513
|
const probed = await Promise.all(
|
|
10437
10514
|
composition.images.map(async (img) => {
|
|
10438
|
-
const imgPath =
|
|
10515
|
+
const imgPath = resolveProjectRelativeSrc4(img.src, projectDir, compiledDir);
|
|
10439
10516
|
if (!existsSync13(imgPath)) return null;
|
|
10440
10517
|
const colorSpace = await probeColorSpaceSafely(imgPath, log);
|
|
10441
10518
|
if (isHdrColorSpace2(colorSpace)) {
|
|
@@ -10477,6 +10554,7 @@ async function runExtractVideosStage(input) {
|
|
|
10477
10554
|
maxTransientRetries: extractionPolicy.maxTransientRetries,
|
|
10478
10555
|
collectProbeFailures: extractionPolicy.failureMode === "enforce",
|
|
10479
10556
|
deferRangeExtraction,
|
|
10557
|
+
shownBoxes,
|
|
10480
10558
|
contentKeyedDirs: [join22(compiledDir, REMOTE_MEDIA_SUBDIR)],
|
|
10481
10559
|
urlByAbsentLocalPath,
|
|
10482
10560
|
onProgress: ({ planned = 0, done = 0 }) => {
|
|
@@ -10554,10 +10632,10 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
10554
10632
|
);
|
|
10555
10633
|
const probed = await Promise.all(
|
|
10556
10634
|
videos.map(async (video) => {
|
|
10557
|
-
const path = isHttpUrl2(video.src) ? video.src :
|
|
10635
|
+
const path = isHttpUrl2(video.src) ? video.src : resolveProjectRelativeSrc4(video.src, projectDir, compiledDir);
|
|
10558
10636
|
const readFrom = urlByAbsentLocalPath?.get(path) ?? path;
|
|
10559
10637
|
if (!isHttpUrl2(readFrom) && !existsSync13(readFrom)) return null;
|
|
10560
|
-
const metadata = await
|
|
10638
|
+
const metadata = await extractMediaMetadata4(readFrom);
|
|
10561
10639
|
const window2 = await resolveFinalFrameExtractionWindow2(
|
|
10562
10640
|
readFrom,
|
|
10563
10641
|
video,
|
|
@@ -10581,7 +10659,7 @@ import {
|
|
|
10581
10659
|
buildVideoLayerInput,
|
|
10582
10660
|
isHttpUrl as isHttpUrl3,
|
|
10583
10661
|
qualifyVideoLayer,
|
|
10584
|
-
resolveProjectRelativeSrc as
|
|
10662
|
+
resolveProjectRelativeSrc as resolveProjectRelativeSrc5
|
|
10585
10663
|
} from "@hyperframes/engine";
|
|
10586
10664
|
var SAMPLES = 9;
|
|
10587
10665
|
function inspectVideoLayout(id, w, h, time) {
|
|
@@ -10643,7 +10721,7 @@ async function planVideoLayerPassthrough(input) {
|
|
|
10643
10721
|
if (!q.qualifies) return { reason: q.reason };
|
|
10644
10722
|
const { video } = q;
|
|
10645
10723
|
if (isHttpUrl3(video.src)) return { reason: "remote_source" };
|
|
10646
|
-
const path =
|
|
10724
|
+
const path = resolveProjectRelativeSrc5(video.src, input.projectDir, input.compiledDir);
|
|
10647
10725
|
if (!existsSync14(path)) return { reason: "source_missing" };
|
|
10648
10726
|
const layout = await probeVideoLayout(input.page, video.id, input.canvas, input.duration);
|
|
10649
10727
|
if ("reason" in layout) return layout;
|
|
@@ -12026,8 +12104,8 @@ import { Worker } from "node:worker_threads";
|
|
|
12026
12104
|
import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
|
|
12027
12105
|
import { dirname as dirname11, join as join28 } from "node:path";
|
|
12028
12106
|
import { createRequire } from "node:module";
|
|
12107
|
+
import { usableCpuCount } from "@hyperframes/engine";
|
|
12029
12108
|
import { existsSync as existsSync18 } from "node:fs";
|
|
12030
|
-
import { cpus as cpus2 } from "node:os";
|
|
12031
12109
|
function resolveWorkerEntry(explicit) {
|
|
12032
12110
|
if (explicit && explicit.length > 0) {
|
|
12033
12111
|
return { path: explicit, isTs: explicit.endsWith(".ts") };
|
|
@@ -12059,7 +12137,7 @@ function buildExecArgv(entryIsTs) {
|
|
|
12059
12137
|
return inherited;
|
|
12060
12138
|
}
|
|
12061
12139
|
async function createShaderTransitionWorkerPool(opts) {
|
|
12062
|
-
const cpuCount = Math.max(1,
|
|
12140
|
+
const cpuCount = Math.max(1, usableCpuCount());
|
|
12063
12141
|
const size = Math.max(1, Math.min(opts.size, cpuCount));
|
|
12064
12142
|
const log = opts.log ?? {};
|
|
12065
12143
|
const { path: entry, isTs: entryIsTs } = resolveWorkerEntry(opts.workerEntryPath);
|
|
@@ -14516,6 +14594,12 @@ async function executeRenderPipeline(input) {
|
|
|
14516
14594
|
);
|
|
14517
14595
|
const subTimelineWaitMemo = {};
|
|
14518
14596
|
const staticDedupMemo = {};
|
|
14597
|
+
const largerThanCanvas = await oversizedVideos(
|
|
14598
|
+
composition.videos,
|
|
14599
|
+
projectDir,
|
|
14600
|
+
join32(workDir, "compiled"),
|
|
14601
|
+
{ width: outputWidth, height: outputHeight }
|
|
14602
|
+
);
|
|
14519
14603
|
const probeResult = await observeRenderStage(
|
|
14520
14604
|
observability,
|
|
14521
14605
|
"browser_probe",
|
|
@@ -14523,6 +14607,7 @@ async function executeRenderPipeline(input) {
|
|
|
14523
14607
|
() => runProbeStage({
|
|
14524
14608
|
projectDir,
|
|
14525
14609
|
workDir,
|
|
14610
|
+
measuresShownBoxes: largerThanCanvas.length > 0,
|
|
14526
14611
|
job,
|
|
14527
14612
|
cfg,
|
|
14528
14613
|
forceScreenshot: captureForceScreenshot,
|
|
@@ -14548,6 +14633,7 @@ async function executeRenderPipeline(input) {
|
|
|
14548
14633
|
compositionHash = computeCompositionObservabilityHash(compiled.html);
|
|
14549
14634
|
fileServer = probeResult.fileServer;
|
|
14550
14635
|
probeSession = probeResult.probeSession;
|
|
14636
|
+
const shownBoxes = largerThanCanvas.length > 0 && probeSession?.isInitialized ? await measureLocalShownBoxes(probeSession.page, largerThanCanvas, job.config.fps, log) : void 0;
|
|
14551
14637
|
job.strictVariablesChecked = probeResult.strictVariablesChecked;
|
|
14552
14638
|
lastBrowserConsole = probeResult.lastBrowserConsole;
|
|
14553
14639
|
let resolvedCaptureBeyondViewport = probeSession?.options.captureBeyondViewport;
|
|
@@ -14653,6 +14739,7 @@ async function executeRenderPipeline(input) {
|
|
|
14653
14739
|
// Local staging can use links; distributed plan() alone requires real copies.
|
|
14654
14740
|
materializeSymlinks: false,
|
|
14655
14741
|
deferRangeExtraction: windowVideoFrames ? true : void 0,
|
|
14742
|
+
shownBoxes,
|
|
14656
14743
|
onProgress
|
|
14657
14744
|
})
|
|
14658
14745
|
);
|
|
@@ -14882,7 +14969,8 @@ async function executeRenderPipeline(input) {
|
|
|
14882
14969
|
rootDir: workDir,
|
|
14883
14970
|
cfg,
|
|
14884
14971
|
injectorOptions: frameCacheOptions(cfg, workerCount),
|
|
14885
|
-
abortSignal: executionSignal
|
|
14972
|
+
abortSignal: executionSignal,
|
|
14973
|
+
shownBoxes
|
|
14886
14974
|
}),
|
|
14887
14975
|
workDir,
|
|
14888
14976
|
(bytes) => updateCaptureObservability({ videoFrameWindowPeakBytes: bytes })
|
|
@@ -14904,6 +14992,7 @@ async function executeRenderPipeline(input) {
|
|
|
14904
14992
|
() => extractAllDeferredFrames(extracted, {
|
|
14905
14993
|
fps: job.config.fps,
|
|
14906
14994
|
cfg,
|
|
14995
|
+
shownBoxes,
|
|
14907
14996
|
signal: executionSignal,
|
|
14908
14997
|
maxTransientRetries: resolveVideoExtractionPolicy().maxTransientRetries,
|
|
14909
14998
|
onProgress: (done, total) => reportExtractProgress(job, done, total, onProgress)
|
|
@@ -15646,7 +15735,7 @@ async function executeRenderPipeline(input) {
|
|
|
15646
15735
|
completedSegments = await validateCompletedSegments(
|
|
15647
15736
|
existing,
|
|
15648
15737
|
segmentPlanHash,
|
|
15649
|
-
(path) => probeSegmentFrameCount(path,
|
|
15738
|
+
(path) => probeSegmentFrameCount(path, extractMediaMetadata5)
|
|
15650
15739
|
);
|
|
15651
15740
|
log.info(`[Render] resuming: ${completedSegments.size} segments complete`, {
|
|
15652
15741
|
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,
|
|
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.
|
|
3
|
+
"version": "0.9.40",
|
|
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/
|
|
39
|
-
"@hyperframes/lint": "0.9.
|
|
40
|
-
"@hyperframes/
|
|
41
|
-
"@hyperframes/parsers": "0.9.
|
|
42
|
-
"@hyperframes/
|
|
38
|
+
"@hyperframes/core": "0.9.40",
|
|
39
|
+
"@hyperframes/lint": "0.9.40",
|
|
40
|
+
"@hyperframes/studio-server": "0.9.40",
|
|
41
|
+
"@hyperframes/parsers": "0.9.40",
|
|
42
|
+
"@hyperframes/engine": "0.9.40"
|
|
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.
|
|
51
|
+
"@hyperframes/aws-lambda": "0.9.40"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22"
|