@hyperframes/producer 0.9.68 → 0.9.70
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 +74 -65
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +68 -67
- package/dist/index.js +309 -267
- package/dist/public-server.js +198 -158
- package/dist/services/render/audioPadTrim.d.ts +2 -1
- package/dist/services/render/segmentManifest.d.ts +3 -4
- package/dist/services/renderOrchestrator.d.ts +1 -1
- package/package.json +7 -7
package/dist/distributed.js
CHANGED
|
@@ -19,14 +19,14 @@ import {
|
|
|
19
19
|
fpsToNumber as fpsToNumber9,
|
|
20
20
|
HF_COLOR_GRADING_ATTR as HF_COLOR_GRADING_ATTR2
|
|
21
21
|
} from "@hyperframes/core";
|
|
22
|
-
import { isSafePath as
|
|
22
|
+
import { isSafePath as isSafePath3 } from "@hyperframes/core/safe-path";
|
|
23
23
|
import {
|
|
24
24
|
getEncoderPreset as getEncoderPreset4,
|
|
25
25
|
keyframeIntervalToGopSize as keyframeIntervalToGopSize3,
|
|
26
26
|
normalizeVp9CpuUsed,
|
|
27
27
|
resolveConfig as resolveConfig3,
|
|
28
28
|
declareContentAddressedUrl,
|
|
29
|
-
renameWithRetry as
|
|
29
|
+
renameWithRetry as renameWithRetry7,
|
|
30
30
|
declareProbeFactsUrl
|
|
31
31
|
} from "@hyperframes/engine";
|
|
32
32
|
|
|
@@ -1753,8 +1753,15 @@ var BYTES_PER_MIB = 1024 * 1024;
|
|
|
1753
1753
|
var DEFAULT_HDR_WINDOW_BYTES = 512 * BYTES_PER_MIB;
|
|
1754
1754
|
|
|
1755
1755
|
// src/services/render/segmentManifest.ts
|
|
1756
|
+
import {
|
|
1757
|
+
assertPrivateCachePath,
|
|
1758
|
+
ensurePrivateCacheDir,
|
|
1759
|
+
hyperframesCacheDir
|
|
1760
|
+
} from "@hyperframes/core/cache-dir";
|
|
1761
|
+
import { isSafePath as isSafePath2, realpath } from "@hyperframes/core/safe-path";
|
|
1762
|
+
import { isPathInside as isPathInside3 } from "@hyperframes/parsers/asset-paths";
|
|
1756
1763
|
import { previewToken } from "@hyperframes/core/preview-proof";
|
|
1757
|
-
import {
|
|
1764
|
+
import { replaceFileAtomically } from "@hyperframes/core/atomic-file";
|
|
1758
1765
|
|
|
1759
1766
|
// src/services/render/stages/captureStreamingStage.ts
|
|
1760
1767
|
import {
|
|
@@ -2458,7 +2465,7 @@ import { statSync as statSync3 } from "node:fs";
|
|
|
2458
2465
|
var MAX_COMPOSITION_HTML_BYTES = 16 * 1024 * 1024;
|
|
2459
2466
|
var COMPOSITION_TOO_LARGE = "COMPOSITION_TOO_LARGE";
|
|
2460
2467
|
var megabytes = (bytes) => `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
2461
|
-
var MAX_EXPANDED_COMPOSITION_BYTES =
|
|
2468
|
+
var MAX_EXPANDED_COMPOSITION_BYTES = 4 * MAX_COMPOSITION_HTML_BYTES;
|
|
2462
2469
|
var MAX_COMPOSITION_MOUNTS = 1e4;
|
|
2463
2470
|
var CompositionTooLargeError = class extends Error {
|
|
2464
2471
|
constructor(message, publicMetadata) {
|
|
@@ -2834,7 +2841,7 @@ import {
|
|
|
2834
2841
|
DEFAULT_VP9_CPU_USED,
|
|
2835
2842
|
isPrivateUnderAssetRoots,
|
|
2836
2843
|
runFfmpeg as runFfmpeg2,
|
|
2837
|
-
renameWithRetry as
|
|
2844
|
+
renameWithRetry as renameWithRetry2,
|
|
2838
2845
|
urlInputArgs as urlInputArgs2
|
|
2839
2846
|
} from "@hyperframes/engine";
|
|
2840
2847
|
import { namesAnotherNetworkRoot } from "@hyperframes/parsers/asset-resolution";
|
|
@@ -3019,7 +3026,7 @@ async function ensurePreparedWebm(input) {
|
|
|
3019
3026
|
throw new Error("Animated GIF transcode produced an empty output");
|
|
3020
3027
|
}
|
|
3021
3028
|
if (!isUsableFile(input.cachePath)) {
|
|
3022
|
-
|
|
3029
|
+
renameWithRetry2(tmpPath, input.cachePath);
|
|
3023
3030
|
} else {
|
|
3024
3031
|
rmSync2(tmpPath, { force: true });
|
|
3025
3032
|
}
|
|
@@ -3155,7 +3162,7 @@ import {
|
|
|
3155
3162
|
} from "node:fs";
|
|
3156
3163
|
import { dirname as dirname5, join as join7, resolve as resolve5 } from "node:path";
|
|
3157
3164
|
import { parseHTML as parseHTML4 } from "linkedom";
|
|
3158
|
-
import { renameWithRetry as
|
|
3165
|
+
import { renameWithRetry as renameWithRetry3, runFfmpeg as runFfmpeg3, runFfprobe, urlInputArgs as urlInputArgs3 } from "@hyperframes/engine";
|
|
3159
3166
|
|
|
3160
3167
|
// src/services/heifRotation.ts
|
|
3161
3168
|
function* boxes(buf, start, end) {
|
|
@@ -3414,7 +3421,7 @@ async function ensurePreparedJpeg(source, cachePath, outputPath, options) {
|
|
|
3414
3421
|
timeoutMs: options.timeoutMs
|
|
3415
3422
|
});
|
|
3416
3423
|
if (!isUsableFile2(tmpPath)) throw new Error("conversion produced an empty file");
|
|
3417
|
-
|
|
3424
|
+
renameWithRetry3(tmpPath, cachePath);
|
|
3418
3425
|
} catch (error) {
|
|
3419
3426
|
const reason = error instanceof Error ? error.message : String(error);
|
|
3420
3427
|
throw TOOL_FAILURE_RE.test(reason) ? new HeifToolUnavailableError(source.label, reason) : new HeifImageConversionError(source.label, reason);
|
|
@@ -3468,7 +3475,10 @@ async function prepareHeifImageInputs(html, options) {
|
|
|
3468
3475
|
}
|
|
3469
3476
|
|
|
3470
3477
|
// src/services/htmlCompiler.ts
|
|
3471
|
-
import {
|
|
3478
|
+
import {
|
|
3479
|
+
createStudioPositionSeekReapplyScript,
|
|
3480
|
+
htmlHasStudioPositionEdits
|
|
3481
|
+
} from "@hyperframes/studio-server/manual-edits-render-script";
|
|
3472
3482
|
import { getPositionEditsRenderScript } from "@hyperframes/core/runtime/position-edits-render";
|
|
3473
3483
|
|
|
3474
3484
|
// src/services/assetMediaType.ts
|
|
@@ -5078,14 +5088,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
5078
5088
|
abortSignal: options.abortSignal
|
|
5079
5089
|
});
|
|
5080
5090
|
const assembledHtml = await inlineExternalScripts(coalescedHtml, budget);
|
|
5081
|
-
const
|
|
5082
|
-
'data-hf-studio-path-offset="true"',
|
|
5083
|
-
'data-hf-studio-box-size="true"',
|
|
5084
|
-
'data-hf-studio-rotation="true"',
|
|
5085
|
-
'data-hf-studio-motion="'
|
|
5086
|
-
];
|
|
5087
|
-
const hasPositionEdits = HF_POSITION_ATTRS.some((attr) => assembledHtml.includes(attr));
|
|
5088
|
-
const htmlWithPositionScript = hasPositionEdits ? insertBeforeCloseTag(
|
|
5091
|
+
const htmlWithPositionScript = htmlHasStudioPositionEdits(assembledHtml) ? insertBeforeCloseTag(
|
|
5089
5092
|
assembledHtml,
|
|
5090
5093
|
"body",
|
|
5091
5094
|
`<script>${createStudioPositionSeekReapplyScript()}
|
|
@@ -7158,10 +7161,11 @@ import {
|
|
|
7158
7161
|
applyAudioFxChain,
|
|
7159
7162
|
describeFfmpegFailure as describeFfmpegFailure3,
|
|
7160
7163
|
encodeAac as encodeAac2,
|
|
7161
|
-
renameWithRetry as
|
|
7164
|
+
renameWithRetry as renameWithRetry5
|
|
7162
7165
|
} from "@hyperframes/engine";
|
|
7163
7166
|
|
|
7164
7167
|
// src/services/render/audioPadTrim.ts
|
|
7168
|
+
import { localContainerInputArgs } from "@hyperframes/parsers/ff-binaries";
|
|
7165
7169
|
import { spawn } from "node:child_process";
|
|
7166
7170
|
import { dirname as dirname8, join as join13 } from "node:path";
|
|
7167
7171
|
import {
|
|
@@ -7172,7 +7176,7 @@ import {
|
|
|
7172
7176
|
getFfprobeBinary,
|
|
7173
7177
|
ManagedChildProcess,
|
|
7174
7178
|
removeScratch,
|
|
7175
|
-
renameWithRetry as
|
|
7179
|
+
renameWithRetry as renameWithRetry4,
|
|
7176
7180
|
runFfmpeg as runFfmpeg5,
|
|
7177
7181
|
trackChildProcess,
|
|
7178
7182
|
withPublicOnlyProxy
|
|
@@ -7313,10 +7317,10 @@ function sanitizeProbeFailure(reason, paths) {
|
|
|
7313
7317
|
}
|
|
7314
7318
|
async function padOrTrimAudioToVideoFrameCount(input) {
|
|
7315
7319
|
const probeVideo = input.probeVideoFrameInfo ?? ((videoPath) => defaultProbeVideoFrameInfo(videoPath, input.signal));
|
|
7316
|
-
const probeAudio = input.probeAudioInfo ?? defaultProbeAudioInfo;
|
|
7320
|
+
const probeAudio = input.probeAudioInfo ?? ((path, signal) => defaultProbeAudioInfo(path, signal, input.audioContainer));
|
|
7317
7321
|
const timeoutMs = input.timeoutMs ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
|
|
7318
7322
|
const runner = input.runFfmpeg ?? ((args) => defaultRunFfmpeg(args, timeoutMs, input.signal));
|
|
7319
|
-
const encode = input.encodeAac ?? defaultAacEncoder(timeoutMs, input.signal, input.sourcePath);
|
|
7323
|
+
const encode = input.encodeAac ?? defaultAacEncoder(timeoutMs, input.signal, input.sourcePath, input.audioContainer);
|
|
7320
7324
|
const probeTruePeak = input.probeAudioTruePeakDbfs ?? (input.runFfmpeg || input.encodeAac ? void 0 : (audioPath, signal) => measureTruePeakDbfs(audioPath, { timeoutMs, signal }));
|
|
7321
7325
|
const [videoResult, audioResult] = await Promise.allSettled([
|
|
7322
7326
|
probeVideo(input.videoPath),
|
|
@@ -7364,7 +7368,7 @@ async function padOrTrimAudioToVideoFrameCount(input) {
|
|
|
7364
7368
|
);
|
|
7365
7369
|
try {
|
|
7366
7370
|
for (const step of plan.steps) {
|
|
7367
|
-
const ffmpegResult = step.kind === "copy" ? await runner(step.args) : await encode(
|
|
7371
|
+
const ffmpegResult = step.kind === "copy" ? await runner([...localContainerInputArgs(input.audioContainer), ...step.args]) : await encode(
|
|
7368
7372
|
input.sourcePath ?? input.audioPath,
|
|
7369
7373
|
input.outputPath,
|
|
7370
7374
|
targetDurationSeconds,
|
|
@@ -7448,7 +7452,7 @@ async function cutSource(input, scratchDir, attenuationDb) {
|
|
|
7448
7452
|
try {
|
|
7449
7453
|
const result = await input.rewriteSource(input.sourcePath, cutPath, gainFilter(attenuationDb));
|
|
7450
7454
|
if (!result.success) throw new Error(result.error);
|
|
7451
|
-
|
|
7455
|
+
renameWithRetry4(cutPath, input.sourcePath, { copyFallback: true });
|
|
7452
7456
|
return true;
|
|
7453
7457
|
} catch {
|
|
7454
7458
|
removeScratch(input.sourcePath);
|
|
@@ -7475,7 +7479,7 @@ async function enforceAacTruePeak(input) {
|
|
|
7475
7479
|
if (truePeakDbfs <= AAC_DELIVERY_TRUE_PEAK_DBFS) {
|
|
7476
7480
|
if (measuredPath !== correctedPath) return { success: true };
|
|
7477
7481
|
const sourceCut = await cutSource(input, scratchDir, attenuationDb);
|
|
7478
|
-
|
|
7482
|
+
renameWithRetry4(correctedPath, input.audioPath, { copyFallback: true });
|
|
7479
7483
|
const loweredDb = Number((-attenuationDb).toFixed(2));
|
|
7480
7484
|
return sourceCut ? { success: true, loweredDb } : { success: true, loweredDb, sourceStale: true };
|
|
7481
7485
|
}
|
|
@@ -7530,7 +7534,8 @@ function failResult(outputPath, target, source, error) {
|
|
|
7530
7534
|
error
|
|
7531
7535
|
};
|
|
7532
7536
|
}
|
|
7533
|
-
async function defaultProbeVideoFrameInfo(videoPath, signal) {
|
|
7537
|
+
async function defaultProbeVideoFrameInfo(videoPath, signal, container) {
|
|
7538
|
+
const inputArgs = localContainerInputArgs(container);
|
|
7534
7539
|
const fastInfo = await runFfprobeJson(
|
|
7535
7540
|
[
|
|
7536
7541
|
"-v",
|
|
@@ -7541,6 +7546,7 @@ async function defaultProbeVideoFrameInfo(videoPath, signal) {
|
|
|
7541
7546
|
"stream=nb_frames,r_frame_rate",
|
|
7542
7547
|
"-of",
|
|
7543
7548
|
"json",
|
|
7549
|
+
...inputArgs,
|
|
7544
7550
|
"--",
|
|
7545
7551
|
videoPath
|
|
7546
7552
|
],
|
|
@@ -7562,6 +7568,7 @@ async function defaultProbeVideoFrameInfo(videoPath, signal) {
|
|
|
7562
7568
|
"stream=nb_read_packets,r_frame_rate",
|
|
7563
7569
|
"-of",
|
|
7564
7570
|
"json",
|
|
7571
|
+
...inputArgs,
|
|
7565
7572
|
"--",
|
|
7566
7573
|
videoPath
|
|
7567
7574
|
],
|
|
@@ -7584,8 +7591,8 @@ function parseFrameRate(rate) {
|
|
|
7584
7591
|
}
|
|
7585
7592
|
return { fpsNum, fpsDen };
|
|
7586
7593
|
}
|
|
7587
|
-
async function defaultProbeAudioInfo(audioPath, signal) {
|
|
7588
|
-
const metadata = await extractAudioMetadata3(audioPath, { signal });
|
|
7594
|
+
async function defaultProbeAudioInfo(audioPath, signal, inputContainer) {
|
|
7595
|
+
const metadata = await extractAudioMetadata3(audioPath, { signal, inputContainer });
|
|
7589
7596
|
return {
|
|
7590
7597
|
durationSeconds: metadata.durationSeconds,
|
|
7591
7598
|
sampleRate: metadata.sampleRate,
|
|
@@ -7596,9 +7603,9 @@ async function defaultProbeAudioInfo(audioPath, signal) {
|
|
|
7596
7603
|
async function defaultRunFfmpeg(args, timeoutMs, signal) {
|
|
7597
7604
|
return toStepResult(await runFfmpeg5(args, { signal, timeout: timeoutMs }), timeoutMs);
|
|
7598
7605
|
}
|
|
7599
|
-
function defaultAacEncoder(timeoutMs, signal, pcmSourcePath) {
|
|
7606
|
+
function defaultAacEncoder(timeoutMs, signal, pcmSourcePath, inputContainer) {
|
|
7600
7607
|
return async (inputPath, outputPath, durationSeconds, filter) => {
|
|
7601
|
-
const options = pcmSourcePath ? { signal, timeout: timeoutMs, filter } : { signal, timeout: timeoutMs, filter, segments: 1 };
|
|
7608
|
+
const options = pcmSourcePath ? { signal, timeout: timeoutMs, filter } : { signal, timeout: timeoutMs, filter, segments: 1, inputContainer };
|
|
7602
7609
|
return toStepResult(
|
|
7603
7610
|
await encodeAac(pcmSourcePath ?? inputPath, outputPath, durationSeconds, options),
|
|
7604
7611
|
timeoutMs
|
|
@@ -7671,7 +7678,7 @@ async function limitDeliveryPeaks(input, deps = {
|
|
|
7671
7678
|
measure: measureTruePeakDbfs,
|
|
7672
7679
|
applyChain: applyAudioFxChain,
|
|
7673
7680
|
encode: encodeAac2,
|
|
7674
|
-
rename:
|
|
7681
|
+
rename: renameWithRetry5,
|
|
7675
7682
|
sourceExists: existsSync10
|
|
7676
7683
|
}) {
|
|
7677
7684
|
const { audioPath, sourcePath, signal, timeoutMs } = input;
|
|
@@ -10132,7 +10139,7 @@ import { appendRenderProvenanceArgs, describeFfmpegFailure as describeFfmpegFail
|
|
|
10132
10139
|
// src/services/distributed/mp4Stitch.ts
|
|
10133
10140
|
import { createReadStream as createReadStream4, createWriteStream, mkdirSync as mkdirSync8, rmSync as rmSync6 } from "node:fs";
|
|
10134
10141
|
import { open } from "node:fs/promises";
|
|
10135
|
-
import { renameWithRetry as
|
|
10142
|
+
import { renameWithRetry as renameWithRetry6 } from "@hyperframes/engine";
|
|
10136
10143
|
import { basename as basename5, dirname as dirname13, join as join24 } from "node:path";
|
|
10137
10144
|
import { finished, pipeline } from "node:stream/promises";
|
|
10138
10145
|
import { createStagingDir as createStagingDir4 } from "@hyperframes/core/atomic-file";
|
|
@@ -10506,7 +10513,7 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
|
|
|
10506
10513
|
for (const [i, path] of sourcePaths.entries()) await copyPayload(path, layouts[i], i, out);
|
|
10507
10514
|
out.end();
|
|
10508
10515
|
await finished(out);
|
|
10509
|
-
|
|
10516
|
+
renameWithRetry6(join24(workDir, "out.mp4"), outputPath);
|
|
10510
10517
|
} finally {
|
|
10511
10518
|
out.destroy();
|
|
10512
10519
|
rmSync6(workDir, { recursive: true, force: true });
|
|
@@ -11270,7 +11277,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
11270
11277
|
const warn = (line) => log.warn(`[Plan] ${line}`);
|
|
11271
11278
|
const policy = { includeScripts: job.config.includeOutsideScripts };
|
|
11272
11279
|
if (refusesOutsideLink(projectDir, src, warn, policy)) return false;
|
|
11273
|
-
} else if (!
|
|
11280
|
+
} else if (!isSafePath3(projectDir, src)) return false;
|
|
11274
11281
|
const firstSegment = rel.split(sep4, 1)[0];
|
|
11275
11282
|
return firstSegment === void 0 || !PLAN_PROJECT_DIR_SKIP_SEGMENTS.has(firstSegment);
|
|
11276
11283
|
}
|
|
@@ -11490,12 +11497,12 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
11490
11497
|
const videoSourcesDir = join27(planDir, "video-sources");
|
|
11491
11498
|
rmSync7(videoSourcesDir, { recursive: true, force: true });
|
|
11492
11499
|
if (existsSync19(stagedVideoFrames)) {
|
|
11493
|
-
|
|
11500
|
+
renameWithRetry7(stagedVideoFrames, videoFramesDst);
|
|
11494
11501
|
} else {
|
|
11495
11502
|
mkdirSync10(videoFramesDst, { recursive: true });
|
|
11496
11503
|
}
|
|
11497
11504
|
if (existsSync19(finalCompiledDir)) rmSync7(finalCompiledDir, { recursive: true, force: true });
|
|
11498
|
-
|
|
11505
|
+
renameWithRetry7(compiledDir, finalCompiledDir);
|
|
11499
11506
|
const shipVideoSource = createVideoSourceShipper({
|
|
11500
11507
|
planDir,
|
|
11501
11508
|
projectDir,
|
|
@@ -11616,7 +11623,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
11616
11623
|
}
|
|
11617
11624
|
const planAudioPath = join27(planDir, PLAN_AUDIO_RELATIVE_PATH);
|
|
11618
11625
|
if (audioResult?.hasAudio && existsSync19(audioResult.audioOutputPath)) {
|
|
11619
|
-
|
|
11626
|
+
renameWithRetry7(audioResult.audioOutputPath, planAudioPath);
|
|
11620
11627
|
}
|
|
11621
11628
|
if (chunksCarryAudio && existsSync19(planAudioPath)) {
|
|
11622
11629
|
if (options.sliceChunkAudio) {
|
|
@@ -11739,7 +11746,7 @@ async function buildPlanAudio(projectDir, config, workRoot, outputPath, options
|
|
|
11739
11746
|
applyDistributedAudioWarningPolicy(c.job, mixed.audioError, mixed.audioFailures, c.log);
|
|
11740
11747
|
}
|
|
11741
11748
|
if (!mixed.hasAudio || !existsSync19(mixed.audioOutputPath)) return { hasAudio: false };
|
|
11742
|
-
|
|
11749
|
+
renameWithRetry7(mixed.audioOutputPath, outputPath);
|
|
11743
11750
|
return { hasAudio: true };
|
|
11744
11751
|
} finally {
|
|
11745
11752
|
rmSync7(c.workDir, { recursive: true, force: true });
|
|
@@ -11768,7 +11775,7 @@ import { DISTRIBUTED_FPS, isDistributedFps } from "@hyperframes/core";
|
|
|
11768
11775
|
import {
|
|
11769
11776
|
createFrameLookupTable as createFrameLookupTable5,
|
|
11770
11777
|
mediaIdPathSegment as mediaIdPathSegment4,
|
|
11771
|
-
renameWithRetry as
|
|
11778
|
+
renameWithRetry as renameWithRetry9
|
|
11772
11779
|
} from "@hyperframes/engine";
|
|
11773
11780
|
|
|
11774
11781
|
// src/services/distributed/planV2Publisher.ts
|
|
@@ -11781,7 +11788,7 @@ import {
|
|
|
11781
11788
|
statSync as statSync8,
|
|
11782
11789
|
writeFileSync as writeFileSync9
|
|
11783
11790
|
} from "node:fs";
|
|
11784
|
-
import { renameWithRetry as
|
|
11791
|
+
import { renameWithRetry as renameWithRetry8 } from "@hyperframes/engine";
|
|
11785
11792
|
import { dirname as dirname14, join as join29 } from "node:path";
|
|
11786
11793
|
|
|
11787
11794
|
// src/services/distributed/planV2Errors.ts
|
|
@@ -11866,7 +11873,7 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
11866
11873
|
if (!cannotHardLink(error)) throw error;
|
|
11867
11874
|
copyFileSync7(blob.sourcePath, temporaryPath);
|
|
11868
11875
|
}
|
|
11869
|
-
|
|
11876
|
+
renameWithRetry8(temporaryPath, destinationPath);
|
|
11870
11877
|
} finally {
|
|
11871
11878
|
rmSync8(stagingDir, { recursive: true, force: true });
|
|
11872
11879
|
}
|
|
@@ -11880,7 +11887,7 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
11880
11887
|
}
|
|
11881
11888
|
}
|
|
11882
11889
|
writeFileSync9(join29(this.temporaryDir, "plan.json"), manifestBytes, "utf-8");
|
|
11883
|
-
|
|
11890
|
+
renameWithRetry8(this.temporaryDir, this.destinationDir);
|
|
11884
11891
|
this.#committed = true;
|
|
11885
11892
|
}
|
|
11886
11893
|
async abort() {
|
|
@@ -12153,7 +12160,7 @@ function writeBlob(sourcePath, destinationPath) {
|
|
|
12153
12160
|
const temporaryPath = join30(temporaryDir, "blob");
|
|
12154
12161
|
try {
|
|
12155
12162
|
copyFileSync8(sourcePath, temporaryPath);
|
|
12156
|
-
|
|
12163
|
+
renameWithRetry9(temporaryPath, destinationPath);
|
|
12157
12164
|
} finally {
|
|
12158
12165
|
rmSync9(temporaryDir, { recursive: true, force: true });
|
|
12159
12166
|
}
|
|
@@ -12285,7 +12292,7 @@ function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
|
|
|
12285
12292
|
canonicalJsonStringify(publication.manifest),
|
|
12286
12293
|
"utf-8"
|
|
12287
12294
|
);
|
|
12288
|
-
|
|
12295
|
+
renameWithRetry9(tempDir, planV2Dir);
|
|
12289
12296
|
return resultFromManifest(planV2Dir, publication.manifest);
|
|
12290
12297
|
} catch (error) {
|
|
12291
12298
|
rmSync9(tempDir, { recursive: true, force: true });
|
|
@@ -12573,7 +12580,7 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
|
|
|
12573
12580
|
}),
|
|
12574
12581
|
"utf-8"
|
|
12575
12582
|
);
|
|
12576
|
-
|
|
12583
|
+
renameWithRetry9(tempDir, destinationDir);
|
|
12577
12584
|
} catch (error) {
|
|
12578
12585
|
rmSync9(tempDir, { recursive: true, force: true });
|
|
12579
12586
|
throw error;
|
|
@@ -12655,12 +12662,13 @@ import {
|
|
|
12655
12662
|
readFileSync as readFileSync11,
|
|
12656
12663
|
readdirSync as readdirSync8,
|
|
12657
12664
|
rmSync as rmSync10,
|
|
12658
|
-
statSync as statSync10
|
|
12659
|
-
writeFileSync as writeFileSync11
|
|
12665
|
+
statSync as statSync10
|
|
12660
12666
|
} from "node:fs";
|
|
12667
|
+
import { localContainerInputArgs as localContainerInputArgs2 } from "@hyperframes/parsers/ff-binaries";
|
|
12661
12668
|
import { basename as basename6, dirname as dirname16, join as join31 } from "node:path";
|
|
12662
12669
|
import {
|
|
12663
12670
|
appendRateCapArgs as appendRateCapArgs2,
|
|
12671
|
+
writeVideoConcatList,
|
|
12664
12672
|
appendRenderProvenanceArgs as appendRenderProvenanceArgs2,
|
|
12665
12673
|
concatListInputArgs,
|
|
12666
12674
|
describeFfmpegFailure as describeFfmpegFailure5,
|
|
@@ -12670,7 +12678,7 @@ import {
|
|
|
12670
12678
|
resolveConfig as resolveConfig4,
|
|
12671
12679
|
runFfmpeg as runFfmpeg8,
|
|
12672
12680
|
appendSoftwareEncoderThreadsArg,
|
|
12673
|
-
renameWithRetry as
|
|
12681
|
+
renameWithRetry as renameWithRetry10
|
|
12674
12682
|
} from "@hyperframes/engine";
|
|
12675
12683
|
import { fpsToFfmpegArg as fpsToFfmpegArg3 } from "@hyperframes/core";
|
|
12676
12684
|
import { createStagingDir as createStagingDir7 } from "@hyperframes/core/atomic-file";
|
|
@@ -12732,7 +12740,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
12732
12740
|
const finalPath = join31(workDir, `output.${format}`);
|
|
12733
12741
|
const audio = audioPath !== null && existsSync22(audioPath) ? audioPath : null;
|
|
12734
12742
|
await writeJoined(ctx, videoSources, audio, finalPath);
|
|
12735
|
-
|
|
12743
|
+
renameWithRetry10(finalPath, outputPath);
|
|
12736
12744
|
log.info("[assemble] stage timings", {
|
|
12737
12745
|
...stageMs,
|
|
12738
12746
|
chunks: chunkPaths.length,
|
|
@@ -12788,7 +12796,11 @@ function readAssemblePlan(planDir, chunkPaths) {
|
|
|
12788
12796
|
return plan;
|
|
12789
12797
|
}
|
|
12790
12798
|
function videoInputArgs(ctx, videoSources) {
|
|
12791
|
-
return videoSources.length === 1 ? [
|
|
12799
|
+
return videoSources.length === 1 ? [
|
|
12800
|
+
...localContainerInputArgs2(ctx.format === "webm" ? "matroska" : "mov"),
|
|
12801
|
+
"-i",
|
|
12802
|
+
videoSources[0]
|
|
12803
|
+
] : ["-r", ctx.fpsArg, ...concatListInputArgs(writeVideoConcatList(ctx.workDir, videoSources))];
|
|
12792
12804
|
}
|
|
12793
12805
|
function cfrEncodeArgs(inputArgs, encoder, fpsArg) {
|
|
12794
12806
|
const args = [
|
|
@@ -12842,8 +12854,9 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
|
|
|
12842
12854
|
"audioMs",
|
|
12843
12855
|
() => padOrTrimAudioToVideoFrameCount({
|
|
12844
12856
|
videoPath: videoSources[0],
|
|
12845
|
-
probeVideoFrameInfo: () => probeJoinedFrameInfo(videoSources, ctx
|
|
12857
|
+
probeVideoFrameInfo: () => probeJoinedFrameInfo(videoSources, ctx),
|
|
12846
12858
|
audioPath,
|
|
12859
|
+
audioContainer: "mov",
|
|
12847
12860
|
outputPath: paddedAudioPath,
|
|
12848
12861
|
signal: ctx.signal,
|
|
12849
12862
|
timeoutMs: ctx.timeout
|
|
@@ -12866,6 +12879,7 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
|
|
|
12866
12879
|
ctx.signal,
|
|
12867
12880
|
{
|
|
12868
12881
|
audioCodec: "aac",
|
|
12882
|
+
audioContainer: "mov",
|
|
12869
12883
|
ffmpegProcessTimeout: ctx.timeout,
|
|
12870
12884
|
videoInputArgs: videoInputArgs(ctx, videoSources)
|
|
12871
12885
|
},
|
|
@@ -12876,21 +12890,16 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
|
|
|
12876
12890
|
throw encoderFailureError("[assemble] audio mux failed", muxResult);
|
|
12877
12891
|
}
|
|
12878
12892
|
}
|
|
12879
|
-
function
|
|
12880
|
-
const listPath = join31(workDir, "concat-list.txt");
|
|
12881
|
-
const body = chunkPaths.map((path) => `file '${path.replace(/'/g, "'\\''")}'`).join("\n");
|
|
12882
|
-
writeFileSync11(listPath, `${body}
|
|
12883
|
-
`, "utf-8");
|
|
12884
|
-
return ["-r", fpsArg, ...concatListInputArgs(listPath)];
|
|
12885
|
-
}
|
|
12886
|
-
async function probeJoinedFrameInfo(videoPaths, fps, signal) {
|
|
12893
|
+
async function probeJoinedFrameInfo(videoPaths, ctx) {
|
|
12887
12894
|
const infos = await Promise.all(
|
|
12888
|
-
videoPaths.map(
|
|
12895
|
+
videoPaths.map(
|
|
12896
|
+
(path) => defaultProbeVideoFrameInfo(path, ctx.signal, ctx.format === "webm" ? "matroska" : "mov")
|
|
12897
|
+
)
|
|
12889
12898
|
);
|
|
12890
12899
|
return {
|
|
12891
12900
|
frameCount: infos.reduce((sum2, info) => sum2 + info.frameCount, 0),
|
|
12892
|
-
fpsNum: fps.num,
|
|
12893
|
-
fpsDen: fps.den
|
|
12901
|
+
fpsNum: ctx.fps.num,
|
|
12902
|
+
fpsDen: ctx.fps.den
|
|
12894
12903
|
};
|
|
12895
12904
|
}
|
|
12896
12905
|
async function runAssembleFfmpeg(args, step, signal, timeout) {
|
|
@@ -12987,7 +12996,7 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
12987
12996
|
|
|
12988
12997
|
// src/services/distributed/renderChunk.ts
|
|
12989
12998
|
import { randomBytes } from "node:crypto";
|
|
12990
|
-
import { existsSync as existsSync23, mkdirSync as mkdirSync14, readFileSync as readFileSync12, readdirSync as readdirSync9, rmSync as rmSync11, writeFileSync as
|
|
12999
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync14, readFileSync as readFileSync12, readdirSync as readdirSync9, rmSync as rmSync11, writeFileSync as writeFileSync11 } from "node:fs";
|
|
12991
13000
|
import { join as join32 } from "node:path";
|
|
12992
13001
|
import {
|
|
12993
13002
|
assertSwiftShader,
|
|
@@ -13670,7 +13679,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
13670
13679
|
producerVersion: plan.producerVersion,
|
|
13671
13680
|
ffmpegVersion
|
|
13672
13681
|
};
|
|
13673
|
-
|
|
13682
|
+
writeFileSync11(perfPath, `${JSON.stringify(perfPayload, null, 2)}
|
|
13674
13683
|
`, "utf-8");
|
|
13675
13684
|
try {
|
|
13676
13685
|
rmSync11(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
@@ -14157,7 +14166,7 @@ var isMissing = (result) => result.error?.code === "ENOENT";
|
|
|
14157
14166
|
var ffmpegIsMissing = async (signal) => isMissing(await runFfmpeg9(["-version"], { signal }));
|
|
14158
14167
|
|
|
14159
14168
|
// src/services/distributed/probeFacts.ts
|
|
14160
|
-
import { writeFileSync as
|
|
14169
|
+
import { writeFileSync as writeFileSync12 } from "node:fs";
|
|
14161
14170
|
import { extname as extname6 } from "node:path";
|
|
14162
14171
|
import { buildProbeFactsText } from "@hyperframes/engine";
|
|
14163
14172
|
var PROBE_FACTS_EXTENSIONS = /* @__PURE__ */ new Set([".mp4", ".mov", ".m4v", ".webm", ".mkv"]);
|
|
@@ -14166,7 +14175,7 @@ function wantsProbeFacts(path) {
|
|
|
14166
14175
|
}
|
|
14167
14176
|
async function buildProbeFacts(inputPath, outputPath, signal) {
|
|
14168
14177
|
try {
|
|
14169
|
-
|
|
14178
|
+
writeFileSync12(outputPath, await buildProbeFactsText(inputPath, signal));
|
|
14170
14179
|
return "built";
|
|
14171
14180
|
} catch (error) {
|
|
14172
14181
|
if (signal?.aborted) throw error;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.1.0",
|
|
3
3
|
"buildId": "dev",
|
|
4
|
-
"sha256": "
|
|
4
|
+
"sha256": "8f76daaf081527fc70539e771d8ecaa38ac0a6e51fc631aa2f10ea8a387fb641",
|
|
5
5
|
"artifacts": {
|
|
6
6
|
"iife": "hyperframe.runtime.iife.js",
|
|
7
7
|
"esm": "hyperframe.runtime.mjs"
|