@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/distributed.js +48 -20
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +72 -72
- package/dist/index.js +131 -28
- package/dist/public-server.js +128 -25
- 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/distributed.js
CHANGED
|
@@ -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
|
|
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,
|
|
@@ -2223,6 +2231,7 @@ import {
|
|
|
2223
2231
|
rewriteInlineStyleAssetUrls
|
|
2224
2232
|
} from "@hyperframes/core";
|
|
2225
2233
|
import { MAX_AUDIO_GAIN } from "@hyperframes/core/audio-gain";
|
|
2234
|
+
import { CAPTURE_CANVAS_SELECTOR } from "@hyperframes/core/html-in-canvas";
|
|
2226
2235
|
import { readPlaybackRate } from "@hyperframes/parsers/media-duration";
|
|
2227
2236
|
import { resolveRateSpec } from "@hyperframes/core/speed-ramp";
|
|
2228
2237
|
import { gsapCdnDist as gsapCdnDist2, normalizeGsapBaseUrl } from "@hyperframes/core/gsap-cdn";
|
|
@@ -3097,7 +3106,7 @@ import {
|
|
|
3097
3106
|
isNotMediaPayload,
|
|
3098
3107
|
NotMediaPayloadError,
|
|
3099
3108
|
probeMediaProfile,
|
|
3100
|
-
resolveProjectRelativeSrc as
|
|
3109
|
+
resolveProjectRelativeSrc as resolveProjectRelativeSrc3
|
|
3101
3110
|
} from "@hyperframes/engine";
|
|
3102
3111
|
var ASSET_MEDIA_TYPE_MISMATCH = "ASSET_MEDIA_TYPE_MISMATCH";
|
|
3103
3112
|
var AssetMediaTypeMismatchError = class extends Error {
|
|
@@ -3144,7 +3153,7 @@ function dropMediaOutsideProject(input) {
|
|
|
3144
3153
|
const roots = [projectDir, compiledDir, join8(workDir, "downloads")];
|
|
3145
3154
|
const staysInside = ({ id, src }) => {
|
|
3146
3155
|
if (!src || isRemoteOrInlineSource(src)) return true;
|
|
3147
|
-
const path =
|
|
3156
|
+
const path = resolveProjectRelativeSrc3(src, projectDir, compiledDir);
|
|
3148
3157
|
if (roots.some((root) => !escapesAssetRoot(path, root))) return true;
|
|
3149
3158
|
log.warn(`[Render] Media "${id}" source is missing: it is outside the project folder`, { src });
|
|
3150
3159
|
return false;
|
|
@@ -3174,7 +3183,7 @@ async function preflightCompositionAssetMediaTypes(input) {
|
|
|
3174
3183
|
const byPath = /* @__PURE__ */ new Map();
|
|
3175
3184
|
for (const reference of references) {
|
|
3176
3185
|
if (!reference.src || isRemoteOrInlineSource(reference.src)) continue;
|
|
3177
|
-
const resolvedPath =
|
|
3186
|
+
const resolvedPath = resolveProjectRelativeSrc3(
|
|
3178
3187
|
reference.src,
|
|
3179
3188
|
input.projectDir,
|
|
3180
3189
|
input.compiledDir
|
|
@@ -3353,7 +3362,7 @@ function runtimeRoot(document2) {
|
|
|
3353
3362
|
function detectRenderModeHints(html, pageMotionBlur) {
|
|
3354
3363
|
const reasons = [];
|
|
3355
3364
|
const { document: document2 } = parseHTML5(html);
|
|
3356
|
-
if (document2.querySelector(
|
|
3365
|
+
if (document2.querySelector(CAPTURE_CANVAS_SELECTOR)) {
|
|
3357
3366
|
reasons.push({
|
|
3358
3367
|
code: "htmlInCanvas",
|
|
3359
3368
|
message: "Detected html-in-canvas API (layoutsubtree canvas). Chrome does not support concurrent drawElementImage across multiple workers; render is pinned to a single worker."
|
|
@@ -3361,7 +3370,7 @@ function detectRenderModeHints(html, pageMotionBlur) {
|
|
|
3361
3370
|
} else if (pageMotionBlur !== "off" && runtimeRoot(document2)?.getAttribute("data-motion-blur") === "on") {
|
|
3362
3371
|
reasons.push({
|
|
3363
3372
|
code: "captureMotionBlur",
|
|
3364
|
-
message: 'Detected
|
|
3373
|
+
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.'
|
|
3365
3374
|
});
|
|
3366
3375
|
}
|
|
3367
3376
|
if (document2.querySelector("iframe")) {
|
|
@@ -4102,13 +4111,26 @@ async function localizeRemoteMediaSources(html, downloadDir) {
|
|
|
4102
4111
|
if (m[1]) urlSet.add(m[1]);
|
|
4103
4112
|
}
|
|
4104
4113
|
}
|
|
4105
|
-
|
|
4114
|
+
const localized = await downloadAndRewriteUrls(
|
|
4106
4115
|
urlSet,
|
|
4107
4116
|
html,
|
|
4108
4117
|
join9(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
4109
4118
|
"Remote media download failed",
|
|
4110
4119
|
"Localized remote media source(s)"
|
|
4111
4120
|
);
|
|
4121
|
+
return { ...localized, html: dropBindingOnLocalizedMedia(localized.html) };
|
|
4122
|
+
}
|
|
4123
|
+
function dropBindingOnLocalizedMedia(html) {
|
|
4124
|
+
if (!html.includes("data-var-src")) return html;
|
|
4125
|
+
const { document: document2 } = parseHTML5(html);
|
|
4126
|
+
let changed = false;
|
|
4127
|
+
for (const el of document2.querySelectorAll("video[data-var-src], audio[data-var-src]")) {
|
|
4128
|
+
if (el.closest("[data-variable-values]")) continue;
|
|
4129
|
+
if (!el.getAttribute("src")?.startsWith(`${REMOTE_MEDIA_SUBDIR}/`)) continue;
|
|
4130
|
+
el.removeAttribute("data-var-src");
|
|
4131
|
+
changed = true;
|
|
4132
|
+
}
|
|
4133
|
+
return changed ? document2.toString() : html;
|
|
4112
4134
|
}
|
|
4113
4135
|
async function localizeRemoteImageSources(html, downloadDir) {
|
|
4114
4136
|
const urlSet = /* @__PURE__ */ new Set();
|
|
@@ -5379,7 +5401,7 @@ async function runProbeStage(input) {
|
|
|
5379
5401
|
);
|
|
5380
5402
|
const hasVariableMedia = hasVariableBoundMedia(compiled.html, job.config.variables);
|
|
5381
5403
|
const hasInsertedMedia = hasRuntimeMediaChanges(compiled.html);
|
|
5382
|
-
const needsBrowser = cfg.videoLayerPassthrough || probeRequiresBrowser({
|
|
5404
|
+
const needsBrowser = cfg.videoLayerPassthrough || input.measuresShownBoxes === true || probeRequiresBrowser({
|
|
5383
5405
|
durationSeconds: composition.duration,
|
|
5384
5406
|
unresolvedCompositionCount: compiled.unresolvedCompositions.length,
|
|
5385
5407
|
hasAutoStart,
|
|
@@ -5398,6 +5420,7 @@ async function runProbeStage(input) {
|
|
|
5398
5420
|
if (hasScriptedAudio) reasons.push("scripted audio volume");
|
|
5399
5421
|
if (hasInsertedMedia) reasons.push("runtime-created or source-mutated media");
|
|
5400
5422
|
if (hasVariableMedia) reasons.push("variable-bound media source(s)");
|
|
5423
|
+
if (input.measuresShownBoxes) reasons.push("video(s) larger than the canvas");
|
|
5401
5424
|
log.info("Launching browser for composition probe...", {
|
|
5402
5425
|
reasons
|
|
5403
5426
|
});
|
|
@@ -5931,7 +5954,7 @@ import {
|
|
|
5931
5954
|
createFrameLookupTable as createFrameLookupTable3,
|
|
5932
5955
|
detectTransfer,
|
|
5933
5956
|
extractAllVideoFrames,
|
|
5934
|
-
extractMediaMetadata as
|
|
5957
|
+
extractMediaMetadata as extractMediaMetadata4,
|
|
5935
5958
|
gradingKeepsSdr as gradingKeepsSdr2,
|
|
5936
5959
|
isVideoPastTimelineEnd,
|
|
5937
5960
|
isHdrColorSpace as isHdrColorSpace2,
|
|
@@ -5939,7 +5962,7 @@ import {
|
|
|
5939
5962
|
resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
|
|
5940
5963
|
resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
|
|
5941
5964
|
isHttpUrl as isHttpUrl2,
|
|
5942
|
-
resolveProjectRelativeSrc as
|
|
5965
|
+
resolveProjectRelativeSrc as resolveProjectRelativeSrc4,
|
|
5943
5966
|
runVideoExtractionWithRetry as runVideoExtractionWithRetry2,
|
|
5944
5967
|
safeVideoExtractionSourceIdentity,
|
|
5945
5968
|
videoAudioId as videoAudioId2
|
|
@@ -6155,7 +6178,7 @@ function applyVideoExtractionFailurePolicy(result, policy, log) {
|
|
|
6155
6178
|
}
|
|
6156
6179
|
async function probeColorSpaceSafely(path, log) {
|
|
6157
6180
|
try {
|
|
6158
|
-
const meta = await
|
|
6181
|
+
const meta = await extractMediaMetadata4(path);
|
|
6159
6182
|
return meta.colorSpace;
|
|
6160
6183
|
} catch (error) {
|
|
6161
6184
|
log?.warn("HDR color-space probe failed; treating source as SDR", {
|
|
@@ -6177,6 +6200,7 @@ async function runExtractVideosStage(input) {
|
|
|
6177
6200
|
assertNotAborted,
|
|
6178
6201
|
materializeSymlinks,
|
|
6179
6202
|
deferRangeExtraction,
|
|
6203
|
+
shownBoxes,
|
|
6180
6204
|
urlByAbsentLocalPath,
|
|
6181
6205
|
skipFrameExtractionIds = []
|
|
6182
6206
|
} = input;
|
|
@@ -6198,10 +6222,10 @@ async function runExtractVideosStage(input) {
|
|
|
6198
6222
|
log?.info("Probing video color spaces...", { videoCount: composition.videos.length });
|
|
6199
6223
|
const probeFailures = await Promise.all(
|
|
6200
6224
|
composition.videos.map(async (v) => {
|
|
6201
|
-
const videoPath =
|
|
6225
|
+
const videoPath = resolveProjectRelativeSrc4(v.src, projectDir, compiledDir);
|
|
6202
6226
|
if (!existsSync9(videoPath)) return null;
|
|
6203
6227
|
try {
|
|
6204
|
-
const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await
|
|
6228
|
+
const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await extractMediaMetadata4(videoPath), retries: 0 } : await runVideoExtractionWithRetry2(() => extractMediaMetadata4(videoPath), {
|
|
6205
6229
|
signal: abortSignal,
|
|
6206
6230
|
maxTransientRetries: extractionPolicy.maxTransientRetries,
|
|
6207
6231
|
onRetry: () => {
|
|
@@ -6236,7 +6260,7 @@ async function runExtractVideosStage(input) {
|
|
|
6236
6260
|
if (probesHdr && composition.images.length > 0) {
|
|
6237
6261
|
const probed = await Promise.all(
|
|
6238
6262
|
composition.images.map(async (img) => {
|
|
6239
|
-
const imgPath =
|
|
6263
|
+
const imgPath = resolveProjectRelativeSrc4(img.src, projectDir, compiledDir);
|
|
6240
6264
|
if (!existsSync9(imgPath)) return null;
|
|
6241
6265
|
const colorSpace = await probeColorSpaceSafely(imgPath, log);
|
|
6242
6266
|
if (isHdrColorSpace2(colorSpace)) {
|
|
@@ -6278,6 +6302,7 @@ async function runExtractVideosStage(input) {
|
|
|
6278
6302
|
maxTransientRetries: extractionPolicy.maxTransientRetries,
|
|
6279
6303
|
collectProbeFailures: extractionPolicy.failureMode === "enforce",
|
|
6280
6304
|
deferRangeExtraction,
|
|
6305
|
+
shownBoxes,
|
|
6281
6306
|
contentKeyedDirs: [join12(compiledDir, REMOTE_MEDIA_SUBDIR)],
|
|
6282
6307
|
urlByAbsentLocalPath,
|
|
6283
6308
|
onProgress: ({ planned = 0, done = 0 }) => {
|
|
@@ -6355,10 +6380,10 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
6355
6380
|
);
|
|
6356
6381
|
const probed = await Promise.all(
|
|
6357
6382
|
videos.map(async (video) => {
|
|
6358
|
-
const path = isHttpUrl2(video.src) ? video.src :
|
|
6383
|
+
const path = isHttpUrl2(video.src) ? video.src : resolveProjectRelativeSrc4(video.src, projectDir, compiledDir);
|
|
6359
6384
|
const readFrom = urlByAbsentLocalPath?.get(path) ?? path;
|
|
6360
6385
|
if (!isHttpUrl2(readFrom) && !existsSync9(readFrom)) return null;
|
|
6361
|
-
const metadata = await
|
|
6386
|
+
const metadata = await extractMediaMetadata4(readFrom);
|
|
6362
6387
|
const window2 = await resolveFinalFrameExtractionWindow2(
|
|
6363
6388
|
readFrom,
|
|
6364
6389
|
video,
|
|
@@ -6381,7 +6406,7 @@ import {
|
|
|
6381
6406
|
buildVideoLayerInput,
|
|
6382
6407
|
isHttpUrl as isHttpUrl3,
|
|
6383
6408
|
qualifyVideoLayer,
|
|
6384
|
-
resolveProjectRelativeSrc as
|
|
6409
|
+
resolveProjectRelativeSrc as resolveProjectRelativeSrc5
|
|
6385
6410
|
} from "@hyperframes/engine";
|
|
6386
6411
|
|
|
6387
6412
|
// src/services/render/stages/audioStage.ts
|
|
@@ -7518,6 +7543,9 @@ import {
|
|
|
7518
7543
|
initializeSession as initializeSession6
|
|
7519
7544
|
} from "@hyperframes/engine";
|
|
7520
7545
|
|
|
7546
|
+
// src/services/shaderTransitionWorkerPool.ts
|
|
7547
|
+
import { usableCpuCount } from "@hyperframes/engine";
|
|
7548
|
+
|
|
7521
7549
|
// src/services/render/stages/encodeStage.ts
|
|
7522
7550
|
import {
|
|
7523
7551
|
copyFileSync as copyFileSync4,
|
|
@@ -12190,7 +12218,6 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
12190
12218
|
// src/services/distributed/renderChunk.ts
|
|
12191
12219
|
import { randomBytes } from "node:crypto";
|
|
12192
12220
|
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
12221
|
import { join as join32 } from "node:path";
|
|
12195
12222
|
import {
|
|
12196
12223
|
assertSwiftShader,
|
|
@@ -12206,7 +12233,8 @@ import {
|
|
|
12206
12233
|
measureVideoShownBoxes,
|
|
12207
12234
|
probeBeginFrameLiveness as probeBeginFrameLiveness2,
|
|
12208
12235
|
readWebGlVendorInfoFromCanvas,
|
|
12209
|
-
resolveConfig as resolveConfig5
|
|
12236
|
+
resolveConfig as resolveConfig5,
|
|
12237
|
+
usableCpuCount as usableCpuCount2
|
|
12210
12238
|
} from "@hyperframes/engine";
|
|
12211
12239
|
import { readWebGlVendorInfoFromCanvas as readWebGlVendorInfoFromCanvas2 } from "@hyperframes/engine";
|
|
12212
12240
|
var LEGACY_DISTRIBUTED_VP9_CPU_USED = 2;
|
|
@@ -12736,7 +12764,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
12736
12764
|
const captureSession = session;
|
|
12737
12765
|
session = null;
|
|
12738
12766
|
verifyStarted = Date.now();
|
|
12739
|
-
overlap.current = canEncodeWhileCapturing(encodeInput, chunkWorkerCount,
|
|
12767
|
+
overlap.current = canEncodeWhileCapturing(encodeInput, chunkWorkerCount, usableCpuCount2()) ? encodeWhileCapturing(encodeInput, framesInChunk) : null;
|
|
12740
12768
|
await observeRenderStage(
|
|
12741
12769
|
new RenderObservabilityRecorder({ pipelineStartMs: start, log }),
|
|
12742
12770
|
"capture_chunk",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.1.0",
|
|
3
3
|
"buildId": "dev",
|
|
4
|
-
"sha256": "
|
|
4
|
+
"sha256": "365a71ffb699cdb086477aaf2be92cf655d7212891ba42c9d92131a47c3ede06",
|
|
5
5
|
"artifacts": {
|
|
6
6
|
"iife": "hyperframe.runtime.iife.js",
|
|
7
7
|
"esm": "hyperframe.runtime.mjs"
|