hyperframes 0.9.4 → 0.9.5
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/{add-KGLQRDOR.js → add-XI5CW2YO.js} +9 -9
- package/dist/{agentPromptGenerator-43OTO3ZQ.js → agentPromptGenerator-EEP7CJRK.js} +2 -2
- package/dist/{animatedGifPrep-AELBI6OZ.js → animatedGifPrep-3VKPC32B.js} +2 -2
- package/dist/api.js +15 -15
- package/dist/{asset-IDDA6YDA.js → asset-RYVHIREA.js} +2 -2
- package/dist/{assetCataloger-3ODHJX74.js → assetCataloger-MG3GSWNQ.js} +3 -3
- package/dist/{audio-YL5WE2ZH.js → audio-CNKU2KQR.js} +7 -7
- package/dist/{auth-73AQ4C6J.js → auth-MX2SGZQH.js} +1 -1
- package/dist/{autoUpdate-PRACQEE2.js → autoUpdate-MB3SWOXG.js} +2 -2
- package/dist/{backgroundChecks-GF7DD3CT.js → backgroundChecks-TYCDOGQX.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{beats-RIYL6FAW.js → beats-5SXSGNUM.js} +4 -4
- package/dist/{benchmark-ZXWBR4Q2.js → benchmark-V5Y5OQ3W.js} +6 -6
- package/dist/{browser-RQVUIRKR.js → browser-CJ2HDBEC.js} +3 -3
- package/dist/{bundleWithLocalizedFonts-U23CIGZT.js → bundleWithLocalizedFonts-2FPP3MMD.js} +1 -1
- package/dist/{capture-XLIZO7S4.js → capture-424KH55L.js} +7 -7
- package/dist/{capture-DKLV3MKZ.js → capture-KE3474CJ.js} +3 -3
- package/dist/{captureCompositionFrame-IDLA33HO.js → captureCompositionFrame-ZPZCQTYL.js} +5 -5
- package/dist/{catalog-GCEMAJ2A.js → catalog-3S4LAGZH.js} +16 -13
- package/dist/{catch-up-JGEVDQYE.js → catch-up-7ZLNBOG4.js} +4 -4
- package/dist/{check-UFFVDSOH.js → check-6OCBPXX5.js} +24 -24
- package/dist/{checkAudio-AJHD4QXP.js → checkAudio-O5RDEOEX.js} +4 -4
- package/dist/{checkBrowser-HZPWQLY6.js → checkBrowser-DJPH634D.js} +18 -18
- package/dist/{chunk-RISL4HHS.js → chunk-3B3LGZ36.js} +8 -8
- package/dist/{chunk-VGIEM4JZ.js → chunk-44IJ426Z.js} +1 -1
- package/dist/{chunk-6LDW4TLQ.js → chunk-46DXV7OQ.js} +2 -2
- package/dist/{chunk-FI7SOWBQ.js → chunk-4W2ZN4HT.js} +1 -1
- package/dist/{chunk-DUZII3C4.js → chunk-5FAU3XAO.js} +2 -2
- package/dist/{chunk-U7DQYDRQ.js → chunk-5FFHLOVF.js} +1 -1
- package/dist/{chunk-OKMXRVAN.js → chunk-5TBRPDH3.js} +1 -1
- package/dist/{chunk-YL6X26WT.js → chunk-6447ORC2.js} +1 -1
- package/dist/{chunk-SEFLUI7L.js → chunk-64OUBJSX.js} +1 -1
- package/dist/{chunk-QAB2ZMFL.js → chunk-6PLIPRVQ.js} +2 -2
- package/dist/{chunk-ZDBN76JQ.js → chunk-7FERR4YN.js} +1 -1
- package/dist/{chunk-LBETJASR.js → chunk-7XCGHD55.js} +4 -4
- package/dist/{chunk-C3OOOE6D.js → chunk-ALBHEVJJ.js} +1 -1
- package/dist/{chunk-KXU3FDXG.js → chunk-ARNCWQNR.js} +1 -1
- package/dist/{chunk-DAF2SYII.js → chunk-C555UZ5B.js} +2 -2
- package/dist/{chunk-XHLPTVXH.js → chunk-CGXL36FR.js} +1 -1
- package/dist/{chunk-VBR3OBZU.js → chunk-CRDXU4IX.js} +8 -8
- package/dist/{chunk-WRIA42TA.js → chunk-EG2ESF6S.js} +1 -1
- package/dist/{chunk-AQW3ZDDM.js → chunk-FEC4UQK2.js} +5 -5
- package/dist/{chunk-R4KSPN37.js → chunk-GC2GKCRQ.js} +17 -17
- package/dist/{chunk-SYHDFH34.js → chunk-HDKRDALC.js} +1 -1
- package/dist/{chunk-7SYZRT4L.js → chunk-HMMHCSSN.js} +1 -1
- package/dist/{chunk-Q4PFOT6Z.js → chunk-HZDSKYTV.js} +1 -1
- package/dist/{chunk-TGX5AWVQ.js → chunk-JAJ6PAR6.js} +2 -2
- package/dist/{chunk-W6NEVGAE.js → chunk-JAYAOI3W.js} +1 -1
- package/dist/{chunk-VVPDROQU.js → chunk-JD7MLLJD.js} +4 -4
- package/dist/{chunk-VUGARSNN.js → chunk-JDT5PZWS.js} +1 -1
- package/dist/{chunk-OOGTMIN4.js → chunk-JX5GUEFA.js} +1 -1
- package/dist/{chunk-Y5PWLNW3.js → chunk-JZJ3LLIO.js} +1 -1
- package/dist/{chunk-SXGR4GCO.js → chunk-K4SINZFP.js} +2 -2
- package/dist/{chunk-HVWZ5V2N.js → chunk-KLJEGC6M.js} +1 -1
- package/dist/{chunk-R5XOR2IO.js → chunk-M56MEMPF.js} +1 -1
- package/dist/{chunk-GS4C2FNZ.js → chunk-MBOZUQFZ.js} +1 -1
- package/dist/{chunk-EOVTVB5X.js → chunk-MCROAQ7A.js} +247 -134
- package/dist/{chunk-T6NMZNAE.js → chunk-MGXQXY4C.js} +2 -2
- package/dist/{chunk-TLYTMIXP.js → chunk-MNW4FTAJ.js} +9 -9
- package/dist/{chunk-LSFXDBHZ.js → chunk-MX7NW3QW.js} +3 -3
- package/dist/{chunk-CQL77BAS.js → chunk-NRO2PLEC.js} +2 -2
- package/dist/{chunk-A2PZLDHN.js → chunk-NUGADGXQ.js} +6 -3
- package/dist/{chunk-QT7F5JKP.js → chunk-NVPB37H4.js} +2 -2
- package/dist/{chunk-UWNLBTFA.js → chunk-PMQ65BTY.js} +1 -1
- package/dist/{chunk-K3AKRESE.js → chunk-PYOEIKGI.js} +1 -1
- package/dist/{chunk-5NWS6KLM.js → chunk-Q2LWMJAQ.js} +1 -1
- package/dist/{chunk-VSDUDDHB.js → chunk-QIFINY2N.js} +6 -6
- package/dist/{chunk-IIBNGLEX.js → chunk-RTUQDHKE.js} +165 -40
- package/dist/{chunk-YBFS5PCE.js → chunk-RUZ63CJF.js} +1 -1
- package/dist/{chunk-KBKDDTOZ.js → chunk-RW4DTMPK.js} +7 -7
- package/dist/{chunk-F4LQGW5F.js → chunk-S5SVW6ZY.js} +9 -9
- package/dist/{chunk-NYQRWXZZ.js → chunk-SBPDYU34.js} +1 -1
- package/dist/{chunk-SGTO3Y2K.js → chunk-SXKFFBN3.js} +2 -2
- package/dist/{chunk-G5X2YP75.js → chunk-TI4JPSFS.js} +1 -1
- package/dist/{chunk-XZ2DZYFD.js → chunk-TWIPYH4G.js} +1 -1
- package/dist/{chunk-ZXD4YXXC.js → chunk-UL3SKAZB.js} +2 -2
- package/dist/{chunk-RDE3O5OK.js → chunk-VPVO5COM.js} +1 -1
- package/dist/{chunk-6OBVJUMS.js → chunk-WAK6IPMP.js} +1 -1
- package/dist/{chunk-CPXT5NUE.js → chunk-WAQX3AYB.js} +1 -1
- package/dist/{chunk-AVJDYPVP.js → chunk-XXFWK5Y7.js} +1 -1
- package/dist/{chunk-VGARKT5Y.js → chunk-Y6TDJUHR.js} +1 -1
- package/dist/{chunk-EYYILEMR.js → chunk-YGSQABOD.js} +1 -1
- package/dist/{chunk-5PKNT2BQ.js → chunk-YK6ERJTN.js} +2 -2
- package/dist/{chunk-65ERKMRH.js → chunk-YPBGUVLY.js} +1 -1
- package/dist/{chunk-7UVXHPVS.js → chunk-ZFQ4N6D2.js} +3 -3
- package/dist/{clean-T7DQNAR2.js → clean-ZKPZ4HHG.js} +7 -7
- package/dist/cli.js +55 -55
- package/dist/{cloud-S4DTHZEW.js → cloud-GQZYBRBI.js} +4 -4
- package/dist/{compare-UZS33RAM.js → compare-3IXL3WVG.js} +14 -14
- package/dist/{component-RHX4425M.js → component-RV72K74J.js} +3 -3
- package/dist/{compositions-PE5F4Z6K.js → compositions-W2IKF36U.js} +6 -6
- package/dist/{curve-NFVM6GS3.js → curve-TRCKVHYB.js} +6 -6
- package/dist/{cuts-EKHMAUOZ.js → cuts-SRXTGX33.js} +7 -7
- package/dist/{delete-IQQLQS7T.js → delete-7PZLZFBE.js} +2 -2
- package/dist/{deploy-GG24Q4EE.js → deploy-GORJQIPX.js} +1 -1
- package/dist/{describeProject-DCUVSIOQ.js → describeProject-ZIFVZUSV.js} +2 -2
- package/dist/{diff-IQVYEYA3.js → diff-PHRMVJMC.js} +16 -16
- package/dist/{doctor-BEFL6PWV.js → doctor-C6Q2FECX.js} +6 -6
- package/dist/{energy-LZY5CQVP.js → energy-CNXVSSE6.js} +7 -7
- package/dist/{events-VSDE4FFW.js → events-27C4TXPP.js} +3 -3
- package/dist/{events-C335VVXI.js → events-FSUH46NR.js} +8 -8
- package/dist/{events-Z4I2YBA4.js → events-UG3LC2PB.js} +2 -2
- package/dist/{extract-N4KV7KUQ.js → extract-GLPADLLV.js} +7 -7
- package/dist/{face-DCKACTUC.js → face-TTOHRJEY.js} +7 -7
- package/dist/{feedback-FQ2P62K7.js → feedback-BYONPSSM.js} +4 -4
- package/dist/{ffmpeg-HYYU3M6K.js → ffmpeg-WAM27CD6.js} +2 -2
- package/dist/{figma-JWZLYFMJ.js → figma-Y4UR2EDE.js} +3 -3
- package/dist/fontLocalizeCli.js +5 -5
- package/dist/{frames-Z6ATQUGJ.js → frames-CNQUJEUV.js} +8 -8
- package/dist/{generate-FHVQMXVB.js → generate-BPYDIEPB.js} +9 -9
- package/dist/{get-FBUXTOJS.js → get-4LY5VJW2.js} +2 -2
- package/dist/{gpuPolicy-MNPLXHRJ.js → gpuPolicy-OUHJ7GVX.js} +2 -2
- package/dist/{grade-compare-ELKVVO7W.js → grade-compare-WEZBE3WM.js} +15 -15
- package/dist/{heifImagePrep-ALPO36IR.js → heifImagePrep-7L4HH33F.js} +3 -3
- package/dist/{help-JHGASQ27.js → help-QKNWJOBV.js} +1 -1
- package/dist/{history-R3MGVTZ2.js → history-XQEWP2IW.js} +6 -6
- package/dist/hyperframes-player.global.js +1 -1
- package/dist/{info-G4NZMSC5.js → info-AMRQ5R4N.js} +5 -5
- package/dist/{init-DS4YZTWE.js → init-4VTMKZSQ.js} +22 -22
- package/dist/{ink-6KESLHVK.js → ink-KB3LZMJY.js} +7 -7
- package/dist/{inspect-T3YH6Y7Z.js → inspect-ZWN2DVO4.js} +16 -16
- package/dist/{installer-YVNEAOSW.js → installer-2NUMLKHQ.js} +2 -2
- package/dist/{keyframes-6QMTPUAB.js → keyframes-I456RFGP.js} +6 -6
- package/dist/{lambda-PVKMQ5RR.js → lambda-2QKB4BJM.js} +3 -3
- package/dist/{layout-ZNH7EW6L.js → layout-WPHWXQCM.js} +16 -16
- package/dist/{lint-FF7YK3QK.js → lint-EO5DXJ36.js} +6 -6
- package/dist/{list-TJTH6NN6.js → list-LZOUUJBY.js} +2 -2
- package/dist/{localPage-TUWJD4GJ.js → localPage-SZWQWWJ7.js} +2 -2
- package/dist/{login-3GRKVAMH.js → login-IEWPNTGD.js} +4 -4
- package/dist/{look-5ZFSZPPB.js → look-6L3CPY4H.js} +7 -7
- package/dist/{manager-POO6RLB4.js → manager-C7677YAV.js} +3 -3
- package/dist/{measure-OYR7XHOE.js → measure-TINTS6YY.js} +11 -11
- package/dist/{media-treatment-PJ3NZ2PR.js → media-treatment-3BDHM4P6.js} +7 -7
- package/dist/{media-use-PQUFJ2ZJ.js → media-use-JC2B2JSE.js} +1 -1
- package/dist/{models-RCJQAORM.js → models-JMM25YO6.js} +6 -6
- package/dist/{motionShot-2UAWH6B2.js → motionShot-4WB3SH6V.js} +7 -7
- package/dist/{normalize-audio-ESIM3KEX.js → normalize-audio-2ZJKR5G3.js} +4 -4
- package/dist/{open-A3DRPHEK.js → open-LMYSLYH2.js} +9 -9
- package/dist/{parakeetRunner-W2EYPYLF.js → parakeetRunner-HTQVLX2B.js} +7 -7
- package/dist/{pipeline-KIFB5R5M.js → pipeline-FMVCPIRU.js} +5 -5
- package/dist/{play-26X5I67T.js → play-GFHBG3NZ.js} +8 -8
- package/dist/{preflight-RF5UZJUA.js → preflight-L5GC6ASI.js} +3 -3
- package/dist/{present-7IFGQBVD.js → present-PW3RWNWF.js} +4 -4
- package/dist/{preview-IAMB4ULR.js → preview-IRLHPLSD.js} +13 -13
- package/dist/{probe-EZS36TUR.js → probe-FPHFC3SD.js} +6 -6
- package/dist/{producer-6NKNMOIT.js → producer-M6IWCFMK.js} +1 -1
- package/dist/{projectConfig-MYKQOOIG.js → projectConfig-IVJE7A42.js} +4 -4
- package/dist/{publish-3BUTNKVA.js → publish-OTRA2JWM.js} +4 -4
- package/dist/{remove-background-PEJXPBJA.js → remove-background-UV37Y7T7.js} +6 -6
- package/dist/{render-HGGE5CBB.js → render-7VBLI4AZ.js} +31 -26
- package/dist/{render-W72TDIHA.js → render-XSDVVBEY.js} +9 -9
- package/dist/{resolver-5IXI5IFJ.js → resolver-VQ32ZH6Y.js} +2 -2
- package/dist/{sherpa-4GLU4QU7.js → sherpa-BSIBIIIO.js} +6 -6
- package/dist/{skills-3IEY3EGH.js → skills-S7JNBPZZ.js} +5 -5
- package/dist/{skillsUpdateCheck-6HQLY6GT.js → skillsUpdateCheck-WFEV6VYU.js} +3 -3
- package/dist/{snapshot-UNRFRCCW.js → snapshot-NCWXYS2E.js} +20 -20
- package/dist/{src-VWCIVPJX.js → src-7WW3KXOI.js} +9 -1
- package/dist/{src-FT34LZAJ.js → src-AYBT7IBT.js} +12 -4
- package/dist/{staticProjectServer-WFK4N6P3.js → staticProjectServer-VYZV4BSU.js} +6 -6
- package/dist/studio/assets/{hyperframes-player--MmARLPY.js → hyperframes-player-Cum4k6V2.js} +1 -1
- package/dist/studio/assets/{index-EB7sh_Tw.js → index-BohL7wdo.js} +1 -1
- package/dist/studio/assets/{index-h1lPtzPa.js → index-CTbhykVD.js} +4 -4
- package/dist/studio/index.html +1 -1
- package/dist/{studioServer-3CHSYLFZ.js → studioServer-AA4B3YP7.js} +31 -31
- package/dist/{sync-2IZJ7HAC.js → sync-3M7VO3UJ.js} +7 -7
- package/dist/{telemetry-DHLLX5EC.js → telemetry-VJ3A6ZMD.js} +3 -3
- package/dist/{timeline-TK4RV66K.js → timeline-ZLZ45W7F.js} +7 -7
- package/dist/{tokens-PV67HFRX.js → tokens-WXEJNNJV.js} +2 -2
- package/dist/{transcribe-HJ3AWR2D.js → transcribe-PPH5H67E.js} +5 -5
- package/dist/{transcribe-5HXQG64W.js → transcribe-XMVXOBHM.js} +13 -13
- package/dist/{updateCheck-EI4WIVIS.js → updateCheck-HDLNWLIC.js} +2 -2
- package/dist/{upgrade-ADM4CRK4.js → upgrade-6UXVTJII.js} +2 -2
- package/dist/{urlDownloader-6TM5CH5Q.js → urlDownloader-DPN2KRCX.js} +1 -1
- package/dist/{validate-K27UCOGM.js → validate-BZOURM4G.js} +11 -11
- package/dist/{video-KAN4FULD.js → video-BE42DAT2.js} +3 -3
- package/dist/warmCheck.js +24 -24
- package/package.json +1 -1
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
Semaphore,
|
|
9
9
|
prepareHeifImageInputs,
|
|
10
10
|
withMediaProbeSlot
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-MGXQXY4C.js";
|
|
12
12
|
import {
|
|
13
13
|
EncoderInterruptedError,
|
|
14
14
|
encoderFailureError,
|
|
15
15
|
prepareAnimatedGifInputs
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-YGSQABOD.js";
|
|
17
17
|
import {
|
|
18
18
|
GENERIC_FAMILIES,
|
|
19
19
|
collectFontFamilyCustomProperties,
|
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
ManagedChildProcess,
|
|
44
44
|
NotMediaPayloadError,
|
|
45
45
|
PRORES_PROFILE_NAMES,
|
|
46
|
+
REFERENCE_BACKGROUND_FIELD,
|
|
46
47
|
VIDEO_FRAME_FORMATS,
|
|
47
48
|
aacSegmentCount,
|
|
48
49
|
analyzeCompositionHdr,
|
|
@@ -82,6 +83,7 @@ import {
|
|
|
82
83
|
createCaptureSession,
|
|
83
84
|
createFrameLookupTable,
|
|
84
85
|
createFrameReorderBuffer,
|
|
86
|
+
createReferenceBackgroundRecorder,
|
|
85
87
|
createVideoFrameInjector,
|
|
86
88
|
declareContentAddressedUrl,
|
|
87
89
|
declareProbeFactsUrl,
|
|
@@ -153,9 +155,11 @@ import {
|
|
|
153
155
|
psnrDb,
|
|
154
156
|
qualifyVideoLayer,
|
|
155
157
|
queryElementStacking,
|
|
158
|
+
readReferenceBackground,
|
|
156
159
|
readWebGlVendorInfoFromCanvas,
|
|
157
160
|
rebaseVideoToWindow,
|
|
158
161
|
recaptureDrawElementFrameForVerify,
|
|
162
|
+
referenceBackgroundResult,
|
|
159
163
|
removeDomLayerMask,
|
|
160
164
|
resampleRgb48leObjectFit,
|
|
161
165
|
resolveBrowserGpuMode,
|
|
@@ -181,7 +185,7 @@ import {
|
|
|
181
185
|
videoAudioId,
|
|
182
186
|
videoStartOnMediaTimeline,
|
|
183
187
|
writeCapturedFrame
|
|
184
|
-
} from "./chunk-
|
|
188
|
+
} from "./chunk-RTUQDHKE.js";
|
|
185
189
|
import {
|
|
186
190
|
assignBundledRuntimeCompositionIds,
|
|
187
191
|
emitMountedModuleScripts,
|
|
@@ -8151,6 +8155,7 @@ async function runProbeStage(input) {
|
|
|
8151
8155
|
const motionBlur = job.config.motionBlur;
|
|
8152
8156
|
const captureFormat = resolveCaptureImageFormat({ needsAlpha, motionBlur });
|
|
8153
8157
|
const captureOpts = {
|
|
8158
|
+
recordReferenceBackground: input.recordReferenceBackground,
|
|
8154
8159
|
width,
|
|
8155
8160
|
height,
|
|
8156
8161
|
fps: job.config.fps,
|
|
@@ -11711,6 +11716,17 @@ function applyRenderWarningPolicy(job, captureWarnings, log = defaultLogger) {
|
|
|
11711
11716
|
throw new RenderQualityError(job.warnings);
|
|
11712
11717
|
}
|
|
11713
11718
|
}
|
|
11719
|
+
var stopPrepSessionOnScriptFailure = (options) => ({
|
|
11720
|
+
...options,
|
|
11721
|
+
onSubTimelineScriptFailure: () => {
|
|
11722
|
+
throw new Error("a composition script failed, so this preparation session stops");
|
|
11723
|
+
}
|
|
11724
|
+
});
|
|
11725
|
+
var surfaceScriptFailure = (error, job) => error instanceof RenderQualityError || error instanceof RenderCancelledError || !job.warnings?.some((warning) => warning.code === "sub_timeline_script_failure") ? error : new RenderQualityError(job.warnings);
|
|
11726
|
+
var withScriptFailureStop = (options, job, log) => ({
|
|
11727
|
+
...options,
|
|
11728
|
+
onSubTimelineScriptFailure: (warnings) => applyRenderWarningPolicy(job, warnings, log)
|
|
11729
|
+
});
|
|
11714
11730
|
var RenderCancelledError = class extends Error {
|
|
11715
11731
|
reason;
|
|
11716
11732
|
constructor(message = "render_cancelled", reason = "aborted") {
|
|
@@ -12078,6 +12094,7 @@ async function executeDiskCaptureWithAdaptiveRetry(options) {
|
|
|
12078
12094
|
}
|
|
12079
12095
|
function createRenderJob(config) {
|
|
12080
12096
|
return {
|
|
12097
|
+
...referenceBackgroundResult(void 0),
|
|
12081
12098
|
id: randomUUID(),
|
|
12082
12099
|
config: {
|
|
12083
12100
|
...config,
|
|
@@ -12843,6 +12860,9 @@ async function executeRenderPipeline(input) {
|
|
|
12843
12860
|
cfg.protocolTimeout = scaledProtocolTimeout;
|
|
12844
12861
|
updateCaptureObservability({ protocolTimeoutMs: scaledProtocolTimeout });
|
|
12845
12862
|
}
|
|
12863
|
+
const recordReferenceBackground = createReferenceBackgroundRecorder(
|
|
12864
|
+
(result) => Object.assign(job, result)
|
|
12865
|
+
);
|
|
12846
12866
|
const subTimelineWaitMemo = {};
|
|
12847
12867
|
const probeResult = await observeRenderStage(
|
|
12848
12868
|
observability,
|
|
@@ -12863,7 +12883,8 @@ async function executeRenderPipeline(input) {
|
|
|
12863
12883
|
height,
|
|
12864
12884
|
needsAlpha,
|
|
12865
12885
|
deviceScaleFactor,
|
|
12866
|
-
subTimelineWaitMemo
|
|
12886
|
+
subTimelineWaitMemo,
|
|
12887
|
+
recordReferenceBackground
|
|
12867
12888
|
}),
|
|
12868
12889
|
// Browser probe is pre-capture; report `browser calibrating` so a
|
|
12869
12890
|
// slow probe (~64s SwiftShader warm-up on Windows was the reported
|
|
@@ -13119,6 +13140,7 @@ async function executeRenderPipeline(input) {
|
|
|
13119
13140
|
let routePageMotionBlur;
|
|
13120
13141
|
const buildCaptureOptions = () => ({
|
|
13121
13142
|
...captureOptions,
|
|
13143
|
+
recordReferenceBackground,
|
|
13122
13144
|
...routePageMotionBlur ? { pageMotionBlur: routePageMotionBlur } : {},
|
|
13123
13145
|
videoMetadataHints,
|
|
13124
13146
|
skipReadinessVideoIds: videoReadinessSkipIds,
|
|
@@ -13151,6 +13173,8 @@ async function executeRenderPipeline(input) {
|
|
|
13151
13173
|
});
|
|
13152
13174
|
}
|
|
13153
13175
|
});
|
|
13176
|
+
const buildPrepCaptureOptions = () => stopPrepSessionOnScriptFailure(buildCaptureOptions());
|
|
13177
|
+
const buildWorkerCaptureOptions = () => withScriptFailureStop(buildCaptureOptions(), job, log);
|
|
13154
13178
|
const createRenderVideoFrameInjector = () => createVideoFrameInjector(frameLookup, frameCacheOptions(cfg, workerCount));
|
|
13155
13179
|
let captureCalibration;
|
|
13156
13180
|
const htmlInCanvasDetected = compiled.renderModeHints.reasons.some(
|
|
@@ -13254,7 +13278,7 @@ async function executeRenderPipeline(input) {
|
|
|
13254
13278
|
probeSession = await createCaptureSession(
|
|
13255
13279
|
activeFileServer.url,
|
|
13256
13280
|
framesDir,
|
|
13257
|
-
|
|
13281
|
+
buildPrepCaptureOptions(),
|
|
13258
13282
|
null,
|
|
13259
13283
|
{ ...cfg, forceScreenshot: captureForceScreenshot }
|
|
13260
13284
|
);
|
|
@@ -13337,7 +13361,7 @@ async function executeRenderPipeline(input) {
|
|
|
13337
13361
|
totalFrames,
|
|
13338
13362
|
forceScreenshot: captureForceScreenshot,
|
|
13339
13363
|
probeSession,
|
|
13340
|
-
buildCaptureOptions,
|
|
13364
|
+
buildCaptureOptions: buildPrepCaptureOptions,
|
|
13341
13365
|
createRenderVideoFrameInjector,
|
|
13342
13366
|
assertNotAborted
|
|
13343
13367
|
}),
|
|
@@ -13809,7 +13833,7 @@ async function executeRenderPipeline(input) {
|
|
|
13809
13833
|
effectiveBitrate,
|
|
13810
13834
|
deliveryEncoder,
|
|
13811
13835
|
fileServer: activeFileServer,
|
|
13812
|
-
buildCaptureOptions,
|
|
13836
|
+
buildCaptureOptions: buildWorkerCaptureOptions,
|
|
13813
13837
|
createRenderVideoFrameInjector,
|
|
13814
13838
|
hdrDiagnostics,
|
|
13815
13839
|
abortSignal: attempt,
|
|
@@ -13927,7 +13951,7 @@ async function executeRenderPipeline(input) {
|
|
|
13927
13951
|
// Each segment sets its own GOP (at most the interval); hls never reaches this route.
|
|
13928
13952
|
...deliveryEncoder
|
|
13929
13953
|
},
|
|
13930
|
-
buildCaptureOptions,
|
|
13954
|
+
buildCaptureOptions: buildWorkerCaptureOptions,
|
|
13931
13955
|
createRenderVideoFrameInjector,
|
|
13932
13956
|
abortSignal: executionSignal,
|
|
13933
13957
|
assertNotAborted,
|
|
@@ -14075,7 +14099,7 @@ async function executeRenderPipeline(input) {
|
|
|
14075
14099
|
// encoder's open-GOP output untouched.
|
|
14076
14100
|
...deliveryEncoder
|
|
14077
14101
|
},
|
|
14078
|
-
buildCaptureOptions,
|
|
14102
|
+
buildCaptureOptions: buildWorkerCaptureOptions,
|
|
14079
14103
|
createRenderVideoFrameInjector,
|
|
14080
14104
|
abortSignal: executionSignal,
|
|
14081
14105
|
assertNotAborted,
|
|
@@ -14260,7 +14284,7 @@ async function executeRenderPipeline(input) {
|
|
|
14260
14284
|
probeSession,
|
|
14261
14285
|
captureAttempts,
|
|
14262
14286
|
dedupPerfs,
|
|
14263
|
-
buildCaptureOptions,
|
|
14287
|
+
buildCaptureOptions: buildWorkerCaptureOptions,
|
|
14264
14288
|
createRenderVideoFrameInjector,
|
|
14265
14289
|
abortSignal: executionSignal,
|
|
14266
14290
|
assertNotAborted,
|
|
@@ -14493,7 +14517,7 @@ async function executeRenderPipeline(input) {
|
|
|
14493
14517
|
await eventPublisher.flush();
|
|
14494
14518
|
} catch (caught) {
|
|
14495
14519
|
await pendingAudio;
|
|
14496
|
-
const error = tooSlowError ?? caught;
|
|
14520
|
+
const error = surfaceScriptFailure(tooSlowError ?? caught, job);
|
|
14497
14521
|
if (!tooSlowError && (error instanceof RenderCancelledError || executionSignal?.aborted)) {
|
|
14498
14522
|
job.error = error instanceof Error ? error.message : "render_cancelled";
|
|
14499
14523
|
updateJobStatus(job, "cancelled", "Render cancelled", job.progress, onProgress);
|
|
@@ -14586,7 +14610,7 @@ async function executeRenderPipeline(input) {
|
|
|
14586
14610
|
|
|
14587
14611
|
// ../producer/src/services/distributed/renderSpan.ts
|
|
14588
14612
|
import { mkdirSync as mkdirSync16, mkdtempSync as mkdtempSync7, readFileSync as readFileSync11, rmSync as rmSync14 } from "fs";
|
|
14589
|
-
import { join as
|
|
14613
|
+
import { join as join40 } from "path";
|
|
14590
14614
|
import { tmpdir as tmpdir4 } from "os";
|
|
14591
14615
|
|
|
14592
14616
|
// ../producer/src/services/distributed/mp4Stitch.ts
|
|
@@ -14981,7 +15005,7 @@ import {
|
|
|
14981
15005
|
rmSync as rmSync10,
|
|
14982
15006
|
writeFileSync as writeFileSync8
|
|
14983
15007
|
} from "fs";
|
|
14984
|
-
import { extname as extname6, isAbsolute as isAbsolute2, join as
|
|
15008
|
+
import { extname as extname6, isAbsolute as isAbsolute2, join as join35, relative as relative5, sep as sep2 } from "path";
|
|
14985
15009
|
|
|
14986
15010
|
// ../producer/src/services/distributed/planFrameCost.ts
|
|
14987
15011
|
import { join as join30 } from "path";
|
|
@@ -15596,9 +15620,59 @@ function buildWeightedChunkSlices(weights, chunkCount, minFrames, maxFrames) {
|
|
|
15596
15620
|
return slices;
|
|
15597
15621
|
}
|
|
15598
15622
|
|
|
15623
|
+
// ../producer/src/services/render/planReferenceBackground.ts
|
|
15624
|
+
import { join as join31 } from "path";
|
|
15625
|
+
async function readPlanReferenceBackground(input) {
|
|
15626
|
+
let server;
|
|
15627
|
+
let session;
|
|
15628
|
+
try {
|
|
15629
|
+
server = await createFileServer({
|
|
15630
|
+
projectDir: input.projectDir,
|
|
15631
|
+
compiledDir: join31(input.workDir, "compiled"),
|
|
15632
|
+
port: 0,
|
|
15633
|
+
preHeadScripts: [VIRTUAL_TIME_SHIM],
|
|
15634
|
+
fps: input.options.fps
|
|
15635
|
+
});
|
|
15636
|
+
session = await createCaptureSession(
|
|
15637
|
+
server.url,
|
|
15638
|
+
join31(input.workDir, "reference"),
|
|
15639
|
+
{
|
|
15640
|
+
...input.options,
|
|
15641
|
+
requiresWebGpu: false
|
|
15642
|
+
},
|
|
15643
|
+
null,
|
|
15644
|
+
{
|
|
15645
|
+
...input.cfg,
|
|
15646
|
+
forceScreenshot: true,
|
|
15647
|
+
useDrawElement: false,
|
|
15648
|
+
enablePageSideCompositing: false
|
|
15649
|
+
}
|
|
15650
|
+
);
|
|
15651
|
+
const page = session.page;
|
|
15652
|
+
await page.goto(`${server.url}/index.html`, {
|
|
15653
|
+
waitUntil: "domcontentloaded",
|
|
15654
|
+
timeout: input.cfg.pageNavigationTimeout
|
|
15655
|
+
});
|
|
15656
|
+
await page.evaluate("window.__hfFlushSync?.()");
|
|
15657
|
+
await page.waitForFunction(
|
|
15658
|
+
'!!(window.__hf && typeof window.__hf.seek === "function" && window.__hf.duration > 0)',
|
|
15659
|
+
{ timeout: input.cfg.playerReadyTimeout, polling: 100 }
|
|
15660
|
+
);
|
|
15661
|
+
return referenceBackgroundResult(await readReferenceBackground(page));
|
|
15662
|
+
} catch (error) {
|
|
15663
|
+
input.log.debug("Reference background unavailable", {
|
|
15664
|
+
error: error instanceof Error ? error.message : String(error)
|
|
15665
|
+
});
|
|
15666
|
+
return referenceBackgroundResult(void 0);
|
|
15667
|
+
} finally {
|
|
15668
|
+
if (session) await closeCaptureSession(session).catch(() => void 0);
|
|
15669
|
+
if (server) closeFileServerSafely(server, "reference background", input.log);
|
|
15670
|
+
}
|
|
15671
|
+
}
|
|
15672
|
+
|
|
15599
15673
|
// ../producer/src/services/render/stages/freezePlan.ts
|
|
15600
15674
|
import { existsSync as existsSync20, mkdirSync as mkdirSync10, readFileSync as readFileSync7, readdirSync as readdirSync7, writeFileSync as writeFileSync6 } from "fs";
|
|
15601
|
-
import { join as
|
|
15675
|
+
import { join as join32, relative as relative3, resolve as resolve7 } from "path";
|
|
15602
15676
|
|
|
15603
15677
|
// ../producer/src/services/distributed/planProtocol.ts
|
|
15604
15678
|
var PLAN_SCHEMA_VERSION = 1;
|
|
@@ -15812,7 +15886,7 @@ function listPlanFiles(planDir) {
|
|
|
15812
15886
|
function walk(dir) {
|
|
15813
15887
|
const entries = readdirSync7(dir, { withFileTypes: true });
|
|
15814
15888
|
for (const entry of entries) {
|
|
15815
|
-
const full =
|
|
15889
|
+
const full = join32(dir, entry.name);
|
|
15816
15890
|
if (entry.isDirectory()) {
|
|
15817
15891
|
walk(full);
|
|
15818
15892
|
} else if (entry.isFile()) {
|
|
@@ -15853,15 +15927,15 @@ var PLAN_REMOTE_FILES_RELATIVE_PATH = "meta/remote-files.json";
|
|
|
15853
15927
|
function writePlanRemoteFiles(planDir, files) {
|
|
15854
15928
|
if (files.length === 0) return;
|
|
15855
15929
|
const sorted = [...files].sort((a, b) => a.path < b.path ? -1 : 1);
|
|
15856
|
-
writeFileSync6(
|
|
15930
|
+
writeFileSync6(join32(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH), JSON.stringify(sorted), "utf-8");
|
|
15857
15931
|
}
|
|
15858
15932
|
function readPlanRemoteFiles(planDir) {
|
|
15859
|
-
const path =
|
|
15933
|
+
const path = join32(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH);
|
|
15860
15934
|
return existsSync20(path) ? JSON.parse(readFileSync7(path, "utf-8")) : [];
|
|
15861
15935
|
}
|
|
15862
15936
|
function recomputePlanHashFromPlanDir(planDir, digests) {
|
|
15863
|
-
const planJsonPath =
|
|
15864
|
-
const encoderJsonPath =
|
|
15937
|
+
const planJsonPath = join32(planDir, "plan.json");
|
|
15938
|
+
const encoderJsonPath = join32(planDir, "meta", "encoder.json");
|
|
15865
15939
|
if (!existsSync20(planJsonPath)) {
|
|
15866
15940
|
throw new Error(`[freezePlan] plan.json missing: ${planJsonPath}`);
|
|
15867
15941
|
}
|
|
@@ -15898,18 +15972,18 @@ async function freezePlan(input) {
|
|
|
15898
15972
|
if (!existsSync20(planDir)) {
|
|
15899
15973
|
throw new Error(`[freezePlan] planDir does not exist: ${planDir}`);
|
|
15900
15974
|
}
|
|
15901
|
-
const metaDir =
|
|
15975
|
+
const metaDir = join32(planDir, "meta");
|
|
15902
15976
|
if (!existsSync20(metaDir)) mkdirSync10(metaDir, { recursive: true });
|
|
15903
15977
|
writeFileSync6(
|
|
15904
|
-
|
|
15978
|
+
join32(metaDir, "composition.json"),
|
|
15905
15979
|
`${JSON.stringify(composition, null, 2)}
|
|
15906
15980
|
`,
|
|
15907
15981
|
"utf-8"
|
|
15908
15982
|
);
|
|
15909
15983
|
const encoderForCanonical = stripUndefined(encoder);
|
|
15910
15984
|
const encoderConfigCanonicalJson = canonicalJsonStringify(encoderForCanonical);
|
|
15911
|
-
writeFileSync6(
|
|
15912
|
-
writeFileSync6(
|
|
15985
|
+
writeFileSync6(join32(metaDir, "encoder.json"), encoderConfigCanonicalJson, "utf-8");
|
|
15986
|
+
writeFileSync6(join32(metaDir, "chunks.json"), `${JSON.stringify(chunks, null, 2)}
|
|
15913
15987
|
`, "utf-8");
|
|
15914
15988
|
const { compositionHtml, assets } = collectPlanAssetShas(planDir, digests);
|
|
15915
15989
|
const planHash = computePlanHash({
|
|
@@ -15922,6 +15996,7 @@ async function freezePlan(input) {
|
|
|
15922
15996
|
dimensions
|
|
15923
15997
|
});
|
|
15924
15998
|
const planJson = {
|
|
15999
|
+
...referenceBackgroundResult(composition[REFERENCE_BACKGROUND_FIELD]),
|
|
15925
16000
|
protocol: PLAN_PROTOCOL_V1,
|
|
15926
16001
|
planHash,
|
|
15927
16002
|
producerVersion,
|
|
@@ -15933,7 +16008,7 @@ async function freezePlan(input) {
|
|
|
15933
16008
|
duration: durationSeconds,
|
|
15934
16009
|
hasAudio
|
|
15935
16010
|
};
|
|
15936
|
-
const planJsonPath =
|
|
16011
|
+
const planJsonPath = join32(planDir, "plan.json");
|
|
15937
16012
|
writeFileSync6(planJsonPath, `${JSON.stringify(planJson, null, 2)}
|
|
15938
16013
|
`, "utf-8");
|
|
15939
16014
|
return { planJsonPath, planHash };
|
|
@@ -15977,7 +16052,7 @@ function applyRuntimeEnvSnapshot(snapshot, env = process.env) {
|
|
|
15977
16052
|
// ../producer/src/services/distributed/chunkAudio.ts
|
|
15978
16053
|
import { closeSync as closeSync5, existsSync as existsSync21, ftruncateSync, mkdirSync as mkdirSync11, openSync as openSync5, readFileSync as readFileSync8 } from "fs";
|
|
15979
16054
|
import { writeFileSync as writeFileSync7, writeSync } from "fs";
|
|
15980
|
-
import { join as
|
|
16055
|
+
import { join as join33 } from "path";
|
|
15981
16056
|
function audioCutForChunk(grid, chunks, index, fps) {
|
|
15982
16057
|
const firstPacketAt = (frame) => Math.min(
|
|
15983
16058
|
grid.packetCount,
|
|
@@ -16064,7 +16139,7 @@ async function writeChunkAudioSlices(input) {
|
|
|
16064
16139
|
});
|
|
16065
16140
|
const bytes = readFileSync8(input.audioPath);
|
|
16066
16141
|
const layout = { sizeBytes: bytes.length, payloadStart, payloadEnd, partStarts: {} };
|
|
16067
|
-
mkdirSync11(
|
|
16142
|
+
mkdirSync11(join33(input.planDir, SLICE_DIR), { recursive: true });
|
|
16068
16143
|
input.chunks.forEach((_, index) => {
|
|
16069
16144
|
const cut = audioCutForChunk(grid, input.chunks, index, input.fps);
|
|
16070
16145
|
if (!cut) return;
|
|
@@ -16072,17 +16147,17 @@ async function writeChunkAudioSlices(input) {
|
|
|
16072
16147
|
const start = offsets[cut.firstPacket];
|
|
16073
16148
|
layout.partStarts[index] = start;
|
|
16074
16149
|
const end = offsets[last] + track.sizes[last];
|
|
16075
|
-
writeFileSync7(
|
|
16150
|
+
writeFileSync7(join33(input.planDir, chunkAudioSlicePath(index)), bytes.subarray(start, end));
|
|
16076
16151
|
});
|
|
16077
16152
|
const frame = [bytes.subarray(0, payloadStart), bytes.subarray(payloadEnd)];
|
|
16078
|
-
writeFileSync7(
|
|
16079
|
-
writeFileSync7(
|
|
16153
|
+
writeFileSync7(join33(input.planDir, SLICE_FRAME), Buffer.concat(frame));
|
|
16154
|
+
writeFileSync7(join33(input.planDir, SLICE_LAYOUT), JSON.stringify(layout));
|
|
16080
16155
|
}
|
|
16081
16156
|
function chunkAudioSource(planDir, chunkIndex, scratchPath) {
|
|
16082
|
-
const layoutPath =
|
|
16157
|
+
const layoutPath = join33(planDir, SLICE_LAYOUT);
|
|
16083
16158
|
if (!existsSync21(layoutPath)) return resolvePlanAudioPath(planDir);
|
|
16084
16159
|
const layout = JSON.parse(readFileSync8(layoutPath, "utf-8"));
|
|
16085
|
-
const frame = readFileSync8(
|
|
16160
|
+
const frame = readFileSync8(join33(planDir, SLICE_FRAME));
|
|
16086
16161
|
const fd = openSync5(scratchPath, "w");
|
|
16087
16162
|
try {
|
|
16088
16163
|
writeSync(fd, frame, 0, layout.payloadStart, 0);
|
|
@@ -16095,7 +16170,7 @@ function chunkAudioSource(planDir, chunkIndex, scratchPath) {
|
|
|
16095
16170
|
);
|
|
16096
16171
|
const start = layout.partStarts[chunkIndex];
|
|
16097
16172
|
if (start !== void 0) {
|
|
16098
|
-
const part = readFileSync8(
|
|
16173
|
+
const part = readFileSync8(join33(planDir, chunkAudioSlicePath(chunkIndex)));
|
|
16099
16174
|
writeSync(fd, part, 0, part.length, start);
|
|
16100
16175
|
}
|
|
16101
16176
|
ftruncateSync(fd, layout.sizeBytes);
|
|
@@ -16151,7 +16226,7 @@ async function muxChunkWithAudio(input) {
|
|
|
16151
16226
|
// ../producer/src/services/distributed/planSize.ts
|
|
16152
16227
|
import { createHash as createHash7 } from "crypto";
|
|
16153
16228
|
import { lstatSync as lstatSync2, readdirSync as readdirSync8 } from "fs";
|
|
16154
|
-
import { extname as extname5, join as
|
|
16229
|
+
import { extname as extname5, join as join34, relative as relative4 } from "path";
|
|
16155
16230
|
var MAX_TOP_COMPONENTS = 10;
|
|
16156
16231
|
var SOURCE_MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
16157
16232
|
".aac",
|
|
@@ -16263,7 +16338,7 @@ function walkRegularFiles(dir, visit) {
|
|
|
16263
16338
|
return;
|
|
16264
16339
|
}
|
|
16265
16340
|
for (const entry of entries) {
|
|
16266
|
-
const full =
|
|
16341
|
+
const full = join34(dir, entry.name);
|
|
16267
16342
|
if (entry.isDirectory()) {
|
|
16268
16343
|
walkRegularFiles(full, visit);
|
|
16269
16344
|
} else if (entry.isFile()) {
|
|
@@ -16475,13 +16550,13 @@ function assertPositiveInteger2(name, value) {
|
|
|
16475
16550
|
}
|
|
16476
16551
|
var FREEZE_OWNED_PLAN_FILES = [
|
|
16477
16552
|
"plan.json",
|
|
16478
|
-
|
|
16479
|
-
|
|
16480
|
-
|
|
16553
|
+
join35("meta", "composition.json"),
|
|
16554
|
+
join35("meta", "encoder.json"),
|
|
16555
|
+
join35("meta", "chunks.json")
|
|
16481
16556
|
];
|
|
16482
16557
|
function removeFreezeOwnedPlanFiles(planDir) {
|
|
16483
16558
|
for (const relativePath of FREEZE_OWNED_PLAN_FILES) {
|
|
16484
|
-
rmSync10(
|
|
16559
|
+
rmSync10(join35(planDir, relativePath), { force: true });
|
|
16485
16560
|
}
|
|
16486
16561
|
}
|
|
16487
16562
|
function buildChunkSlices(totalFrames, chunkCount, effectiveChunkSize) {
|
|
@@ -16636,19 +16711,19 @@ function createVideoSourceShipper(input) {
|
|
|
16636
16711
|
const known = shipped.get(srcPath);
|
|
16637
16712
|
if (known) return known;
|
|
16638
16713
|
const stagedRel = pathInside(input.workVideoFramesDir, srcPath);
|
|
16639
|
-
const current = stagedRel === null ? srcPath :
|
|
16714
|
+
const current = stagedRel === null ? srcPath : join35(input.planDir, "video-frames", stagedRel);
|
|
16640
16715
|
let result = null;
|
|
16641
16716
|
for (const root of stagedRel === null ? [input.workCompiledDir, input.projectDir] : []) {
|
|
16642
16717
|
const rel = pathInside(root, srcPath);
|
|
16643
|
-
if (rel !== null && (existsSync22(
|
|
16718
|
+
if (rel !== null && (existsSync22(join35(input.planDir, "compiled", rel)) || input.isRemote(srcPath))) {
|
|
16644
16719
|
result = ["compiled", ...rel.split(sep2)].join("/");
|
|
16645
16720
|
break;
|
|
16646
16721
|
}
|
|
16647
16722
|
}
|
|
16648
16723
|
if (result === null) {
|
|
16649
16724
|
result = `video-sources/${shipped.size}${extname6(current)}`;
|
|
16650
|
-
const destination =
|
|
16651
|
-
mkdirSync12(
|
|
16725
|
+
const destination = join35(input.planDir, ...result.split("/"));
|
|
16726
|
+
mkdirSync12(join35(input.planDir, "video-sources"), { recursive: true });
|
|
16652
16727
|
try {
|
|
16653
16728
|
linkSync(current, destination);
|
|
16654
16729
|
} catch {
|
|
@@ -16697,14 +16772,14 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
16697
16772
|
variables: config.variables
|
|
16698
16773
|
});
|
|
16699
16774
|
const entryFile = config.entryFile ?? "index.html";
|
|
16700
|
-
const htmlPath =
|
|
16775
|
+
const htmlPath = join35(projectDir, entryFile);
|
|
16701
16776
|
if (!existsSync22(htmlPath)) {
|
|
16702
16777
|
throw new Error(`[plan] entry file not found: ${htmlPath}`);
|
|
16703
16778
|
}
|
|
16704
|
-
const workDir =
|
|
16779
|
+
const workDir = join35(planDir, ".plan-work");
|
|
16705
16780
|
rmSync10(workDir, { recursive: true, force: true });
|
|
16706
16781
|
mkdirSync12(workDir, { recursive: true });
|
|
16707
|
-
const compiledDir =
|
|
16782
|
+
const compiledDir = join35(workDir, "compiled");
|
|
16708
16783
|
mkdirSync12(compiledDir, { recursive: true });
|
|
16709
16784
|
let stageStarted = Date.now();
|
|
16710
16785
|
cpSync2(projectDir, compiledDir, {
|
|
@@ -16718,10 +16793,10 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
16718
16793
|
}
|
|
16719
16794
|
});
|
|
16720
16795
|
logPlanStage(log, "copy", stageStarted);
|
|
16721
|
-
const finalCompiledDir =
|
|
16796
|
+
const finalCompiledDir = join35(planDir, "compiled");
|
|
16722
16797
|
const needsAlpha = outputNeedsAlpha(config.format);
|
|
16723
16798
|
const remoteFiles = Object.entries(options.remoteFiles ?? {});
|
|
16724
|
-
const remoteLocalPath = (rel) =>
|
|
16799
|
+
const remoteLocalPath = (rel) => join35(projectDir, ...rel.split("/"));
|
|
16725
16800
|
for (const [, file] of remoteFiles) {
|
|
16726
16801
|
declareContentAddressedUrl(file.url, file.sha256);
|
|
16727
16802
|
if (file.probeFactsUrl) declareProbeFactsUrl(file.url, file.probeFactsUrl);
|
|
@@ -16771,6 +16846,9 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
16771
16846
|
}
|
|
16772
16847
|
stageStarted = Date.now();
|
|
16773
16848
|
const probeResult = await runProbeStage({
|
|
16849
|
+
recordReferenceBackground: createReferenceBackgroundRecorder(
|
|
16850
|
+
(result) => Object.assign(job, result)
|
|
16851
|
+
),
|
|
16774
16852
|
projectDir,
|
|
16775
16853
|
workDir,
|
|
16776
16854
|
job,
|
|
@@ -16788,6 +16866,21 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
16788
16866
|
subTimelineWaitMemo: {}
|
|
16789
16867
|
});
|
|
16790
16868
|
logPlanStage(log, "probe", stageStarted);
|
|
16869
|
+
if (!probeResult.probeSession) {
|
|
16870
|
+
stageStarted = Date.now();
|
|
16871
|
+
Object.assign(
|
|
16872
|
+
job,
|
|
16873
|
+
await readPlanReferenceBackground({
|
|
16874
|
+
projectDir,
|
|
16875
|
+
workDir,
|
|
16876
|
+
cfg,
|
|
16877
|
+
log,
|
|
16878
|
+
options: { width, height, fps: job.config.fps, variables: job.config.variables }
|
|
16879
|
+
})
|
|
16880
|
+
);
|
|
16881
|
+
assertNotAborted();
|
|
16882
|
+
logPlanStage(log, "reference_background", stageStarted);
|
|
16883
|
+
}
|
|
16791
16884
|
compiled = probeResult.compiled;
|
|
16792
16885
|
job.duration = probeResult.duration;
|
|
16793
16886
|
job.totalFrames = probeResult.totalFrames;
|
|
@@ -16800,7 +16893,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
16800
16893
|
if (probeResult.fileServer) closeFileServerSafely(probeResult.fileServer, "plan", log);
|
|
16801
16894
|
if (probeResult.probeSession) {
|
|
16802
16895
|
try {
|
|
16803
|
-
const { closeCaptureSession: closeCaptureSession2 } = await import("./src-
|
|
16896
|
+
const { closeCaptureSession: closeCaptureSession2 } = await import("./src-7WW3KXOI.js");
|
|
16804
16897
|
await closeCaptureSession2(probeResult.probeSession);
|
|
16805
16898
|
} catch (err) {
|
|
16806
16899
|
log.warn("[plan] probe session close failed", {
|
|
@@ -16907,10 +17000,10 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
16907
17000
|
let stageStarted = Date.now();
|
|
16908
17001
|
const extractResult = await extractPlanVideos(c, options.deferVideoExtraction);
|
|
16909
17002
|
logPlanStage(log, "extract", stageStarted);
|
|
16910
|
-
const stagedVideoFrames =
|
|
16911
|
-
const videoFramesDst =
|
|
17003
|
+
const stagedVideoFrames = join35(compiledDir, "__hyperframes_video_frames");
|
|
17004
|
+
const videoFramesDst = join35(planDir, "video-frames");
|
|
16912
17005
|
if (existsSync22(videoFramesDst)) rmSync10(videoFramesDst, { recursive: true, force: true });
|
|
16913
|
-
const videoSourcesDir =
|
|
17006
|
+
const videoSourcesDir = join35(planDir, "video-sources");
|
|
16914
17007
|
rmSync10(videoSourcesDir, { recursive: true, force: true });
|
|
16915
17008
|
if (existsSync22(stagedVideoFrames)) {
|
|
16916
17009
|
renameWithRetry(stagedVideoFrames, videoFramesDst);
|
|
@@ -16947,7 +17040,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
16947
17040
|
};
|
|
16948
17041
|
})
|
|
16949
17042
|
});
|
|
16950
|
-
mkdirSync12(
|
|
17043
|
+
mkdirSync12(join35(planDir, "meta"), { recursive: true });
|
|
16951
17044
|
writePlanRemoteFiles(
|
|
16952
17045
|
planDir,
|
|
16953
17046
|
remoteFiles.map(([rel, { sha256, sizeBytes }]) => ({
|
|
@@ -16957,7 +17050,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
16957
17050
|
}))
|
|
16958
17051
|
);
|
|
16959
17052
|
writeFileSync8(
|
|
16960
|
-
|
|
17053
|
+
join35(planDir, PLAN_VIDEOS_META_RELATIVE_PATH),
|
|
16961
17054
|
JSON.stringify(planVideosJson, null, 2),
|
|
16962
17055
|
"utf-8"
|
|
16963
17056
|
);
|
|
@@ -17036,7 +17129,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
17036
17129
|
if (audioResult?.audioError) {
|
|
17037
17130
|
applyDistributedAudioWarningPolicy(job, audioResult.audioError, audioResult.audioFailures, log);
|
|
17038
17131
|
}
|
|
17039
|
-
const planAudioPath =
|
|
17132
|
+
const planAudioPath = join35(planDir, PLAN_AUDIO_RELATIVE_PATH);
|
|
17040
17133
|
if (audioResult?.hasAudio && existsSync22(audioResult.audioOutputPath)) {
|
|
17041
17134
|
renameWithRetry(audioResult.audioOutputPath, planAudioPath);
|
|
17042
17135
|
}
|
|
@@ -17069,6 +17162,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
17069
17162
|
separateAudio
|
|
17070
17163
|
});
|
|
17071
17164
|
const compositionJson = {
|
|
17165
|
+
...referenceBackgroundResult(job[REFERENCE_BACKGROUND_FIELD]),
|
|
17072
17166
|
durationSeconds: job.duration ?? 0,
|
|
17073
17167
|
width,
|
|
17074
17168
|
height,
|
|
@@ -17124,6 +17218,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
17124
17218
|
log
|
|
17125
17219
|
});
|
|
17126
17220
|
return {
|
|
17221
|
+
...referenceBackgroundResult(job[REFERENCE_BACKGROUND_FIELD]),
|
|
17127
17222
|
executionPlanDir: planDir,
|
|
17128
17223
|
executionPlanHash: planHash,
|
|
17129
17224
|
chunkCount,
|
|
@@ -17139,6 +17234,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
17139
17234
|
async function plan(projectDir, config, planDir, options = {}) {
|
|
17140
17235
|
const executionPlan = await buildLocalExecutionPlan(projectDir, config, planDir, options);
|
|
17141
17236
|
return {
|
|
17237
|
+
...referenceBackgroundResult(executionPlan[REFERENCE_BACKGROUND_FIELD]),
|
|
17142
17238
|
planDir: executionPlan.executionPlanDir,
|
|
17143
17239
|
planProtocol: PLAN_PROTOCOL_V1,
|
|
17144
17240
|
planHash: executionPlan.executionPlanHash,
|
|
@@ -17157,7 +17253,7 @@ async function plan(projectDir, config, planDir, options = {}) {
|
|
|
17157
17253
|
import { randomBytes } from "crypto";
|
|
17158
17254
|
import { existsSync as existsSync25, mkdirSync as mkdirSync15, readFileSync as readFileSync10, readdirSync as readdirSync10, rmSync as rmSync13, writeFileSync as writeFileSync11 } from "fs";
|
|
17159
17255
|
import { cpus as cpus3 } from "os";
|
|
17160
|
-
import { join as
|
|
17256
|
+
import { join as join39 } from "path";
|
|
17161
17257
|
|
|
17162
17258
|
// ../producer/src/services/distributed/planV2.ts
|
|
17163
17259
|
import {
|
|
@@ -17173,7 +17269,7 @@ import {
|
|
|
17173
17269
|
writeFileSync as writeFileSync10
|
|
17174
17270
|
} from "fs";
|
|
17175
17271
|
import { tmpdir as tmpdir3 } from "os";
|
|
17176
|
-
import { dirname as dirname14, isAbsolute as isAbsolute3, join as
|
|
17272
|
+
import { dirname as dirname14, isAbsolute as isAbsolute3, join as join38, relative as relative6, resolve as resolve8, sep as sep3 } from "path";
|
|
17177
17273
|
|
|
17178
17274
|
// ../producer/src/services/distributed/planV2Publisher.ts
|
|
17179
17275
|
import {
|
|
@@ -17186,7 +17282,7 @@ import {
|
|
|
17186
17282
|
statSync as statSync7,
|
|
17187
17283
|
writeFileSync as writeFileSync9
|
|
17188
17284
|
} from "fs";
|
|
17189
|
-
import { dirname as dirname13, join as
|
|
17285
|
+
import { dirname as dirname13, join as join37 } from "path";
|
|
17190
17286
|
|
|
17191
17287
|
// ../producer/src/services/distributed/planV2Errors.ts
|
|
17192
17288
|
var PLAN_V2_INTEGRITY_UNRECOVERABLE = "PLAN_V2_INTEGRITY_UNRECOVERABLE";
|
|
@@ -17201,7 +17297,7 @@ var PlanV2IntegrityError = class extends Error {
|
|
|
17201
17297
|
};
|
|
17202
17298
|
|
|
17203
17299
|
// ../producer/src/services/distributed/planV2Layout.ts
|
|
17204
|
-
import { join as
|
|
17300
|
+
import { join as join36 } from "path";
|
|
17205
17301
|
var SHA256_PATTERN = /^[0-9a-f]{64}$/;
|
|
17206
17302
|
function assertPlanV2Sha256(value, field) {
|
|
17207
17303
|
if (typeof value !== "string" || !SHA256_PATTERN.test(value)) {
|
|
@@ -17211,7 +17307,7 @@ function assertPlanV2Sha256(value, field) {
|
|
|
17211
17307
|
}
|
|
17212
17308
|
function planV2BlobPath(root, sha256) {
|
|
17213
17309
|
const digest = assertPlanV2Sha256(sha256, "artifact sha256");
|
|
17214
|
-
return
|
|
17310
|
+
return join36(root, "artifacts", "sha256", digest.slice(0, 2), digest);
|
|
17215
17311
|
}
|
|
17216
17312
|
|
|
17217
17313
|
// ../producer/src/services/distributed/planV2Publisher.ts
|
|
@@ -17252,7 +17348,7 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
17252
17348
|
this.destinationDir = destinationDir;
|
|
17253
17349
|
this.#linkFile = options.linkFile ?? linkSync2;
|
|
17254
17350
|
mkdirSync13(dirname13(destinationDir), { recursive: true });
|
|
17255
|
-
this.temporaryDir = mkdtempSync5(
|
|
17351
|
+
this.temporaryDir = mkdtempSync5(join37(dirname13(destinationDir), ".plan-v2-publish-"));
|
|
17256
17352
|
}
|
|
17257
17353
|
async putBlob(blob) {
|
|
17258
17354
|
const digest = assertPlanV2Sha256(blob.sha256, "published blob sha256");
|
|
@@ -17265,8 +17361,8 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
17265
17361
|
const destinationPath = planV2BlobPath(this.temporaryDir, digest);
|
|
17266
17362
|
if (existsSync23(destinationPath)) return;
|
|
17267
17363
|
mkdirSync13(dirname13(destinationPath), { recursive: true });
|
|
17268
|
-
const stagingDir = mkdtempSync5(
|
|
17269
|
-
const temporaryPath =
|
|
17364
|
+
const stagingDir = mkdtempSync5(join37(dirname13(destinationPath), ".plan-v2-blob-"));
|
|
17365
|
+
const temporaryPath = join37(stagingDir, "blob");
|
|
17270
17366
|
try {
|
|
17271
17367
|
try {
|
|
17272
17368
|
this.#linkFile(blob.sourcePath, temporaryPath);
|
|
@@ -17287,7 +17383,7 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
17287
17383
|
);
|
|
17288
17384
|
}
|
|
17289
17385
|
}
|
|
17290
|
-
writeFileSync9(
|
|
17386
|
+
writeFileSync9(join37(this.temporaryDir, "plan.json"), manifestBytes, "utf-8");
|
|
17291
17387
|
renameWithRetry(this.temporaryDir, this.destinationDir);
|
|
17292
17388
|
this.#committed = true;
|
|
17293
17389
|
}
|
|
@@ -17332,7 +17428,7 @@ function listFiles(root) {
|
|
|
17332
17428
|
const rootResolved = resolve8(root);
|
|
17333
17429
|
function walk(dir) {
|
|
17334
17430
|
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
17335
|
-
const absolutePath =
|
|
17431
|
+
const absolutePath = join38(dir, entry.name);
|
|
17336
17432
|
if (entry.isDirectory()) {
|
|
17337
17433
|
walk(absolutePath);
|
|
17338
17434
|
} else if (entry.isFile()) {
|
|
@@ -17359,13 +17455,13 @@ function assertValidExtractionCacheCompleteSentinel(path) {
|
|
|
17359
17455
|
}
|
|
17360
17456
|
}
|
|
17361
17457
|
function validateExtractionCacheCompleteSentinels(executionPlanDir) {
|
|
17362
|
-
const videoRoot =
|
|
17458
|
+
const videoRoot = join38(executionPlanDir, "video-frames");
|
|
17363
17459
|
if (!existsSync24(videoRoot)) return;
|
|
17364
17460
|
for (const videoEntry of readdirSync9(videoRoot, { withFileTypes: true })) {
|
|
17365
17461
|
if (!videoEntry.isDirectory()) continue;
|
|
17366
|
-
const videoDir =
|
|
17462
|
+
const videoDir = join38(videoRoot, videoEntry.name);
|
|
17367
17463
|
if (readdirSync9(videoDir).includes(EXTRACTION_CACHE_COMPLETE_SENTINEL)) {
|
|
17368
|
-
const sentinelPath =
|
|
17464
|
+
const sentinelPath = join38(videoDir, EXTRACTION_CACHE_COMPLETE_SENTINEL);
|
|
17369
17465
|
assertValidExtractionCacheCompleteSentinel(sentinelPath);
|
|
17370
17466
|
}
|
|
17371
17467
|
}
|
|
@@ -17412,7 +17508,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
|
|
|
17412
17508
|
if (video.deferredRange) {
|
|
17413
17509
|
const framePaths2 = /* @__PURE__ */ new Map();
|
|
17414
17510
|
for (let index = 0; index < video.totalFrames; index++) {
|
|
17415
|
-
framePaths2.set(index,
|
|
17511
|
+
framePaths2.set(index, join38(outputDir, String(index)));
|
|
17416
17512
|
}
|
|
17417
17513
|
return { ...video, outputDir, framePaths: framePaths2, ownedByLookup: false };
|
|
17418
17514
|
}
|
|
@@ -17420,7 +17516,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
|
|
|
17420
17516
|
const framePaths = /* @__PURE__ */ new Map();
|
|
17421
17517
|
for (const frameName of frameNames) {
|
|
17422
17518
|
if (frameName === EXTRACTION_CACHE_COMPLETE_SENTINEL) {
|
|
17423
|
-
assertValidExtractionCacheCompleteSentinel(
|
|
17519
|
+
assertValidExtractionCacheCompleteSentinel(join38(outputDir, frameName));
|
|
17424
17520
|
continue;
|
|
17425
17521
|
}
|
|
17426
17522
|
const match = /(\d+)(?=\.[^.]+$)/.exec(frameName);
|
|
@@ -17439,7 +17535,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
|
|
|
17439
17535
|
`duplicate extracted frame index ${frameIndex} in ${outputDir}`
|
|
17440
17536
|
);
|
|
17441
17537
|
}
|
|
17442
|
-
framePaths.set(frameIndex,
|
|
17538
|
+
framePaths.set(frameIndex, join38(outputDir, frameName));
|
|
17443
17539
|
}
|
|
17444
17540
|
return {
|
|
17445
17541
|
...video,
|
|
@@ -17460,7 +17556,7 @@ function parsePlanVideosJson2(value) {
|
|
|
17460
17556
|
}
|
|
17461
17557
|
}
|
|
17462
17558
|
function materializeExtractedVideoDirectories(planDir) {
|
|
17463
|
-
const videosPath =
|
|
17559
|
+
const videosPath = join38(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
|
|
17464
17560
|
if (!existsSync24(videosPath)) return;
|
|
17465
17561
|
const videos = parsePlanVideosJson2(readJsonFile(videosPath, PLAN_VIDEOS_META_RELATIVE_PATH));
|
|
17466
17562
|
for (const video of videos.extracted) {
|
|
@@ -17494,13 +17590,13 @@ function parseChunkSlices(value) {
|
|
|
17494
17590
|
});
|
|
17495
17591
|
}
|
|
17496
17592
|
function buildVideoChunkDependencies(executionPlanDir, dimensions) {
|
|
17497
|
-
const videoRoot =
|
|
17593
|
+
const videoRoot = join38(executionPlanDir, "video-frames");
|
|
17498
17594
|
const hasExtractedFrames = existsSync24(videoRoot) && listFiles(videoRoot).length > 0;
|
|
17499
|
-
const videosPath =
|
|
17595
|
+
const videosPath = join38(executionPlanDir, PLAN_VIDEOS_META_RELATIVE_PATH);
|
|
17500
17596
|
if (!existsSync24(videosPath)) {
|
|
17501
17597
|
return hasExtractedFrames ? { mode: "full-source-pack", dependencies: null } : { mode: "exact-rendered-frames", dependencies: /* @__PURE__ */ new Map() };
|
|
17502
17598
|
}
|
|
17503
|
-
const chunksPath =
|
|
17599
|
+
const chunksPath = join38(executionPlanDir, "meta", "chunks.json");
|
|
17504
17600
|
const videos = readJsonFile(videosPath, PLAN_VIDEOS_META_RELATIVE_PATH);
|
|
17505
17601
|
const chunks = readJsonFile(chunksPath, "meta/chunks.json");
|
|
17506
17602
|
const parsedVideos = parsePlanVideosJson2(videos);
|
|
@@ -17556,8 +17652,8 @@ function computeManifestHash(manifest) {
|
|
|
17556
17652
|
function writeBlob(sourcePath, destinationPath) {
|
|
17557
17653
|
if (existsSync24(destinationPath)) return;
|
|
17558
17654
|
mkdirSync14(dirname14(destinationPath), { recursive: true });
|
|
17559
|
-
const temporaryDir = mkdtempSync6(
|
|
17560
|
-
const temporaryPath =
|
|
17655
|
+
const temporaryDir = mkdtempSync6(join38(dirname14(destinationPath), ".plan-v2-blob-"));
|
|
17656
|
+
const temporaryPath = join38(temporaryDir, "blob");
|
|
17561
17657
|
try {
|
|
17562
17658
|
copyFileSync6(sourcePath, temporaryPath);
|
|
17563
17659
|
renameWithRetry(temporaryPath, destinationPath);
|
|
@@ -17593,7 +17689,7 @@ async function putTasks(tasks) {
|
|
|
17593
17689
|
if (failure) throw failure.reason;
|
|
17594
17690
|
}
|
|
17595
17691
|
function buildPlanV2Publication(executionPlanDir, digests) {
|
|
17596
|
-
const executionPlanPath =
|
|
17692
|
+
const executionPlanPath = join38(executionPlanDir, "plan.json");
|
|
17597
17693
|
if (!existsSync24(executionPlanPath)) {
|
|
17598
17694
|
throw new PlanV2IntegrityError(`execution plan is missing plan.json: ${executionPlanPath}`);
|
|
17599
17695
|
}
|
|
@@ -17621,7 +17717,7 @@ function buildPlanV2Publication(executionPlanDir, digests) {
|
|
|
17621
17717
|
}
|
|
17622
17718
|
validateExtractionCacheCompleteSentinels(executionPlanDir);
|
|
17623
17719
|
const videoDependencyPlan = buildVideoChunkDependencies(executionPlanDir, dimensions);
|
|
17624
|
-
const encoder = readJsonFile(
|
|
17720
|
+
const encoder = readJsonFile(join38(executionPlanDir, "meta", "encoder.json"), "meta/encoder.json");
|
|
17625
17721
|
const files = listFiles(executionPlanDir);
|
|
17626
17722
|
const chunkAudio = !isRecord3(encoder) || encoder.chunksCarryAudio !== true ? "none" : files.some((file) => chunkAudioSliceTarget(file.path) !== null) ? "sliced" : "whole";
|
|
17627
17723
|
for (const file of files) {
|
|
@@ -17682,13 +17778,13 @@ function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
|
|
|
17682
17778
|
throw new PlanV2IntegrityError("a local plan v2 directory cannot reference remote files");
|
|
17683
17779
|
}
|
|
17684
17780
|
mkdirSync14(dirname14(planV2Dir), { recursive: true });
|
|
17685
|
-
const tempDir = mkdtempSync6(
|
|
17781
|
+
const tempDir = mkdtempSync6(join38(dirname14(planV2Dir), ".plan-v2-build-"));
|
|
17686
17782
|
try {
|
|
17687
17783
|
for (const blob of publication.blobs) {
|
|
17688
17784
|
writeBlob(blob.sourcePath, planV2BlobPath(tempDir, blob.sha256));
|
|
17689
17785
|
}
|
|
17690
17786
|
writeFileSync10(
|
|
17691
|
-
|
|
17787
|
+
join38(tempDir, "plan.json"),
|
|
17692
17788
|
canonicalJsonStringify(publication.manifest),
|
|
17693
17789
|
"utf-8"
|
|
17694
17790
|
);
|
|
@@ -17729,7 +17825,7 @@ async function publishExecutionPlan(executionPlanDir, publisher, { digests, log
|
|
|
17729
17825
|
}
|
|
17730
17826
|
}
|
|
17731
17827
|
async function planV2WithPublisher(projectDir, config, publisher, options = {}) {
|
|
17732
|
-
const stagingRoot = mkdtempSync6(
|
|
17828
|
+
const stagingRoot = mkdtempSync6(join38(options.stagingParentDir ?? tmpdir3(), ".execution-plan-"));
|
|
17733
17829
|
const digests = /* @__PURE__ */ new Map();
|
|
17734
17830
|
try {
|
|
17735
17831
|
await buildLocalExecutionPlan(projectDir, config, stagingRoot, {
|
|
@@ -17740,7 +17836,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
|
|
|
17740
17836
|
// artifactTargets ships every compiled/ file to all chunks, so each is in the manifest.
|
|
17741
17837
|
whileAudioMixes: () => putBlobs(
|
|
17742
17838
|
publisher,
|
|
17743
|
-
listFiles(
|
|
17839
|
+
listFiles(join38(stagingRoot, "compiled")).map(
|
|
17744
17840
|
(file) => publishBlobFor(file.absolutePath, digests)
|
|
17745
17841
|
)
|
|
17746
17842
|
),
|
|
@@ -17770,9 +17866,14 @@ async function planV2(projectDir, config, planV2Dir) {
|
|
|
17770
17866
|
return resultFromManifest(planV2Dir, manifest);
|
|
17771
17867
|
}
|
|
17772
17868
|
function resultFromManifest(planV2Dir, manifest) {
|
|
17869
|
+
const artifact = manifest.artifacts.find((entry) => entry.path === "plan.json");
|
|
17870
|
+
const executionPlan = artifact ? readJsonFile(verifyBlob(planV2Dir, artifact), "execution plan.json") : null;
|
|
17773
17871
|
return {
|
|
17872
|
+
...referenceBackgroundResult(
|
|
17873
|
+
isRecord3(executionPlan) ? executionPlan[REFERENCE_BACKGROUND_FIELD] : void 0
|
|
17874
|
+
),
|
|
17774
17875
|
planDir: planV2Dir,
|
|
17775
|
-
manifestPath:
|
|
17876
|
+
manifestPath: join38(planV2Dir, "plan.json"),
|
|
17776
17877
|
planProtocol: PLAN_PROTOCOL_V2,
|
|
17777
17878
|
planHash: manifest.planHash,
|
|
17778
17879
|
sourcePlanV1Hash: getPlanV2ExecutionPlanHash(manifest),
|
|
@@ -17908,7 +18009,7 @@ function parsePlanV2Manifest(value) {
|
|
|
17908
18009
|
return parsed;
|
|
17909
18010
|
}
|
|
17910
18011
|
function readPlanV2Manifest(planV2Dir) {
|
|
17911
|
-
const manifestPath =
|
|
18012
|
+
const manifestPath = join38(planV2Dir, "plan.json");
|
|
17912
18013
|
if (!existsSync24(manifestPath)) {
|
|
17913
18014
|
throw new PlanV2IntegrityError(`missing v2 manifest: ${manifestPath}`);
|
|
17914
18015
|
}
|
|
@@ -17954,16 +18055,16 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
|
|
|
17954
18055
|
sourcePath: verifyBlob(planV2Dir, artifact)
|
|
17955
18056
|
}));
|
|
17956
18057
|
mkdirSync14(dirname14(destinationDir), { recursive: true });
|
|
17957
|
-
const tempDir = mkdtempSync6(
|
|
18058
|
+
const tempDir = mkdtempSync6(join38(dirname14(destinationDir), ".plan-v2-materialize-"));
|
|
17958
18059
|
try {
|
|
17959
18060
|
for (const { artifact, sourcePath } of verified) {
|
|
17960
|
-
const destinationPath =
|
|
18061
|
+
const destinationPath = join38(tempDir, ...artifact.path.split("/"));
|
|
17961
18062
|
mkdirSync14(dirname14(destinationPath), { recursive: true });
|
|
17962
18063
|
copyFileSync6(sourcePath, destinationPath);
|
|
17963
18064
|
}
|
|
17964
18065
|
if (target.role === "chunk") materializeExtractedVideoDirectories(tempDir);
|
|
17965
18066
|
writeFileSync10(
|
|
17966
|
-
|
|
18067
|
+
join38(tempDir, PLAN_V2_MATERIALIZATION_MARKER),
|
|
17967
18068
|
canonicalJsonStringify({
|
|
17968
18069
|
manifest,
|
|
17969
18070
|
target,
|
|
@@ -17986,7 +18087,7 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
|
|
|
17986
18087
|
// Join the artifact's OWN name, not the current constant: a plan written
|
|
17987
18088
|
// before the container change carries the legacy name, and materializing it
|
|
17988
18089
|
// under the new one would point at a file that was never written.
|
|
17989
|
-
audioPath: target.role === "assembler" ? audioArtifact ?
|
|
18090
|
+
audioPath: target.role === "assembler" ? audioArtifact ? join38(destinationDir, audioArtifact.path) : null : null
|
|
17990
18091
|
};
|
|
17991
18092
|
}
|
|
17992
18093
|
function assertRemoteSources(remoteSources, artifacts) {
|
|
@@ -18005,7 +18106,7 @@ function validatePlanV2MaterializedTarget(planDir, expectedTarget) {
|
|
|
18005
18106
|
return readValidatedPlanV2Materialization(planDir, expectedTarget)?.manifest ?? null;
|
|
18006
18107
|
}
|
|
18007
18108
|
function readValidatedPlanV2Materialization(planDir, expectedTarget) {
|
|
18008
|
-
const markerPath =
|
|
18109
|
+
const markerPath = join38(planDir, PLAN_V2_MATERIALIZATION_MARKER);
|
|
18009
18110
|
if (!existsSync24(markerPath)) return null;
|
|
18010
18111
|
const marker = readJsonFile(markerPath, "materialization marker");
|
|
18011
18112
|
if (!isRecord3(marker) || !isRecord3(marker.manifest) || !isRecord3(marker.target)) {
|
|
@@ -18023,7 +18124,7 @@ function readValidatedPlanV2Materialization(planDir, expectedTarget) {
|
|
|
18023
18124
|
assertRemoteSources(remoteSources, required);
|
|
18024
18125
|
for (const artifact of required) {
|
|
18025
18126
|
if (Object.hasOwn(remoteSources, artifact.path)) continue;
|
|
18026
|
-
const path =
|
|
18127
|
+
const path = join38(planDir, ...artifact.path.split("/"));
|
|
18027
18128
|
if (!existsSync24(path) || statSync8(path).size !== artifact.sizeBytes) {
|
|
18028
18129
|
throw new PlanV2IntegrityError(
|
|
18029
18130
|
`materialized artifact missing or truncated: ${artifact.path}`
|
|
@@ -18143,7 +18244,7 @@ function hashChunkOutput(outputPath, kind) {
|
|
|
18143
18244
|
if (kind === "file") return sha256Hex(readFileSync10(outputPath));
|
|
18144
18245
|
const entries = readdirSync10(outputPath).filter((name) => /\.(png|jpg|jpeg)$/i.test(name)).sort();
|
|
18145
18246
|
const lines = entries.map(
|
|
18146
|
-
(name) => `${name}\0${sha256Hex(readFileSync10(
|
|
18247
|
+
(name) => `${name}\0${sha256Hex(readFileSync10(join39(outputPath, name)))}`
|
|
18147
18248
|
);
|
|
18148
18249
|
return sha256Hex(lines.join("\0"));
|
|
18149
18250
|
}
|
|
@@ -18160,9 +18261,9 @@ function resolveLockedVp9CpuUsed(lockedEncoder) {
|
|
|
18160
18261
|
async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
18161
18262
|
const start = Date.now();
|
|
18162
18263
|
const log = defaultLogger;
|
|
18163
|
-
const planJsonPath =
|
|
18164
|
-
const encoderJsonPath =
|
|
18165
|
-
const chunksJsonPath =
|
|
18264
|
+
const planJsonPath = join39(planDir, "plan.json");
|
|
18265
|
+
const encoderJsonPath = join39(planDir, "meta", "encoder.json");
|
|
18266
|
+
const chunksJsonPath = join39(planDir, "meta", "chunks.json");
|
|
18166
18267
|
if (!existsSync25(planJsonPath)) {
|
|
18167
18268
|
throw new RenderChunkValidationError(
|
|
18168
18269
|
MISSING_PLAN_ARTIFACT,
|
|
@@ -18188,7 +18289,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
18188
18289
|
}
|
|
18189
18290
|
const encoder = JSON.parse(readFileSync10(encoderJsonPath, "utf-8"));
|
|
18190
18291
|
const chunks = JSON.parse(readFileSync10(chunksJsonPath, "utf-8"));
|
|
18191
|
-
const videosJsonPath =
|
|
18292
|
+
const videosJsonPath = join39(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
|
|
18192
18293
|
let planVideos = null;
|
|
18193
18294
|
if (existsSync25(videosJsonPath)) {
|
|
18194
18295
|
try {
|
|
@@ -18220,7 +18321,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
18220
18321
|
}
|
|
18221
18322
|
const range = resolveChunkFrameRange(slice, chunkIndex, options?.frameRange);
|
|
18222
18323
|
const framesInChunk = range.endFrame - range.startFrame;
|
|
18223
|
-
const compiledDir =
|
|
18324
|
+
const compiledDir = join39(planDir, "compiled");
|
|
18224
18325
|
if (!existsSync25(compiledDir)) {
|
|
18225
18326
|
throw new RenderChunkValidationError(
|
|
18226
18327
|
MISSING_PLAN_ARTIFACT,
|
|
@@ -18278,7 +18379,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
18278
18379
|
};
|
|
18279
18380
|
const workDir = `${outputChunkPath}.work.${process.pid}.${randomBytes(4).toString("hex")}`;
|
|
18280
18381
|
mkdirSync15(workDir, { recursive: true });
|
|
18281
|
-
const framesDir =
|
|
18382
|
+
const framesDir = join39(workDir, "captured-frames");
|
|
18282
18383
|
mkdirSync15(framesDir, { recursive: true });
|
|
18283
18384
|
const videoFramesDir = `${workDir}.video-frames`;
|
|
18284
18385
|
const chunkFrameNumbers = Array.from({ length: framesInChunk }, (_, i) => range.startFrame + i);
|
|
@@ -18303,7 +18404,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
18303
18404
|
dimensions: plan2.dimensions,
|
|
18304
18405
|
encoder,
|
|
18305
18406
|
videoCount: planVideos?.videos.length ?? 0,
|
|
18306
|
-
html: readFileSync10(
|
|
18407
|
+
html: readFileSync10(join39(compiledDir, "index.html"), "utf-8"),
|
|
18307
18408
|
// The plan ships a deferred source only to chunks that show it; don't wait on the rest.
|
|
18308
18409
|
skipReadinessVideoIds: deferredVideos.filter(
|
|
18309
18410
|
(video) => !shownFrames.get(video.videoId)?.size || remoteVideoIds.has(video.videoId)
|
|
@@ -18473,7 +18574,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
18473
18574
|
if (isPngSequence) {
|
|
18474
18575
|
if (!existsSync25(outputChunkPath)) mkdirSync15(outputChunkPath, { recursive: true });
|
|
18475
18576
|
} else {
|
|
18476
|
-
const outDir =
|
|
18577
|
+
const outDir = join39(outputChunkPath, "..");
|
|
18477
18578
|
if (!existsSync25(outDir)) mkdirSync15(outDir, { recursive: true });
|
|
18478
18579
|
}
|
|
18479
18580
|
const encodeInput = {
|
|
@@ -18747,10 +18848,10 @@ async function renderSpan(projectDir, config, span, outputPath) {
|
|
|
18747
18848
|
if (config.cfr === true) {
|
|
18748
18849
|
throw new RenderSpanUnsupportedError("--start/--end cannot be combined with a cfr re-encode.");
|
|
18749
18850
|
}
|
|
18750
|
-
const workDir = mkdtempSync7(
|
|
18851
|
+
const workDir = mkdtempSync7(join40(tmpdir4(), "hf-render-span-"));
|
|
18751
18852
|
try {
|
|
18752
|
-
const planDir =
|
|
18753
|
-
const partsDir =
|
|
18853
|
+
const planDir = join40(workDir, "plan");
|
|
18854
|
+
const partsDir = join40(workDir, "parts");
|
|
18754
18855
|
mkdirSync16(partsDir, { recursive: true });
|
|
18755
18856
|
const planned = await plan(
|
|
18756
18857
|
projectDir,
|
|
@@ -18765,7 +18866,7 @@ async function renderSpan(projectDir, config, span, outputPath) {
|
|
|
18765
18866
|
planned.totalFrames
|
|
18766
18867
|
);
|
|
18767
18868
|
const slices = JSON.parse(
|
|
18768
|
-
readFileSync11(
|
|
18869
|
+
readFileSync11(join40(planDir, "meta", "chunks.json"), "utf-8")
|
|
18769
18870
|
);
|
|
18770
18871
|
const parts = [];
|
|
18771
18872
|
for (const slice of slices) {
|
|
@@ -18775,13 +18876,18 @@ async function renderSpan(projectDir, config, span, outputPath) {
|
|
|
18775
18876
|
};
|
|
18776
18877
|
if (range.endFrame <= range.startFrame) continue;
|
|
18777
18878
|
throwIfAborted(config.abortSignal);
|
|
18778
|
-
const part =
|
|
18879
|
+
const part = join40(partsDir, `part-${String(parts.length).padStart(4, "0")}.mp4`);
|
|
18779
18880
|
await renderChunk(planDir, slice.index, part, { frameRange: range });
|
|
18780
18881
|
parts.push(part);
|
|
18781
18882
|
}
|
|
18782
18883
|
throwIfAborted(config.abortSignal);
|
|
18783
18884
|
await writeStitchedMp4(parts, outputPath);
|
|
18784
|
-
return {
|
|
18885
|
+
return {
|
|
18886
|
+
...referenceBackgroundResult(planned[REFERENCE_BACKGROUND_FIELD]),
|
|
18887
|
+
startFrame,
|
|
18888
|
+
endFrame,
|
|
18889
|
+
framesEncoded: endFrame - startFrame
|
|
18890
|
+
};
|
|
18785
18891
|
} finally {
|
|
18786
18892
|
rmSync14(workDir, { recursive: true, force: true });
|
|
18787
18893
|
}
|
|
@@ -19336,7 +19442,7 @@ import {
|
|
|
19336
19442
|
rmSync as rmSync15,
|
|
19337
19443
|
createReadStream as createReadStream5
|
|
19338
19444
|
} from "fs";
|
|
19339
|
-
import { resolve as resolve10, dirname as dirname16, join as
|
|
19445
|
+
import { resolve as resolve10, dirname as dirname16, join as join43 } from "path";
|
|
19340
19446
|
import { tmpdir as tmpdir5 } from "os";
|
|
19341
19447
|
import { parseArgs } from "util";
|
|
19342
19448
|
import crypto from "crypto";
|
|
@@ -19354,7 +19460,7 @@ import {
|
|
|
19354
19460
|
closeSync as closeSync6,
|
|
19355
19461
|
constants as constants3
|
|
19356
19462
|
} from "fs";
|
|
19357
|
-
import { resolve as resolve9, join as
|
|
19463
|
+
import { resolve as resolve9, join as join41, relative as relative7, isAbsolute as isAbsolute4, sep as sep4 } from "path";
|
|
19358
19464
|
function isStringRecord(value) {
|
|
19359
19465
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
19360
19466
|
return false;
|
|
@@ -19421,7 +19527,7 @@ function readProjectEntryFile(projectDir, preferredEntryFile) {
|
|
|
19421
19527
|
}
|
|
19422
19528
|
}
|
|
19423
19529
|
return {
|
|
19424
|
-
error: `No HTML entry file found in project directory: ${
|
|
19530
|
+
error: `No HTML entry file found in project directory: ${join41(absProjectDir, preferredEntryFile || "index.html")}`
|
|
19425
19531
|
};
|
|
19426
19532
|
}
|
|
19427
19533
|
function prepareHyperframeLintBody(body) {
|
|
@@ -19467,7 +19573,7 @@ async function runHyperframeLint(prepared) {
|
|
|
19467
19573
|
// ../producer/src/services/healthWorker.ts
|
|
19468
19574
|
import { Worker as Worker2 } from "worker_threads";
|
|
19469
19575
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
19470
|
-
import { dirname as dirname15, join as
|
|
19576
|
+
import { dirname as dirname15, join as join42 } from "path";
|
|
19471
19577
|
import { existsSync as existsSync27 } from "fs";
|
|
19472
19578
|
var DEFAULT_HEALTH_PORT = 9848;
|
|
19473
19579
|
async function startHealthWorker(options = {}) {
|
|
@@ -19543,7 +19649,7 @@ function defaultLogger2() {
|
|
|
19543
19649
|
}
|
|
19544
19650
|
function resolveWorkerEntry2() {
|
|
19545
19651
|
const here = dirname15(fileURLToPath6(import.meta.url));
|
|
19546
|
-
const candidates = [
|
|
19652
|
+
const candidates = [join42(here, "healthWorkerThread.js"), join42(here, "healthWorkerThread.ts")];
|
|
19547
19653
|
for (const candidate of candidates) {
|
|
19548
19654
|
if (existsSync27(candidate)) return candidate;
|
|
19549
19655
|
}
|
|
@@ -19748,8 +19854,8 @@ async function resolveInlineRenderHtml(body) {
|
|
|
19748
19854
|
}
|
|
19749
19855
|
function materializeInlineProject(html, options) {
|
|
19750
19856
|
const tempRoot = process.env.PRODUCER_TMP_PROJECT_DIR || tmpdir5();
|
|
19751
|
-
const tempProjectDir = mkdtempSync8(
|
|
19752
|
-
writeFileSync12(
|
|
19857
|
+
const tempProjectDir = mkdtempSync8(join43(tempRoot, "producer-project-"));
|
|
19858
|
+
writeFileSync12(join43(tempProjectDir, "index.html"), html, "utf-8");
|
|
19753
19859
|
return {
|
|
19754
19860
|
prepared: {
|
|
19755
19861
|
input: { projectDir: tempProjectDir, ...options },
|
|
@@ -20006,6 +20112,7 @@ function createRenderHandlers(options = {}) {
|
|
|
20006
20112
|
outputUrl,
|
|
20007
20113
|
fileSize,
|
|
20008
20114
|
durationMs,
|
|
20115
|
+
...referenceBackgroundResult(job[REFERENCE_BACKGROUND_FIELD]),
|
|
20009
20116
|
videoDurationSeconds: job.duration ?? null,
|
|
20010
20117
|
outcome: job.outcome ?? "completed",
|
|
20011
20118
|
warnings: job.warnings,
|
|
@@ -20093,6 +20200,7 @@ function createRenderHandlers(options = {}) {
|
|
|
20093
20200
|
outputToken,
|
|
20094
20201
|
outputUrl,
|
|
20095
20202
|
fileSize,
|
|
20203
|
+
...referenceBackgroundResult(job[REFERENCE_BACKGROUND_FIELD]),
|
|
20096
20204
|
videoDurationSeconds: job.duration ?? null,
|
|
20097
20205
|
outcome: job.outcome ?? "completed",
|
|
20098
20206
|
warnings: job.warnings,
|
|
@@ -20168,7 +20276,7 @@ function startServer(options = {}) {
|
|
|
20168
20276
|
});
|
|
20169
20277
|
async function shutdown(signal) {
|
|
20170
20278
|
log.info(`Received ${signal}, shutting down`);
|
|
20171
|
-
const { drainBrowserPool } = await import("./src-
|
|
20279
|
+
const { drainBrowserPool } = await import("./src-7WW3KXOI.js");
|
|
20172
20280
|
await drainBrowserPool().catch(() => {
|
|
20173
20281
|
});
|
|
20174
20282
|
const handle = await Promise.race([
|
|
@@ -20206,7 +20314,7 @@ if (isPublicServerEntry) {
|
|
|
20206
20314
|
// ../producer/src/services/distributed/planV2Execution.ts
|
|
20207
20315
|
import { mkdtempSync as mkdtempSync10, rmSync as rmSync17 } from "fs";
|
|
20208
20316
|
import { tmpdir as tmpdir6 } from "os";
|
|
20209
|
-
import { join as
|
|
20317
|
+
import { join as join45 } from "path";
|
|
20210
20318
|
|
|
20211
20319
|
// ../producer/src/services/distributed/assemble.ts
|
|
20212
20320
|
import {
|
|
@@ -20220,7 +20328,7 @@ import {
|
|
|
20220
20328
|
statSync as statSync11,
|
|
20221
20329
|
writeFileSync as writeFileSync13
|
|
20222
20330
|
} from "fs";
|
|
20223
|
-
import { dirname as dirname17, join as
|
|
20331
|
+
import { dirname as dirname17, join as join44 } from "path";
|
|
20224
20332
|
function cfrRateControlArgs(locked) {
|
|
20225
20333
|
const preset = getEncoderPreset(locked.quality ?? "standard", "mp4");
|
|
20226
20334
|
if (locked.crf == null && locked.bitrate) {
|
|
@@ -20235,12 +20343,16 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
20235
20343
|
const plan2 = readAssemblePlan(planDir, chunkOutputs);
|
|
20236
20344
|
const chunkPaths = chunkOutputs.flat();
|
|
20237
20345
|
if (plan2.dimensions.format === "png-sequence") {
|
|
20238
|
-
return
|
|
20346
|
+
return {
|
|
20347
|
+
...mergePngFrameDirs(chunkPaths, outputPath, plan2.totalFrames, audioPath, start),
|
|
20348
|
+
...referenceBackgroundResult(plan2[REFERENCE_BACKGROUND_FIELD])
|
|
20349
|
+
};
|
|
20239
20350
|
}
|
|
20240
20351
|
if (chunksAreStitchedMp4(planDir, cfr)) {
|
|
20241
20352
|
const separateAudio = stitchesSeparateAudio(planDir) && audioPath !== null;
|
|
20242
20353
|
await writeStitchedMp4(chunkPaths, outputPath, separateAudio ? audioPath : void 0);
|
|
20243
20354
|
return {
|
|
20355
|
+
...referenceBackgroundResult(plan2[REFERENCE_BACKGROUND_FIELD]),
|
|
20244
20356
|
outputPath,
|
|
20245
20357
|
durationMs: Date.now() - start,
|
|
20246
20358
|
framesEncoded: plan2.totalFrames,
|
|
@@ -20272,7 +20384,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
20272
20384
|
};
|
|
20273
20385
|
try {
|
|
20274
20386
|
const videoSources = cfrEncoder ? [await reencodeCfr(ctx, chunkPaths, cfrEncoder)] : chunkPaths;
|
|
20275
|
-
const finalPath =
|
|
20387
|
+
const finalPath = join44(workDir, `output.${format}`);
|
|
20276
20388
|
const audio = audioPath !== null && existsSync29(audioPath) ? audioPath : null;
|
|
20277
20389
|
await writeJoined(ctx, videoSources, audio, finalPath);
|
|
20278
20390
|
renameWithRetry(finalPath, outputPath);
|
|
@@ -20293,6 +20405,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
20293
20405
|
}
|
|
20294
20406
|
const fileSize = existsSync29(outputPath) ? statSync11(outputPath).size : 0;
|
|
20295
20407
|
return {
|
|
20408
|
+
...referenceBackgroundResult(plan2[REFERENCE_BACKGROUND_FIELD]),
|
|
20296
20409
|
outputPath,
|
|
20297
20410
|
durationMs: Date.now() - start,
|
|
20298
20411
|
framesEncoded: plan2.totalFrames,
|
|
@@ -20300,8 +20413,8 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
20300
20413
|
};
|
|
20301
20414
|
}
|
|
20302
20415
|
function readAssemblePlan(planDir, chunkPaths) {
|
|
20303
|
-
const planJsonPath =
|
|
20304
|
-
const chunksJsonPath =
|
|
20416
|
+
const planJsonPath = join44(planDir, "plan.json");
|
|
20417
|
+
const chunksJsonPath = join44(planDir, "meta", "chunks.json");
|
|
20305
20418
|
if (!existsSync29(planJsonPath)) {
|
|
20306
20419
|
throw new Error(`[assemble] planDir missing plan.json: ${planJsonPath}`);
|
|
20307
20420
|
}
|
|
@@ -20352,7 +20465,7 @@ function cfrEncodeArgs(inputArgs, encoder, fpsArg) {
|
|
|
20352
20465
|
return args;
|
|
20353
20466
|
}
|
|
20354
20467
|
async function reencodeCfr(ctx, chunkPaths, encoder) {
|
|
20355
|
-
const cfrOutputPath =
|
|
20468
|
+
const cfrOutputPath = join44(ctx.workDir, `cfr.${ctx.format}`);
|
|
20356
20469
|
const cfrArgs = cfrEncodeArgs(videoInputArgs(ctx, chunkPaths), encoder, ctx.fpsArg);
|
|
20357
20470
|
appendRenderProvenanceArgs(cfrArgs, cfrOutputPath);
|
|
20358
20471
|
cfrArgs.push("-y", cfrOutputPath);
|
|
@@ -20379,7 +20492,7 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
|
|
|
20379
20492
|
);
|
|
20380
20493
|
return;
|
|
20381
20494
|
}
|
|
20382
|
-
const paddedAudioPath =
|
|
20495
|
+
const paddedAudioPath = join44(ctx.workDir, "audio-padded.m4a");
|
|
20383
20496
|
const padTrimResult = await ctx.timed(
|
|
20384
20497
|
"audioMs",
|
|
20385
20498
|
() => padOrTrimAudioToVideoFrameCount({
|
|
@@ -20419,7 +20532,7 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
|
|
|
20419
20532
|
}
|
|
20420
20533
|
}
|
|
20421
20534
|
function concatDemuxerInput(chunkPaths, workDir, fpsArg) {
|
|
20422
|
-
const listPath =
|
|
20535
|
+
const listPath = join44(workDir, "concat-list.txt");
|
|
20423
20536
|
const body = chunkPaths.map((path) => `file '${path.replace(/'/g, "'\\''")}'`).join("\n");
|
|
20424
20537
|
writeFileSync13(listPath, `${body}
|
|
20425
20538
|
`, "utf-8");
|
|
@@ -20457,11 +20570,11 @@ function stitchesSeparateAudio(planDir) {
|
|
|
20457
20570
|
return lockedAudio(planDir).separateAudio === true;
|
|
20458
20571
|
}
|
|
20459
20572
|
function planFormat(planDir) {
|
|
20460
|
-
const plan2 = JSON.parse(readFileSync13(
|
|
20573
|
+
const plan2 = JSON.parse(readFileSync13(join44(planDir, "plan.json"), "utf-8"));
|
|
20461
20574
|
return plan2.dimensions.format;
|
|
20462
20575
|
}
|
|
20463
20576
|
function lockedAudio(planDir) {
|
|
20464
|
-
const encoderJsonPath =
|
|
20577
|
+
const encoderJsonPath = join44(planDir, "meta", "encoder.json");
|
|
20465
20578
|
if (!existsSync29(encoderJsonPath)) return {};
|
|
20466
20579
|
return JSON.parse(readFileSync13(encoderJsonPath, "utf-8"));
|
|
20467
20580
|
}
|
|
@@ -20471,7 +20584,7 @@ function readCfrEncoder(planDir, format) {
|
|
|
20471
20584
|
`[assemble] cfr=true is only supported for format="mp4" (got "${format}"). Stream-copy paths for webm and mov already produce exact avg_frame_rate; cfr re-encode is not needed.`
|
|
20472
20585
|
);
|
|
20473
20586
|
}
|
|
20474
|
-
const encoderJsonPath =
|
|
20587
|
+
const encoderJsonPath = join44(planDir, "meta", "encoder.json");
|
|
20475
20588
|
if (!existsSync29(encoderJsonPath)) {
|
|
20476
20589
|
throw new Error(`[assemble] planDir missing meta/encoder.json: ${encoderJsonPath}`);
|
|
20477
20590
|
}
|
|
@@ -20498,8 +20611,8 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
20498
20611
|
throw new Error(`[assemble] png-sequence chunk has no frames: ${chunkDir}`);
|
|
20499
20612
|
}
|
|
20500
20613
|
for (const frame of frames) {
|
|
20501
|
-
const dst =
|
|
20502
|
-
cpSync3(
|
|
20614
|
+
const dst = join44(outputPath, formatExportFrameName(globalIdx, "png"));
|
|
20615
|
+
cpSync3(join44(chunkDir, frame), dst);
|
|
20503
20616
|
globalIdx += 1;
|
|
20504
20617
|
}
|
|
20505
20618
|
}
|
|
@@ -20509,13 +20622,13 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
20509
20622
|
);
|
|
20510
20623
|
}
|
|
20511
20624
|
if (audioPath !== null && existsSync29(audioPath)) {
|
|
20512
|
-
const sidecar =
|
|
20625
|
+
const sidecar = join44(outputPath, MIXED_AUDIO_FILENAME);
|
|
20513
20626
|
cpSync3(audioPath, sidecar);
|
|
20514
20627
|
}
|
|
20515
20628
|
let fileSize = 0;
|
|
20516
20629
|
for (const name of readdirSync11(outputPath)) {
|
|
20517
20630
|
try {
|
|
20518
|
-
fileSize += statSync11(
|
|
20631
|
+
fileSize += statSync11(join44(outputPath, name)).size;
|
|
20519
20632
|
} catch {
|
|
20520
20633
|
}
|
|
20521
20634
|
}
|
|
@@ -20529,8 +20642,8 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
20529
20642
|
|
|
20530
20643
|
// ../producer/src/services/distributed/planV2Execution.ts
|
|
20531
20644
|
async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath, options) {
|
|
20532
|
-
const workRoot = mkdtempSync10(
|
|
20533
|
-
const materializedPlanDir =
|
|
20645
|
+
const workRoot = mkdtempSync10(join45(tmpdir6(), "hf-plan-v2-chunk-"));
|
|
20646
|
+
const materializedPlanDir = join45(workRoot, "plan");
|
|
20534
20647
|
try {
|
|
20535
20648
|
materializePlanV2Target(planV2Dir, { role: "chunk", chunkIndex }, materializedPlanDir);
|
|
20536
20649
|
return await renderChunk(materializedPlanDir, chunkIndex, outputChunkPath, options);
|
|
@@ -20539,8 +20652,8 @@ async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath, options) {
|
|
|
20539
20652
|
}
|
|
20540
20653
|
}
|
|
20541
20654
|
async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
|
|
20542
|
-
const workRoot = mkdtempSync10(
|
|
20543
|
-
const materializedPlanDir =
|
|
20655
|
+
const workRoot = mkdtempSync10(join45(tmpdir6(), "hf-plan-v2-assembler-"));
|
|
20656
|
+
const materializedPlanDir = join45(workRoot, "plan");
|
|
20544
20657
|
try {
|
|
20545
20658
|
const materialized = materializePlanV2Target(
|
|
20546
20659
|
planV2Dir,
|
|
@@ -20562,7 +20675,7 @@ async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
|
|
|
20562
20675
|
// ../producer/src/services/distributed/projectHash.ts
|
|
20563
20676
|
import { closeSync as closeSync7, openSync as openSync7, readdirSync as readdirSync12, readSync as readSync5, realpathSync as realpathSync2, statSync as statSync12 } from "fs";
|
|
20564
20677
|
import { createHash as createHash8 } from "crypto";
|
|
20565
|
-
import { join as
|
|
20678
|
+
import { join as join46 } from "path";
|
|
20566
20679
|
var READ_CHUNK_BYTES = 256 * 1024;
|
|
20567
20680
|
|
|
20568
20681
|
// ../producer/src/services/distributed/audioSidecar.ts
|