@hyperframes/producer 0.9.69 → 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 +69 -56
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +66 -66
- package/dist/index.js +304 -258
- package/dist/public-server.js +193 -149
- 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);
|
|
@@ -7154,10 +7161,11 @@ import {
|
|
|
7154
7161
|
applyAudioFxChain,
|
|
7155
7162
|
describeFfmpegFailure as describeFfmpegFailure3,
|
|
7156
7163
|
encodeAac as encodeAac2,
|
|
7157
|
-
renameWithRetry as
|
|
7164
|
+
renameWithRetry as renameWithRetry5
|
|
7158
7165
|
} from "@hyperframes/engine";
|
|
7159
7166
|
|
|
7160
7167
|
// src/services/render/audioPadTrim.ts
|
|
7168
|
+
import { localContainerInputArgs } from "@hyperframes/parsers/ff-binaries";
|
|
7161
7169
|
import { spawn } from "node:child_process";
|
|
7162
7170
|
import { dirname as dirname8, join as join13 } from "node:path";
|
|
7163
7171
|
import {
|
|
@@ -7168,7 +7176,7 @@ import {
|
|
|
7168
7176
|
getFfprobeBinary,
|
|
7169
7177
|
ManagedChildProcess,
|
|
7170
7178
|
removeScratch,
|
|
7171
|
-
renameWithRetry as
|
|
7179
|
+
renameWithRetry as renameWithRetry4,
|
|
7172
7180
|
runFfmpeg as runFfmpeg5,
|
|
7173
7181
|
trackChildProcess,
|
|
7174
7182
|
withPublicOnlyProxy
|
|
@@ -7309,10 +7317,10 @@ function sanitizeProbeFailure(reason, paths) {
|
|
|
7309
7317
|
}
|
|
7310
7318
|
async function padOrTrimAudioToVideoFrameCount(input) {
|
|
7311
7319
|
const probeVideo = input.probeVideoFrameInfo ?? ((videoPath) => defaultProbeVideoFrameInfo(videoPath, input.signal));
|
|
7312
|
-
const probeAudio = input.probeAudioInfo ?? defaultProbeAudioInfo;
|
|
7320
|
+
const probeAudio = input.probeAudioInfo ?? ((path, signal) => defaultProbeAudioInfo(path, signal, input.audioContainer));
|
|
7313
7321
|
const timeoutMs = input.timeoutMs ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
|
|
7314
7322
|
const runner = input.runFfmpeg ?? ((args) => defaultRunFfmpeg(args, timeoutMs, input.signal));
|
|
7315
|
-
const encode = input.encodeAac ?? defaultAacEncoder(timeoutMs, input.signal, input.sourcePath);
|
|
7323
|
+
const encode = input.encodeAac ?? defaultAacEncoder(timeoutMs, input.signal, input.sourcePath, input.audioContainer);
|
|
7316
7324
|
const probeTruePeak = input.probeAudioTruePeakDbfs ?? (input.runFfmpeg || input.encodeAac ? void 0 : (audioPath, signal) => measureTruePeakDbfs(audioPath, { timeoutMs, signal }));
|
|
7317
7325
|
const [videoResult, audioResult] = await Promise.allSettled([
|
|
7318
7326
|
probeVideo(input.videoPath),
|
|
@@ -7360,7 +7368,7 @@ async function padOrTrimAudioToVideoFrameCount(input) {
|
|
|
7360
7368
|
);
|
|
7361
7369
|
try {
|
|
7362
7370
|
for (const step of plan.steps) {
|
|
7363
|
-
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(
|
|
7364
7372
|
input.sourcePath ?? input.audioPath,
|
|
7365
7373
|
input.outputPath,
|
|
7366
7374
|
targetDurationSeconds,
|
|
@@ -7444,7 +7452,7 @@ async function cutSource(input, scratchDir, attenuationDb) {
|
|
|
7444
7452
|
try {
|
|
7445
7453
|
const result = await input.rewriteSource(input.sourcePath, cutPath, gainFilter(attenuationDb));
|
|
7446
7454
|
if (!result.success) throw new Error(result.error);
|
|
7447
|
-
|
|
7455
|
+
renameWithRetry4(cutPath, input.sourcePath, { copyFallback: true });
|
|
7448
7456
|
return true;
|
|
7449
7457
|
} catch {
|
|
7450
7458
|
removeScratch(input.sourcePath);
|
|
@@ -7471,7 +7479,7 @@ async function enforceAacTruePeak(input) {
|
|
|
7471
7479
|
if (truePeakDbfs <= AAC_DELIVERY_TRUE_PEAK_DBFS) {
|
|
7472
7480
|
if (measuredPath !== correctedPath) return { success: true };
|
|
7473
7481
|
const sourceCut = await cutSource(input, scratchDir, attenuationDb);
|
|
7474
|
-
|
|
7482
|
+
renameWithRetry4(correctedPath, input.audioPath, { copyFallback: true });
|
|
7475
7483
|
const loweredDb = Number((-attenuationDb).toFixed(2));
|
|
7476
7484
|
return sourceCut ? { success: true, loweredDb } : { success: true, loweredDb, sourceStale: true };
|
|
7477
7485
|
}
|
|
@@ -7526,7 +7534,8 @@ function failResult(outputPath, target, source, error) {
|
|
|
7526
7534
|
error
|
|
7527
7535
|
};
|
|
7528
7536
|
}
|
|
7529
|
-
async function defaultProbeVideoFrameInfo(videoPath, signal) {
|
|
7537
|
+
async function defaultProbeVideoFrameInfo(videoPath, signal, container) {
|
|
7538
|
+
const inputArgs = localContainerInputArgs(container);
|
|
7530
7539
|
const fastInfo = await runFfprobeJson(
|
|
7531
7540
|
[
|
|
7532
7541
|
"-v",
|
|
@@ -7537,6 +7546,7 @@ async function defaultProbeVideoFrameInfo(videoPath, signal) {
|
|
|
7537
7546
|
"stream=nb_frames,r_frame_rate",
|
|
7538
7547
|
"-of",
|
|
7539
7548
|
"json",
|
|
7549
|
+
...inputArgs,
|
|
7540
7550
|
"--",
|
|
7541
7551
|
videoPath
|
|
7542
7552
|
],
|
|
@@ -7558,6 +7568,7 @@ async function defaultProbeVideoFrameInfo(videoPath, signal) {
|
|
|
7558
7568
|
"stream=nb_read_packets,r_frame_rate",
|
|
7559
7569
|
"-of",
|
|
7560
7570
|
"json",
|
|
7571
|
+
...inputArgs,
|
|
7561
7572
|
"--",
|
|
7562
7573
|
videoPath
|
|
7563
7574
|
],
|
|
@@ -7580,8 +7591,8 @@ function parseFrameRate(rate) {
|
|
|
7580
7591
|
}
|
|
7581
7592
|
return { fpsNum, fpsDen };
|
|
7582
7593
|
}
|
|
7583
|
-
async function defaultProbeAudioInfo(audioPath, signal) {
|
|
7584
|
-
const metadata = await extractAudioMetadata3(audioPath, { signal });
|
|
7594
|
+
async function defaultProbeAudioInfo(audioPath, signal, inputContainer) {
|
|
7595
|
+
const metadata = await extractAudioMetadata3(audioPath, { signal, inputContainer });
|
|
7585
7596
|
return {
|
|
7586
7597
|
durationSeconds: metadata.durationSeconds,
|
|
7587
7598
|
sampleRate: metadata.sampleRate,
|
|
@@ -7592,9 +7603,9 @@ async function defaultProbeAudioInfo(audioPath, signal) {
|
|
|
7592
7603
|
async function defaultRunFfmpeg(args, timeoutMs, signal) {
|
|
7593
7604
|
return toStepResult(await runFfmpeg5(args, { signal, timeout: timeoutMs }), timeoutMs);
|
|
7594
7605
|
}
|
|
7595
|
-
function defaultAacEncoder(timeoutMs, signal, pcmSourcePath) {
|
|
7606
|
+
function defaultAacEncoder(timeoutMs, signal, pcmSourcePath, inputContainer) {
|
|
7596
7607
|
return async (inputPath, outputPath, durationSeconds, filter) => {
|
|
7597
|
-
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 };
|
|
7598
7609
|
return toStepResult(
|
|
7599
7610
|
await encodeAac(pcmSourcePath ?? inputPath, outputPath, durationSeconds, options),
|
|
7600
7611
|
timeoutMs
|
|
@@ -7667,7 +7678,7 @@ async function limitDeliveryPeaks(input, deps = {
|
|
|
7667
7678
|
measure: measureTruePeakDbfs,
|
|
7668
7679
|
applyChain: applyAudioFxChain,
|
|
7669
7680
|
encode: encodeAac2,
|
|
7670
|
-
rename:
|
|
7681
|
+
rename: renameWithRetry5,
|
|
7671
7682
|
sourceExists: existsSync10
|
|
7672
7683
|
}) {
|
|
7673
7684
|
const { audioPath, sourcePath, signal, timeoutMs } = input;
|
|
@@ -10128,7 +10139,7 @@ import { appendRenderProvenanceArgs, describeFfmpegFailure as describeFfmpegFail
|
|
|
10128
10139
|
// src/services/distributed/mp4Stitch.ts
|
|
10129
10140
|
import { createReadStream as createReadStream4, createWriteStream, mkdirSync as mkdirSync8, rmSync as rmSync6 } from "node:fs";
|
|
10130
10141
|
import { open } from "node:fs/promises";
|
|
10131
|
-
import { renameWithRetry as
|
|
10142
|
+
import { renameWithRetry as renameWithRetry6 } from "@hyperframes/engine";
|
|
10132
10143
|
import { basename as basename5, dirname as dirname13, join as join24 } from "node:path";
|
|
10133
10144
|
import { finished, pipeline } from "node:stream/promises";
|
|
10134
10145
|
import { createStagingDir as createStagingDir4 } from "@hyperframes/core/atomic-file";
|
|
@@ -10502,7 +10513,7 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
|
|
|
10502
10513
|
for (const [i, path] of sourcePaths.entries()) await copyPayload(path, layouts[i], i, out);
|
|
10503
10514
|
out.end();
|
|
10504
10515
|
await finished(out);
|
|
10505
|
-
|
|
10516
|
+
renameWithRetry6(join24(workDir, "out.mp4"), outputPath);
|
|
10506
10517
|
} finally {
|
|
10507
10518
|
out.destroy();
|
|
10508
10519
|
rmSync6(workDir, { recursive: true, force: true });
|
|
@@ -11266,7 +11277,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
11266
11277
|
const warn = (line) => log.warn(`[Plan] ${line}`);
|
|
11267
11278
|
const policy = { includeScripts: job.config.includeOutsideScripts };
|
|
11268
11279
|
if (refusesOutsideLink(projectDir, src, warn, policy)) return false;
|
|
11269
|
-
} else if (!
|
|
11280
|
+
} else if (!isSafePath3(projectDir, src)) return false;
|
|
11270
11281
|
const firstSegment = rel.split(sep4, 1)[0];
|
|
11271
11282
|
return firstSegment === void 0 || !PLAN_PROJECT_DIR_SKIP_SEGMENTS.has(firstSegment);
|
|
11272
11283
|
}
|
|
@@ -11486,12 +11497,12 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
11486
11497
|
const videoSourcesDir = join27(planDir, "video-sources");
|
|
11487
11498
|
rmSync7(videoSourcesDir, { recursive: true, force: true });
|
|
11488
11499
|
if (existsSync19(stagedVideoFrames)) {
|
|
11489
|
-
|
|
11500
|
+
renameWithRetry7(stagedVideoFrames, videoFramesDst);
|
|
11490
11501
|
} else {
|
|
11491
11502
|
mkdirSync10(videoFramesDst, { recursive: true });
|
|
11492
11503
|
}
|
|
11493
11504
|
if (existsSync19(finalCompiledDir)) rmSync7(finalCompiledDir, { recursive: true, force: true });
|
|
11494
|
-
|
|
11505
|
+
renameWithRetry7(compiledDir, finalCompiledDir);
|
|
11495
11506
|
const shipVideoSource = createVideoSourceShipper({
|
|
11496
11507
|
planDir,
|
|
11497
11508
|
projectDir,
|
|
@@ -11612,7 +11623,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
11612
11623
|
}
|
|
11613
11624
|
const planAudioPath = join27(planDir, PLAN_AUDIO_RELATIVE_PATH);
|
|
11614
11625
|
if (audioResult?.hasAudio && existsSync19(audioResult.audioOutputPath)) {
|
|
11615
|
-
|
|
11626
|
+
renameWithRetry7(audioResult.audioOutputPath, planAudioPath);
|
|
11616
11627
|
}
|
|
11617
11628
|
if (chunksCarryAudio && existsSync19(planAudioPath)) {
|
|
11618
11629
|
if (options.sliceChunkAudio) {
|
|
@@ -11735,7 +11746,7 @@ async function buildPlanAudio(projectDir, config, workRoot, outputPath, options
|
|
|
11735
11746
|
applyDistributedAudioWarningPolicy(c.job, mixed.audioError, mixed.audioFailures, c.log);
|
|
11736
11747
|
}
|
|
11737
11748
|
if (!mixed.hasAudio || !existsSync19(mixed.audioOutputPath)) return { hasAudio: false };
|
|
11738
|
-
|
|
11749
|
+
renameWithRetry7(mixed.audioOutputPath, outputPath);
|
|
11739
11750
|
return { hasAudio: true };
|
|
11740
11751
|
} finally {
|
|
11741
11752
|
rmSync7(c.workDir, { recursive: true, force: true });
|
|
@@ -11764,7 +11775,7 @@ import { DISTRIBUTED_FPS, isDistributedFps } from "@hyperframes/core";
|
|
|
11764
11775
|
import {
|
|
11765
11776
|
createFrameLookupTable as createFrameLookupTable5,
|
|
11766
11777
|
mediaIdPathSegment as mediaIdPathSegment4,
|
|
11767
|
-
renameWithRetry as
|
|
11778
|
+
renameWithRetry as renameWithRetry9
|
|
11768
11779
|
} from "@hyperframes/engine";
|
|
11769
11780
|
|
|
11770
11781
|
// src/services/distributed/planV2Publisher.ts
|
|
@@ -11777,7 +11788,7 @@ import {
|
|
|
11777
11788
|
statSync as statSync8,
|
|
11778
11789
|
writeFileSync as writeFileSync9
|
|
11779
11790
|
} from "node:fs";
|
|
11780
|
-
import { renameWithRetry as
|
|
11791
|
+
import { renameWithRetry as renameWithRetry8 } from "@hyperframes/engine";
|
|
11781
11792
|
import { dirname as dirname14, join as join29 } from "node:path";
|
|
11782
11793
|
|
|
11783
11794
|
// src/services/distributed/planV2Errors.ts
|
|
@@ -11862,7 +11873,7 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
11862
11873
|
if (!cannotHardLink(error)) throw error;
|
|
11863
11874
|
copyFileSync7(blob.sourcePath, temporaryPath);
|
|
11864
11875
|
}
|
|
11865
|
-
|
|
11876
|
+
renameWithRetry8(temporaryPath, destinationPath);
|
|
11866
11877
|
} finally {
|
|
11867
11878
|
rmSync8(stagingDir, { recursive: true, force: true });
|
|
11868
11879
|
}
|
|
@@ -11876,7 +11887,7 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
11876
11887
|
}
|
|
11877
11888
|
}
|
|
11878
11889
|
writeFileSync9(join29(this.temporaryDir, "plan.json"), manifestBytes, "utf-8");
|
|
11879
|
-
|
|
11890
|
+
renameWithRetry8(this.temporaryDir, this.destinationDir);
|
|
11880
11891
|
this.#committed = true;
|
|
11881
11892
|
}
|
|
11882
11893
|
async abort() {
|
|
@@ -12149,7 +12160,7 @@ function writeBlob(sourcePath, destinationPath) {
|
|
|
12149
12160
|
const temporaryPath = join30(temporaryDir, "blob");
|
|
12150
12161
|
try {
|
|
12151
12162
|
copyFileSync8(sourcePath, temporaryPath);
|
|
12152
|
-
|
|
12163
|
+
renameWithRetry9(temporaryPath, destinationPath);
|
|
12153
12164
|
} finally {
|
|
12154
12165
|
rmSync9(temporaryDir, { recursive: true, force: true });
|
|
12155
12166
|
}
|
|
@@ -12281,7 +12292,7 @@ function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
|
|
|
12281
12292
|
canonicalJsonStringify(publication.manifest),
|
|
12282
12293
|
"utf-8"
|
|
12283
12294
|
);
|
|
12284
|
-
|
|
12295
|
+
renameWithRetry9(tempDir, planV2Dir);
|
|
12285
12296
|
return resultFromManifest(planV2Dir, publication.manifest);
|
|
12286
12297
|
} catch (error) {
|
|
12287
12298
|
rmSync9(tempDir, { recursive: true, force: true });
|
|
@@ -12569,7 +12580,7 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
|
|
|
12569
12580
|
}),
|
|
12570
12581
|
"utf-8"
|
|
12571
12582
|
);
|
|
12572
|
-
|
|
12583
|
+
renameWithRetry9(tempDir, destinationDir);
|
|
12573
12584
|
} catch (error) {
|
|
12574
12585
|
rmSync9(tempDir, { recursive: true, force: true });
|
|
12575
12586
|
throw error;
|
|
@@ -12651,12 +12662,13 @@ import {
|
|
|
12651
12662
|
readFileSync as readFileSync11,
|
|
12652
12663
|
readdirSync as readdirSync8,
|
|
12653
12664
|
rmSync as rmSync10,
|
|
12654
|
-
statSync as statSync10
|
|
12655
|
-
writeFileSync as writeFileSync11
|
|
12665
|
+
statSync as statSync10
|
|
12656
12666
|
} from "node:fs";
|
|
12667
|
+
import { localContainerInputArgs as localContainerInputArgs2 } from "@hyperframes/parsers/ff-binaries";
|
|
12657
12668
|
import { basename as basename6, dirname as dirname16, join as join31 } from "node:path";
|
|
12658
12669
|
import {
|
|
12659
12670
|
appendRateCapArgs as appendRateCapArgs2,
|
|
12671
|
+
writeVideoConcatList,
|
|
12660
12672
|
appendRenderProvenanceArgs as appendRenderProvenanceArgs2,
|
|
12661
12673
|
concatListInputArgs,
|
|
12662
12674
|
describeFfmpegFailure as describeFfmpegFailure5,
|
|
@@ -12666,7 +12678,7 @@ import {
|
|
|
12666
12678
|
resolveConfig as resolveConfig4,
|
|
12667
12679
|
runFfmpeg as runFfmpeg8,
|
|
12668
12680
|
appendSoftwareEncoderThreadsArg,
|
|
12669
|
-
renameWithRetry as
|
|
12681
|
+
renameWithRetry as renameWithRetry10
|
|
12670
12682
|
} from "@hyperframes/engine";
|
|
12671
12683
|
import { fpsToFfmpegArg as fpsToFfmpegArg3 } from "@hyperframes/core";
|
|
12672
12684
|
import { createStagingDir as createStagingDir7 } from "@hyperframes/core/atomic-file";
|
|
@@ -12728,7 +12740,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
12728
12740
|
const finalPath = join31(workDir, `output.${format}`);
|
|
12729
12741
|
const audio = audioPath !== null && existsSync22(audioPath) ? audioPath : null;
|
|
12730
12742
|
await writeJoined(ctx, videoSources, audio, finalPath);
|
|
12731
|
-
|
|
12743
|
+
renameWithRetry10(finalPath, outputPath);
|
|
12732
12744
|
log.info("[assemble] stage timings", {
|
|
12733
12745
|
...stageMs,
|
|
12734
12746
|
chunks: chunkPaths.length,
|
|
@@ -12784,7 +12796,11 @@ function readAssemblePlan(planDir, chunkPaths) {
|
|
|
12784
12796
|
return plan;
|
|
12785
12797
|
}
|
|
12786
12798
|
function videoInputArgs(ctx, videoSources) {
|
|
12787
|
-
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))];
|
|
12788
12804
|
}
|
|
12789
12805
|
function cfrEncodeArgs(inputArgs, encoder, fpsArg) {
|
|
12790
12806
|
const args = [
|
|
@@ -12838,8 +12854,9 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
|
|
|
12838
12854
|
"audioMs",
|
|
12839
12855
|
() => padOrTrimAudioToVideoFrameCount({
|
|
12840
12856
|
videoPath: videoSources[0],
|
|
12841
|
-
probeVideoFrameInfo: () => probeJoinedFrameInfo(videoSources, ctx
|
|
12857
|
+
probeVideoFrameInfo: () => probeJoinedFrameInfo(videoSources, ctx),
|
|
12842
12858
|
audioPath,
|
|
12859
|
+
audioContainer: "mov",
|
|
12843
12860
|
outputPath: paddedAudioPath,
|
|
12844
12861
|
signal: ctx.signal,
|
|
12845
12862
|
timeoutMs: ctx.timeout
|
|
@@ -12862,6 +12879,7 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
|
|
|
12862
12879
|
ctx.signal,
|
|
12863
12880
|
{
|
|
12864
12881
|
audioCodec: "aac",
|
|
12882
|
+
audioContainer: "mov",
|
|
12865
12883
|
ffmpegProcessTimeout: ctx.timeout,
|
|
12866
12884
|
videoInputArgs: videoInputArgs(ctx, videoSources)
|
|
12867
12885
|
},
|
|
@@ -12872,21 +12890,16 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
|
|
|
12872
12890
|
throw encoderFailureError("[assemble] audio mux failed", muxResult);
|
|
12873
12891
|
}
|
|
12874
12892
|
}
|
|
12875
|
-
function
|
|
12876
|
-
const listPath = join31(workDir, "concat-list.txt");
|
|
12877
|
-
const body = chunkPaths.map((path) => `file '${path.replace(/'/g, "'\\''")}'`).join("\n");
|
|
12878
|
-
writeFileSync11(listPath, `${body}
|
|
12879
|
-
`, "utf-8");
|
|
12880
|
-
return ["-r", fpsArg, ...concatListInputArgs(listPath)];
|
|
12881
|
-
}
|
|
12882
|
-
async function probeJoinedFrameInfo(videoPaths, fps, signal) {
|
|
12893
|
+
async function probeJoinedFrameInfo(videoPaths, ctx) {
|
|
12883
12894
|
const infos = await Promise.all(
|
|
12884
|
-
videoPaths.map(
|
|
12895
|
+
videoPaths.map(
|
|
12896
|
+
(path) => defaultProbeVideoFrameInfo(path, ctx.signal, ctx.format === "webm" ? "matroska" : "mov")
|
|
12897
|
+
)
|
|
12885
12898
|
);
|
|
12886
12899
|
return {
|
|
12887
12900
|
frameCount: infos.reduce((sum2, info) => sum2 + info.frameCount, 0),
|
|
12888
|
-
fpsNum: fps.num,
|
|
12889
|
-
fpsDen: fps.den
|
|
12901
|
+
fpsNum: ctx.fps.num,
|
|
12902
|
+
fpsDen: ctx.fps.den
|
|
12890
12903
|
};
|
|
12891
12904
|
}
|
|
12892
12905
|
async function runAssembleFfmpeg(args, step, signal, timeout) {
|
|
@@ -12983,7 +12996,7 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
12983
12996
|
|
|
12984
12997
|
// src/services/distributed/renderChunk.ts
|
|
12985
12998
|
import { randomBytes } from "node:crypto";
|
|
12986
|
-
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";
|
|
12987
13000
|
import { join as join32 } from "node:path";
|
|
12988
13001
|
import {
|
|
12989
13002
|
assertSwiftShader,
|
|
@@ -13666,7 +13679,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
13666
13679
|
producerVersion: plan.producerVersion,
|
|
13667
13680
|
ffmpegVersion
|
|
13668
13681
|
};
|
|
13669
|
-
|
|
13682
|
+
writeFileSync11(perfPath, `${JSON.stringify(perfPayload, null, 2)}
|
|
13670
13683
|
`, "utf-8");
|
|
13671
13684
|
try {
|
|
13672
13685
|
rmSync11(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
@@ -14153,7 +14166,7 @@ var isMissing = (result) => result.error?.code === "ENOENT";
|
|
|
14153
14166
|
var ffmpegIsMissing = async (signal) => isMissing(await runFfmpeg9(["-version"], { signal }));
|
|
14154
14167
|
|
|
14155
14168
|
// src/services/distributed/probeFacts.ts
|
|
14156
|
-
import { writeFileSync as
|
|
14169
|
+
import { writeFileSync as writeFileSync12 } from "node:fs";
|
|
14157
14170
|
import { extname as extname6 } from "node:path";
|
|
14158
14171
|
import { buildProbeFactsText } from "@hyperframes/engine";
|
|
14159
14172
|
var PROBE_FACTS_EXTENSIONS = /* @__PURE__ */ new Set([".mp4", ".mov", ".m4v", ".webm", ".mkv"]);
|
|
@@ -14162,7 +14175,7 @@ function wantsProbeFacts(path) {
|
|
|
14162
14175
|
}
|
|
14163
14176
|
async function buildProbeFacts(inputPath, outputPath, signal) {
|
|
14164
14177
|
try {
|
|
14165
|
-
|
|
14178
|
+
writeFileSync12(outputPath, await buildProbeFactsText(inputPath, signal));
|
|
14166
14179
|
return "built";
|
|
14167
14180
|
} catch (error) {
|
|
14168
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"
|