hyperframes 0.8.198 → 0.8.200
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-KEYBYC4P.js → add-MFJDOJHQ.js} +14 -14
- package/dist/{animatedGifPrep-Z5BJNWKN.js → animatedGifPrep-WBZ2VVP6.js} +7 -7
- package/dist/api.js +15 -15
- package/dist/{asset-I4SWXLQ6.js → asset-PTAQLOR6.js} +2 -2
- package/dist/{assetCataloger-FBZ36VTV.js → assetCataloger-N3UGZ2RC.js} +7 -7
- package/dist/{audio-I4Z5PT7P.js → audio-CPHWRLC4.js} +15 -15
- package/dist/{auth-CKN546QV.js → auth-ZWOJIYK7.js} +2 -2
- package/dist/{autoUpdate-AKOIVDJZ.js → autoUpdate-DO74673A.js} +3 -3
- package/dist/{backgroundChecks-5BJIAXAC.js → backgroundChecks-HOAN7YB6.js} +4 -4
- package/dist/backgroundChecksWorker.js +4 -4
- package/dist/{batchRender-QY2RN3J2.js → batchRender-AZFHTPSV.js} +3 -3
- package/dist/{beats-UEGEBTZ6.js → beats-JRMM6JQQ.js} +11 -11
- package/dist/{benchmark-BNGEOBEM.js → benchmark-2PEQUV7H.js} +11 -11
- package/dist/{browser-DL2STX2A.js → browser-2D6IHFO6.js} +7 -7
- package/dist/{bundleWithLocalizedFonts-ULZJ7GHE.js → bundleWithLocalizedFonts-ERB43NFP.js} +2 -2
- package/dist/{capture-DHYANXXU.js → capture-3ODEX55X.js} +2 -2
- package/dist/{capture-UNI6ZOPZ.js → capture-WNC2DWF7.js} +11 -11
- package/dist/{captureCompositionFrame-PS5KDJXF.js → captureCompositionFrame-JXXTHR7J.js} +12 -12
- package/dist/{catalog-UF3CDKXY.js → catalog-MHTRTKSY.js} +14 -14
- package/dist/{catch-up-DIESQDJZ.js → catch-up-XNDRKMKL.js} +7 -7
- package/dist/{check-WZ6L42CH.js → check-7IB355TM.js} +36 -36
- package/dist/{checkBrowser-7J6VC7D6.js → checkBrowser-E3ZCTAGY.js} +31 -31
- package/dist/{chunk-PKQ3GBDU.js → chunk-2LKHE32Z.js} +6 -6
- package/dist/{chunk-MFDZK3X5.js → chunk-32V3VHMK.js} +66 -10
- package/dist/{chunk-C6WBKEOI.js → chunk-3XXSRN36.js} +2 -2
- package/dist/{chunk-WA6HZFDD.js → chunk-3YGSZSEN.js} +2 -2
- package/dist/{chunk-AFQ777YP.js → chunk-4UPGPCMB.js} +1 -1
- package/dist/{chunk-HVF7K2T3.js → chunk-4VZAIVZQ.js} +1 -1
- package/dist/{chunk-ESJYD4AE.js → chunk-57Y5X4VU.js} +5 -5
- package/dist/{chunk-2CGWIIPE.js → chunk-5ULL3P6S.js} +2 -2
- package/dist/{chunk-6WZ6HNK2.js → chunk-63JJFXAD.js} +10 -8
- package/dist/{chunk-4V2OO56A.js → chunk-63S4VUOL.js} +2 -2
- package/dist/{chunk-256C5DYC.js → chunk-733CEBPF.js} +5 -5
- package/dist/{chunk-F2ZAINSR.js → chunk-7D7V3UDI.js} +1 -1
- package/dist/{chunk-GHO33VCP.js → chunk-7LRVGYKZ.js} +2 -2
- package/dist/{chunk-O3KFO66O.js → chunk-7NWSVRFE.js} +1 -1
- package/dist/{chunk-WY67Q2QY.js → chunk-7WV27W7R.js} +5 -3
- package/dist/{chunk-GJA6QSSQ.js → chunk-ACH5ZR7X.js} +3 -3
- package/dist/{chunk-6BTMNV3R.js → chunk-BERGVZKN.js} +1 -1
- package/dist/{chunk-DZWTK3HJ.js → chunk-BIZPUWBG.js} +1 -1
- package/dist/{chunk-T6AGUTZJ.js → chunk-BQA3X7TI.js} +3 -32
- package/dist/{chunk-U66P7HPN.js → chunk-D35MPIGJ.js} +14 -14
- package/dist/{chunk-Y2I7KT2R.js → chunk-DRTUJVLE.js} +107 -44
- package/dist/{chunk-YP5XWK7M.js → chunk-FTD5QXGF.js} +1 -1
- package/dist/{chunk-FXDYR644.js → chunk-FTUKOLLB.js} +1 -1
- package/dist/{chunk-4WDOTQDY.js → chunk-FZ3R5XOH.js} +1 -1
- package/dist/{chunk-YEVU5W5G.js → chunk-G7RKSAKS.js} +29 -4
- package/dist/{chunk-7W7F3KBH.js → chunk-GR2G5L2O.js} +2 -2
- package/dist/{chunk-7FT7E7OU.js → chunk-GYSPF5ZT.js} +17 -17
- package/dist/{chunk-BPU22WKT.js → chunk-H2X4TQVK.js} +7 -7
- package/dist/{chunk-FCY375PD.js → chunk-HBRPELT6.js} +3 -3
- package/dist/{chunk-6NSH5EAO.js → chunk-HN6TP4D2.js} +1 -1
- package/dist/{chunk-7OFK6XMH.js → chunk-HXHSGDU6.js} +7 -7
- package/dist/{chunk-O2CO6QNK.js → chunk-I4VEFPZE.js} +1 -1
- package/dist/{chunk-DFL4XSQZ.js → chunk-I6A2B3IJ.js} +3 -3
- package/dist/{chunk-YUODO5H2.js → chunk-IC6BO4GU.js} +25 -2
- package/dist/{chunk-2FT5WJPY.js → chunk-ISN6BAZX.js} +1 -1
- package/dist/{chunk-JSLQZKXA.js → chunk-IW4LKYDY.js} +2 -2
- package/dist/{chunk-56ZYGITX.js → chunk-JBQNDHRT.js} +1 -1
- package/dist/{chunk-O2SA7HOG.js → chunk-KPUTRG54.js} +2 -2
- package/dist/{chunk-JBTNMFFR.js → chunk-KVFSXCN6.js} +1 -1
- package/dist/{chunk-EUZB3ZV3.js → chunk-ML4IULLQ.js} +10 -10
- package/dist/{chunk-ORNE2BC4.js → chunk-NC3TVM27.js} +5 -5
- package/dist/{chunk-4UAUXH77.js → chunk-OE7AUN6G.js} +759 -454
- package/dist/{chunk-N4NKPFKQ.js → chunk-OMXXJSCK.js} +54 -16
- package/dist/{chunk-NDBOBZRL.js → chunk-OYVVDYM6.js} +10 -10
- package/dist/{chunk-P3ZZD4SK.js → chunk-PFFR4NQV.js} +3 -3
- package/dist/{chunk-6NLPPKBO.js → chunk-PSX5SF2N.js} +36 -0
- package/dist/chunk-PW22CDII.js +3901 -0
- package/dist/{chunk-XIYNIHGQ.js → chunk-Q5IJYX7X.js} +2 -2
- package/dist/{chunk-GQVTTWZF.js → chunk-QDK7XCOB.js} +1 -1
- package/dist/{chunk-5I74DQPC.js → chunk-QP4UWICL.js} +3 -3
- package/dist/{chunk-UMCU32QC.js → chunk-QYQY5ACN.js} +1 -1
- package/dist/{chunk-F2K72QNO.js → chunk-RFQ6BIRL.js} +1 -1
- package/dist/{chunk-OU6YITCR.js → chunk-TDF2O2RM.js} +2 -2
- package/dist/{chunk-ISZK5IJM.js → chunk-TOC6E65N.js} +1 -1
- package/dist/{chunk-MMJ3L4XQ.js → chunk-TTFHBTXQ.js} +1 -1
- package/dist/{chunk-UBOBOWWB.js → chunk-TUVNQA5B.js} +3 -3
- package/dist/{chunk-W2LGJSEN.js → chunk-UIOZIIB7.js} +33 -3
- package/dist/{chunk-ZSO7UVC5.js → chunk-UUFY6A7I.js} +354 -82
- package/dist/{chunk-JTTWK6IM.js → chunk-VFLBOKDI.js} +3 -3
- package/dist/{chunk-TXJKDBUB.js → chunk-WAG4AX5C.js} +1 -1
- package/dist/{chunk-HBPFY3KU.js → chunk-XV7ZNBVY.js} +3 -3
- package/dist/{chunk-UUG3DETI.js → chunk-ZFBET3PD.js} +1 -1
- package/dist/{clean-2W5OGTMI.js → clean-BOYUTBAU.js} +18 -18
- package/dist/cli.js +54 -54
- package/dist/{cloud-AJK5OLJM.js → cloud-3O2MEZO4.js} +4 -4
- package/dist/{cloudrun-HAAYNZWP.js → cloudrun-MCTN22O6.js} +4 -4
- package/dist/{compare-KRY3JTXM.js → compare-A57RHCPB.js} +28 -28
- package/dist/{compiler-47QXFQF4.js → compiler-LVNWLZCX.js} +3 -3
- package/dist/{component-XQR75LCM.js → component-MIJC3LWO.js} +3 -3
- package/dist/{compositions-QJZQZJFB.js → compositions-OUNZAEC3.js} +13 -13
- package/dist/{delete-PPOMPFZG.js → delete-X6Q3S3SL.js} +3 -3
- package/dist/{deploy-IKVAHO42.js → deploy-XXMIXGUF.js} +1 -1
- package/dist/{dist-JBRYL3MH.js → dist-2UO4RVFN.js} +4 -2
- package/dist/{dist-XPD7X6JB.js → dist-ONHJ6ZDA.js} +1 -1
- package/dist/{doctor-TM2B4PLJ.js → doctor-ASSDEPCO.js} +14 -14
- package/dist/{events-UFQAFJ7A.js → events-4ULC5VUK.js} +5 -5
- package/dist/{events-QERYXJVB.js → events-DVWSV3TQ.js} +6 -6
- package/dist/{feedback-X6GA5Z2Y.js → feedback-OB3NJPNF.js} +9 -9
- package/dist/{ffmpeg-G6RMIP5K.js → ffmpeg-JH3JXES2.js} +7 -7
- package/dist/{figma-WAM4RJUC.js → figma-GV4OGXC2.js} +3 -3
- package/dist/fontLocalizeCli.js +9 -9
- package/dist/{get-7TO44JK3.js → get-FLMCUJGR.js} +3 -3
- package/dist/{gpuPolicy-IMLRNUEJ.js → gpuPolicy-RZ2OUY4M.js} +7 -7
- package/dist/{grade-compare-TCUAQKW4.js → grade-compare-O62JAOA7.js} +29 -29
- package/dist/{help-GSPNIWE2.js → help-6POZ4GNV.js} +1 -1
- package/dist/{history-SFC4KDFT.js → history-72ZIF5WR.js} +9 -9
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +65 -62
- package/dist/hyperframes-player.global.js +3 -3
- package/dist/{info-YBSWR4VE.js → info-GGIFZ5CT.js} +10 -10
- package/dist/{init-RJCZWSTH.js → init-QYRN6HG2.js} +29 -29
- package/dist/{inspect-R6C5Q7WI.js → inspect-KSL4YVIU.js} +29 -29
- package/dist/{installer-BJQSDYHE.js → installer-ENQCLSJQ.js} +4 -4
- package/dist/{keyframes-UJOV3QTF.js → keyframes-6PNLGKOO.js} +9 -9
- package/dist/{lambda-645URVF4.js → lambda-3RFOOJV6.js} +6 -6
- package/dist/{layout-MPGHNIY6.js → layout-3XFC6N3L.js} +29 -29
- package/dist/{lint-BWYP7H5P.js → lint-5XGLCTV5.js} +10 -10
- package/dist/{lintProject-Q4ZVEF3G.js → lintProject-FKPKSU6M.js} +1 -1
- package/dist/{list-YBOALPIY.js → list-B76BTLOM.js} +3 -3
- package/dist/{login-Z3JYXJKB.js → login-MNXS7GEL.js} +4 -4
- package/dist/{manager-COSJVRAE.js → manager-BWU4U7DV.js} +3 -3
- package/dist/{manager-CCRWUMQO.js → manager-QZZVJV7Z.js} +8 -8
- package/dist/{media-treatment-4P54XYM7.js → media-treatment-J3OWRCBF.js} +15 -15
- package/dist/{models-3LIZKQPH.js → models-MCDUTV54.js} +11 -11
- package/dist/{motionShot-22NRFNLM.js → motionShot-RWEH3VWI.js} +16 -16
- package/dist/{normalize-audio-C6JTJBZE.js → normalize-audio-N7VRZODX.js} +7 -7
- package/dist/{open-5KOE2UWD.js → open-ROUFAVKD.js} +14 -14
- package/dist/{parakeetRunner-67JLWWPE.js → parakeetRunner-PTVV5M44.js} +12 -12
- package/dist/{pipeline-QZQRLXSV.js → pipeline-HN5KMORF.js} +8 -8
- package/dist/{play-ID4KS6LH.js → play-AO7AF4Y4.js} +20 -20
- package/dist/{preflight-DVW7XWEO.js → preflight-ARNDDFGX.js} +10 -10
- package/dist/{present-CDJCTLFJ.js → present-FBPKUC5R.js} +16 -16
- package/dist/{preview-KDMHWG3L.js → preview-35X5G426.js} +20 -20
- package/dist/{producer-QPUWC6S3.js → producer-FVGPLR5E.js} +1 -1
- package/dist/{projectConfig-VMVZXMC6.js → projectConfig-SRUJLOHL.js} +6 -6
- package/dist/{publication-VBXDWVC7.js → publication-XH2BRL3V.js} +2 -2
- package/dist/{publish-XDNOVFIZ.js → publish-RI4ZQZNT.js} +8 -8
- package/dist/{remove-background-OQUEVC4I.js → remove-background-J22P5JFW.js} +9 -9
- package/dist/{render-L5DUPSDJ.js → render-2EZQT4IS.js} +16 -16
- package/dist/{render-MMEZAOL7.js → render-IJUKJILU.js} +123 -42
- package/dist/{render-2MVVITHT.js → render-UXYZN6D2.js} +5 -5
- package/dist/{render-batch-EZRFUUHG.js → render-batch-X34UZ442.js} +5 -5
- package/dist/renderSetupWorker.js +4 -4
- package/dist/{resolver-E6OFNCLG.js → resolver-UUEIRLMY.js} +4 -4
- package/dist/{sherpa-MQUVKCRX.js → sherpa-FI4VNAFT.js} +11 -11
- package/dist/skills/media-use/references/mixing.md +1 -0
- package/dist/{skills-Y7AATMSQ.js → skills-LGKXQFW7.js} +8 -8
- package/dist/{skillsUpdateCheck-K7DSQJGU.js → skillsUpdateCheck-NDPKSX3H.js} +4 -4
- package/dist/{snapshot-DZWLAQAW.js → snapshot-JM6427YW.js} +33 -33
- package/dist/{src-RRTSNZLM.js → src-26NBARTO.js} +8 -8
- package/dist/{src-7FSQZKIY.js → src-WEECPY6E.js} +6 -6
- package/dist/{staticProjectServer-J2IXFINI.js → staticProjectServer-I5WGMJOV.js} +14 -14
- package/dist/{status-H5WLKQDS.js → status-SCCC7A6N.js} +2 -2
- package/dist/studio/assets/{hyperframes-player-DDoxfTBd.js → hyperframes-player-LmRUJE8q.js} +1 -1
- package/dist/studio/assets/{index-BAKWbo0z.js → index-BmTWk8xf.js} +108 -108
- package/dist/studio/assets/{index-D9WoRF2S.js → index-CKNiEwbW.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-7BNDWZG5.js → studio-api-N774Q4NO.js} +7 -7
- package/dist/{studioServer-FBRUE3XK.js → studioServer-KZIM5UBJ.js} +49 -49
- package/dist/{system-7F3UEHQT.js → system-HV7PYIXE.js} +4 -3
- package/dist/{telemetry-4K6CPMNT.js → telemetry-IHU4HL3R.js} +1 -1
- package/dist/{telemetry-OOQVUJGL.js → telemetry-JIETM7WP.js} +6 -6
- package/dist/{timeline-U6MIU6JP.js → timeline-JJ6JG7GQ.js} +18 -18
- package/dist/{tokens-3ZPX6WKB.js → tokens-VOIMSCGX.js} +2 -2
- package/dist/{transcribe-QDBXRADM.js → transcribe-2V23EQHD.js} +18 -18
- package/dist/{transcribe-VPGQV5TG.js → transcribe-7BDHDQVP.js} +10 -10
- package/dist/{updateCheck-MN3QTSGM.js → updateCheck-7B7L3UWO.js} +3 -3
- package/dist/{upgrade-4FVRTMU5.js → upgrade-TUA2QZTY.js} +3 -3
- package/dist/{urlDownloader-UTVBU5IQ.js → urlDownloader-CGV6EYL7.js} +6 -6
- package/dist/{validate-NN43T4XX.js → validate-JLCXEI2U.js} +23 -23
- package/dist/{video-VQ67QXES.js → video-TI3EOA2D.js} +7 -7
- package/dist/warmCheck.js +36 -36
- package/package.json +1 -1
- package/dist/chunk-UYBXHV7R.js +0 -3901
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
EncoderInterruptedError,
|
|
9
9
|
encoderFailureError,
|
|
10
10
|
prepareAnimatedGifInputs
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-GR2G5L2O.js";
|
|
12
12
|
import {
|
|
13
13
|
GENERIC_FAMILIES,
|
|
14
14
|
collectFontFamilyCustomProperties,
|
|
@@ -161,7 +161,7 @@ import {
|
|
|
161
161
|
verifyDiskDrawElementSamples,
|
|
162
162
|
videoAudioId,
|
|
163
163
|
writeCapturedFrame
|
|
164
|
-
} from "./chunk-
|
|
164
|
+
} from "./chunk-UUFY6A7I.js";
|
|
165
165
|
import {
|
|
166
166
|
DISTRIBUTED_FPS,
|
|
167
167
|
HF_VFX_ATTR,
|
|
@@ -177,7 +177,7 @@ import {
|
|
|
177
177
|
parseVfxChain,
|
|
178
178
|
resolveAuthoredTimingWindow,
|
|
179
179
|
toFps
|
|
180
|
-
} from "./chunk-
|
|
180
|
+
} from "./chunk-G7RKSAKS.js";
|
|
181
181
|
import {
|
|
182
182
|
assignBundledRuntimeCompositionIds,
|
|
183
183
|
buildVariablesByCompScript,
|
|
@@ -189,7 +189,7 @@ import {
|
|
|
189
189
|
inlineSubCompositions,
|
|
190
190
|
parsesAsScript,
|
|
191
191
|
prepareFlattenedInnerRoot
|
|
192
|
-
} from "./chunk-
|
|
192
|
+
} from "./chunk-32V3VHMK.js";
|
|
193
193
|
import {
|
|
194
194
|
COMPOSITION_SOURCE_URL,
|
|
195
195
|
HF_COLOR_GRADING_ATTR,
|
|
@@ -220,7 +220,7 @@ import {
|
|
|
220
220
|
sourceTimeAt,
|
|
221
221
|
styleElementsFor,
|
|
222
222
|
timeAtSourceTime
|
|
223
|
-
} from "./chunk-
|
|
223
|
+
} from "./chunk-PW22CDII.js";
|
|
224
224
|
import {
|
|
225
225
|
MAX_AUDIO_GAIN
|
|
226
226
|
} from "./chunk-X7HBSTCZ.js";
|
|
@@ -250,7 +250,7 @@ import {
|
|
|
250
250
|
import {
|
|
251
251
|
lintHyperframeHtml,
|
|
252
252
|
resolveReferencedStart
|
|
253
|
-
} from "./chunk-
|
|
253
|
+
} from "./chunk-IC6BO4GU.js";
|
|
254
254
|
import {
|
|
255
255
|
isUnresolvedAssetPlaceholder,
|
|
256
256
|
readProjectFile,
|
|
@@ -282,7 +282,7 @@ import {
|
|
|
282
282
|
LOW_MEMORY_TOTAL_MB_THRESHOLD,
|
|
283
283
|
getCgroupMemoryLimitMb,
|
|
284
284
|
getSystemTotalMb
|
|
285
|
-
} from "./chunk-
|
|
285
|
+
} from "./chunk-UIOZIIB7.js";
|
|
286
286
|
|
|
287
287
|
// ../producer/src/services/renderOrchestrator.ts
|
|
288
288
|
import {
|
|
@@ -290,14 +290,14 @@ import {
|
|
|
290
290
|
mkdirSync as mkdirSync8,
|
|
291
291
|
readFileSync as readFileSync7,
|
|
292
292
|
readdirSync as readdirSync5,
|
|
293
|
-
rmSync as
|
|
294
|
-
statSync as
|
|
293
|
+
rmSync as rmSync10,
|
|
294
|
+
statSync as statSync6,
|
|
295
295
|
writeFileSync as writeFileSync5,
|
|
296
296
|
copyFileSync as copyFileSync3,
|
|
297
297
|
appendFileSync
|
|
298
298
|
} from "fs";
|
|
299
299
|
import { tmpdir as tmpdir2 } from "os";
|
|
300
|
-
import { join as
|
|
300
|
+
import { join as join25, dirname as dirname9, resolve as resolve6 } from "path";
|
|
301
301
|
import { totalmem as totalmem2 } from "os";
|
|
302
302
|
import { randomUUID } from "crypto";
|
|
303
303
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
@@ -2094,8 +2094,8 @@ function replanAfterFailure(plan2, failure) {
|
|
|
2094
2094
|
}
|
|
2095
2095
|
|
|
2096
2096
|
// ../producer/src/services/render/stages/captureSegmentedStage.ts
|
|
2097
|
-
import { existsSync as existsSync6, mkdirSync as mkdirSync3, rmSync as
|
|
2098
|
-
import { join as
|
|
2097
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync3, rmSync as rmSync6, statSync as statSync3 } from "fs";
|
|
2098
|
+
import { join as join10 } from "path";
|
|
2099
2099
|
|
|
2100
2100
|
// ../producer/src/services/render/perfSummary.ts
|
|
2101
2101
|
import { arch, cpus, platform, totalmem } from "os";
|
|
@@ -2282,6 +2282,7 @@ function aggregateDrawElement(perfs, de) {
|
|
|
2282
2282
|
blankDeterministicAccepts: drain?.blankDeterministicAccepts ?? 0,
|
|
2283
2283
|
blankRecaptures: drain?.blankRecaptures ?? 0,
|
|
2284
2284
|
boundaryFrames: perfs.reduce((sum2, p) => sum2 + (p.deBoundaryFrames ?? 0), 0),
|
|
2285
|
+
riskFrames: perfs.reduce((sum2, p) => sum2 + (p.deRiskFrames ?? 0), 0),
|
|
2285
2286
|
ncprFallbacks: perfs.reduce((sum2, p) => sum2 + (p.deNcprFallbacks ?? 0), 0),
|
|
2286
2287
|
frameTimeouts: perfs.reduce((sum2, p) => sum2 + (p.deFrameTimeouts ?? 0), 0)
|
|
2287
2288
|
};
|
|
@@ -2453,7 +2454,7 @@ function getCaptureStageBrowserConsole(error) {
|
|
|
2453
2454
|
}
|
|
2454
2455
|
|
|
2455
2456
|
// ../producer/src/services/hdrCompositor.ts
|
|
2456
|
-
import { readSync as readSync2
|
|
2457
|
+
import { readSync as readSync2 } from "fs";
|
|
2457
2458
|
import { join as join6 } from "path";
|
|
2458
2459
|
function countNonZeroAlpha(rgba) {
|
|
2459
2460
|
let n = 0;
|
|
@@ -2493,10 +2494,10 @@ function cropRgb48le(src, srcW, srcH, cropX, cropY, cropW, cropH) {
|
|
|
2493
2494
|
}
|
|
2494
2495
|
function closeHdrVideoFrameSource(source, log) {
|
|
2495
2496
|
try {
|
|
2496
|
-
|
|
2497
|
+
source.windows.close();
|
|
2497
2498
|
} catch (err) {
|
|
2498
|
-
log?.warn("Failed to close HDR raw frame
|
|
2499
|
-
|
|
2499
|
+
log?.warn("Failed to close HDR raw frame windows", {
|
|
2500
|
+
dir: source.dir,
|
|
2500
2501
|
error: err instanceof Error ? err.message : String(err)
|
|
2501
2502
|
});
|
|
2502
2503
|
}
|
|
@@ -2506,7 +2507,7 @@ function resolveHdrVideoFrameIndex(time, startTime, fps, frameCount, loop = fals
|
|
|
2506
2507
|
if (frameIndex < 0 || frameCount < 1) return null;
|
|
2507
2508
|
return loop ? frameIndex % frameCount : Math.min(frameIndex, frameCount - 1);
|
|
2508
2509
|
}
|
|
2509
|
-
function blitHdrVideoLayer(canvas, el, time, fps, hdrVideoFrameSources, hdrStartTimes, width, height, log, sourceTransfer, targetTransfer, hdrPerf) {
|
|
2510
|
+
async function blitHdrVideoLayer(canvas, el, time, fps, hdrVideoFrameSources, hdrStartTimes, width, height, log, sourceTransfer, targetTransfer, hdrPerf) {
|
|
2510
2511
|
const frameSource = hdrVideoFrameSources.get(el.id);
|
|
2511
2512
|
const startTime = hdrStartTimes.get(el.id);
|
|
2512
2513
|
if (!frameSource || startTime === void 0 || el.opacity <= 0) {
|
|
@@ -2522,13 +2523,32 @@ function blitHdrVideoLayer(canvas, el, time, fps, hdrVideoFrameSources, hdrStart
|
|
|
2522
2523
|
if (effectiveIndex === null) return;
|
|
2523
2524
|
const mediaTime = (frameSource.mediaStart ?? 0) + effectiveIndex / fps;
|
|
2524
2525
|
if (isVideoHiddenBeforeStreamStart(frameSource.videoStreamLeadSeconds, mediaTime)) return;
|
|
2525
|
-
|
|
2526
|
+
if (hdrPerf) hdrPerf.hdrVideoLayerBlits += 1;
|
|
2527
|
+
const lease = await frameSource.windows.lease(effectiveIndex);
|
|
2528
|
+
if (!lease) return;
|
|
2529
|
+
try {
|
|
2530
|
+
blitScratchFrameWithoutYielding(
|
|
2531
|
+
canvas,
|
|
2532
|
+
el,
|
|
2533
|
+
frameSource,
|
|
2534
|
+
lease,
|
|
2535
|
+
width,
|
|
2536
|
+
height,
|
|
2537
|
+
log,
|
|
2538
|
+
sourceTransfer,
|
|
2539
|
+
targetTransfer,
|
|
2540
|
+
hdrPerf
|
|
2541
|
+
);
|
|
2542
|
+
} finally {
|
|
2543
|
+
lease.release();
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
function blitScratchFrameWithoutYielding(canvas, el, frameSource, lease, width, height, log, sourceTransfer, targetTransfer, hdrPerf) {
|
|
2526
2547
|
try {
|
|
2527
|
-
if (hdrPerf) hdrPerf.hdrVideoLayerBlits += 1;
|
|
2528
2548
|
const bytesRead = timeHdrPhase(
|
|
2529
2549
|
hdrPerf,
|
|
2530
2550
|
"hdrVideoReadDecodeMs",
|
|
2531
|
-
() => readSync2(
|
|
2551
|
+
() => readSync2(lease.fd, frameSource.scratch, 0, frameSource.frameSize, lease.offset)
|
|
2532
2552
|
);
|
|
2533
2553
|
if (bytesRead !== frameSource.frameSize) return;
|
|
2534
2554
|
const hdrRgb = frameSource.scratch;
|
|
@@ -2757,7 +2777,7 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
|
|
|
2757
2777
|
hdrPerf
|
|
2758
2778
|
);
|
|
2759
2779
|
} else {
|
|
2760
|
-
blitHdrVideoLayer(
|
|
2780
|
+
await blitHdrVideoLayer(
|
|
2761
2781
|
canvas,
|
|
2762
2782
|
layer.element,
|
|
2763
2783
|
time,
|
|
@@ -2801,7 +2821,7 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
|
|
|
2801
2821
|
startTime,
|
|
2802
2822
|
localTime: localTime.toFixed(3),
|
|
2803
2823
|
hdrFrameNum: frameNum,
|
|
2804
|
-
|
|
2824
|
+
dir: frameSource?.dir ?? null,
|
|
2805
2825
|
frameCount: frameSource?.frameCount ?? null
|
|
2806
2826
|
});
|
|
2807
2827
|
}
|
|
@@ -2897,19 +2917,92 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
|
|
|
2897
2917
|
}
|
|
2898
2918
|
|
|
2899
2919
|
// ../producer/src/services/render/stages/captureHdrResources.ts
|
|
2900
|
-
import {
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
mkdtempSync as mkdtempSync2,
|
|
2906
|
-
openSync as openSync3,
|
|
2907
|
-
readFileSync as readFileSync3,
|
|
2908
|
-
rmSync as rmSync4,
|
|
2909
|
-
statfsSync
|
|
2910
|
-
} from "fs";
|
|
2920
|
+
import { mkdirSync as mkdirSync2, mkdtempSync as mkdtempSync2, readFileSync as readFileSync3, rmSync as rmSync5, statSync as statSync2, statfsSync } from "fs";
|
|
2921
|
+
import { join as join8 } from "path";
|
|
2922
|
+
|
|
2923
|
+
// ../producer/src/services/hdrFrameWindows.ts
|
|
2924
|
+
import { closeSync as closeSync3, constants as constants2, openSync as openSync3, rmSync as rmSync4 } from "fs";
|
|
2911
2925
|
import { join as join7 } from "path";
|
|
2912
|
-
|
|
2926
|
+
function createHdrFrameWindows(opts) {
|
|
2927
|
+
const { dir, frameSize, windowFrames, maxResident, extract } = opts;
|
|
2928
|
+
let totalFrames = opts.totalFrames;
|
|
2929
|
+
const windows = /* @__PURE__ */ new Map();
|
|
2930
|
+
const drop = (index, w) => {
|
|
2931
|
+
windows.delete(index);
|
|
2932
|
+
if (w.fd >= 0) closeSync3(w.fd);
|
|
2933
|
+
rmSync4(w.path, { force: true });
|
|
2934
|
+
};
|
|
2935
|
+
const open2 = (index) => {
|
|
2936
|
+
const known = windows.get(index);
|
|
2937
|
+
if (known) {
|
|
2938
|
+
windows.delete(index);
|
|
2939
|
+
windows.set(index, known);
|
|
2940
|
+
return known;
|
|
2941
|
+
}
|
|
2942
|
+
for (const [i, w2] of windows) {
|
|
2943
|
+
if (windows.size < maxResident) break;
|
|
2944
|
+
if (w2.pins === 0) drop(i, w2);
|
|
2945
|
+
}
|
|
2946
|
+
const firstFrame = index * windowFrames;
|
|
2947
|
+
const w = {
|
|
2948
|
+
firstFrame,
|
|
2949
|
+
path: join7(dir, `window-${index}.rgb48le`),
|
|
2950
|
+
frames: 0,
|
|
2951
|
+
fd: -1,
|
|
2952
|
+
pins: 0,
|
|
2953
|
+
ready: Promise.resolve()
|
|
2954
|
+
};
|
|
2955
|
+
w.ready = extract({
|
|
2956
|
+
firstFrame,
|
|
2957
|
+
frames: Math.min(windowFrames, totalFrames - firstFrame),
|
|
2958
|
+
path: w.path
|
|
2959
|
+
}).then((produced) => {
|
|
2960
|
+
if (produced < 1) return;
|
|
2961
|
+
w.fd = openSync3(w.path, constants2.O_RDONLY | (constants2.O_NOFOLLOW ?? 0));
|
|
2962
|
+
w.frames = produced;
|
|
2963
|
+
});
|
|
2964
|
+
windows.set(index, w);
|
|
2965
|
+
return w;
|
|
2966
|
+
};
|
|
2967
|
+
return {
|
|
2968
|
+
get totalFrames() {
|
|
2969
|
+
return totalFrames;
|
|
2970
|
+
},
|
|
2971
|
+
async lease(frameIndex) {
|
|
2972
|
+
for (; ; ) {
|
|
2973
|
+
if (totalFrames < 1) return null;
|
|
2974
|
+
const index = Math.min(Math.max(0, frameIndex), totalFrames - 1);
|
|
2975
|
+
const key = Math.floor(index / windowFrames);
|
|
2976
|
+
const w = open2(key);
|
|
2977
|
+
w.pins += 1;
|
|
2978
|
+
try {
|
|
2979
|
+
await w.ready;
|
|
2980
|
+
} catch (error) {
|
|
2981
|
+
w.pins -= 1;
|
|
2982
|
+
windows.delete(key);
|
|
2983
|
+
throw error;
|
|
2984
|
+
}
|
|
2985
|
+
const local = index - w.firstFrame;
|
|
2986
|
+
if (local < w.frames) {
|
|
2987
|
+
return {
|
|
2988
|
+
fd: w.fd,
|
|
2989
|
+
offset: local * frameSize,
|
|
2990
|
+
release: () => {
|
|
2991
|
+
w.pins -= 1;
|
|
2992
|
+
}
|
|
2993
|
+
};
|
|
2994
|
+
}
|
|
2995
|
+
w.pins -= 1;
|
|
2996
|
+
totalFrames = Math.min(totalFrames, w.firstFrame + w.frames);
|
|
2997
|
+
}
|
|
2998
|
+
},
|
|
2999
|
+
close() {
|
|
3000
|
+
for (const [i, w] of [...windows]) drop(i, w);
|
|
3001
|
+
}
|
|
3002
|
+
};
|
|
3003
|
+
}
|
|
3004
|
+
|
|
3005
|
+
// ../producer/src/services/render/stages/captureHdrResources.ts
|
|
2913
3006
|
function tempDirSafePrefix(id) {
|
|
2914
3007
|
const safe = id.replace(/[^A-Za-z0-9_.-]/g, "_").slice(0, 80);
|
|
2915
3008
|
return safe || "video";
|
|
@@ -2954,10 +3047,16 @@ async function probeHdrExtractionDims(args) {
|
|
|
2954
3047
|
const stacking = await queryElementStacking(domSession.page, nativeHdrIds);
|
|
2955
3048
|
for (const el of stacking) {
|
|
2956
3049
|
if (el.isHdr && el.layoutWidth > 0 && el.layoutHeight > 0 && !prep.hdrExtractionDims.has(el.id)) {
|
|
2957
|
-
prep.hdrExtractionDims.set(el.id, {
|
|
3050
|
+
prep.hdrExtractionDims.set(el.id, {
|
|
3051
|
+
width: el.layoutWidth,
|
|
3052
|
+
height: el.layoutHeight
|
|
3053
|
+
});
|
|
2958
3054
|
}
|
|
2959
3055
|
if (el.isHdr && nativeHdrImageIds.has(el.id) && !prep.hdrImageFitInfo.has(el.id)) {
|
|
2960
|
-
prep.hdrImageFitInfo.set(el.id, {
|
|
3056
|
+
prep.hdrImageFitInfo.set(el.id, {
|
|
3057
|
+
fit: el.objectFit,
|
|
3058
|
+
position: el.objectPosition
|
|
3059
|
+
});
|
|
2961
3060
|
}
|
|
2962
3061
|
}
|
|
2963
3062
|
}
|
|
@@ -2976,23 +3075,21 @@ async function probeHdrExtractionDims(args) {
|
|
|
2976
3075
|
const retryStacking = await queryElementStacking(domSession.page, nativeHdrIds);
|
|
2977
3076
|
for (const el of retryStacking) {
|
|
2978
3077
|
if (el.id === imageId && el.isHdr && el.layoutWidth > 0 && el.layoutHeight > 0) {
|
|
2979
|
-
prep.hdrExtractionDims.set(el.id, {
|
|
3078
|
+
prep.hdrExtractionDims.set(el.id, {
|
|
3079
|
+
width: el.layoutWidth,
|
|
3080
|
+
height: el.layoutHeight
|
|
3081
|
+
});
|
|
2980
3082
|
if (!prep.hdrImageFitInfo.has(el.id)) {
|
|
2981
|
-
prep.hdrImageFitInfo.set(el.id, {
|
|
3083
|
+
prep.hdrImageFitInfo.set(el.id, {
|
|
3084
|
+
fit: el.objectFit,
|
|
3085
|
+
position: el.objectPosition
|
|
3086
|
+
});
|
|
2982
3087
|
}
|
|
2983
3088
|
break;
|
|
2984
3089
|
}
|
|
2985
3090
|
}
|
|
2986
3091
|
}
|
|
2987
3092
|
}
|
|
2988
|
-
function estimateHdrExtractionBytes(videos, fps) {
|
|
2989
|
-
let total = 0;
|
|
2990
|
-
for (const v of videos) {
|
|
2991
|
-
const frames = Math.ceil(Math.max(0, v.durationSeconds) * fps);
|
|
2992
|
-
total += frames * v.width * v.height * 6;
|
|
2993
|
-
}
|
|
2994
|
-
return total;
|
|
2995
|
-
}
|
|
2996
3093
|
var HDR_EXTRACTION_HEADROOM_FRACTION = 0.9;
|
|
2997
3094
|
var HDR_EXTRACTION_CGROUP_BUDGET_FRACTION = 0.5;
|
|
2998
3095
|
var HDR_EXTRACTION_WARN_BYTES = 1e10;
|
|
@@ -3056,24 +3153,22 @@ function resolveHdrExtractionWindow(video, compositionDuration, metadata) {
|
|
|
3056
3153
|
}
|
|
3057
3154
|
return window2;
|
|
3058
3155
|
}
|
|
3059
|
-
function cleanupHdrFrameDirectory(frameDir,
|
|
3156
|
+
function cleanupHdrFrameDirectory(frameDir, log) {
|
|
3060
3157
|
if (process.env.KEEP_TEMP === "1") return;
|
|
3061
3158
|
try {
|
|
3062
|
-
|
|
3159
|
+
rmSync5(frameDir, { recursive: true, force: true });
|
|
3063
3160
|
} catch (err) {
|
|
3064
3161
|
log?.warn("Failed to clean up HDR raw frame directory", {
|
|
3065
3162
|
frameDir,
|
|
3066
|
-
rawPath,
|
|
3067
3163
|
error: err instanceof Error ? err.message : String(err)
|
|
3068
3164
|
});
|
|
3069
3165
|
}
|
|
3070
3166
|
}
|
|
3071
3167
|
function cleanupHdrVideoFrameSource(source, log) {
|
|
3072
3168
|
closeHdrVideoFrameSource(source, log);
|
|
3073
|
-
cleanupHdrFrameDirectory(source.dir,
|
|
3169
|
+
cleanupHdrFrameDirectory(source.dir, log);
|
|
3074
3170
|
}
|
|
3075
|
-
function assertHdrExtractionDiskHeadroom(framesDir,
|
|
3076
|
-
const estimatedBytes = estimateHdrExtractionBytes(plannedVideos, fps);
|
|
3171
|
+
function assertHdrExtractionDiskHeadroom(framesDir, estimatedBytes, log) {
|
|
3077
3172
|
const configuredBudget = resolveHdrExtractionBudgetBytes(
|
|
3078
3173
|
process.env[HDR_EXTRACTION_MAX_BYTES_ENV]
|
|
3079
3174
|
);
|
|
@@ -3107,14 +3202,29 @@ function assertHdrExtractionDiskHeadroom(framesDir, plannedVideos, fps, log) {
|
|
|
3107
3202
|
budgetBytes: resolveHdrExtractionActiveBudgetBytes(configuredBudget, freeBytes)
|
|
3108
3203
|
};
|
|
3109
3204
|
}
|
|
3205
|
+
var DEFAULT_HDR_WINDOW_BYTES = 512 * BYTES_PER_MIB;
|
|
3206
|
+
function hdrWindowFrames(frameSize, windowBytes) {
|
|
3207
|
+
return Math.max(8, Math.floor(windowBytes / frameSize));
|
|
3208
|
+
}
|
|
3209
|
+
async function probeFirstTick(srcPath, mediaStart, fps, runFfmpegImpl, abortSignal) {
|
|
3210
|
+
const args = ["-ss", String(mediaStart), "-i", srcPath, "-frames:v", "1"];
|
|
3211
|
+
const result = await runFfmpegImpl([...args, ...["-vf", "showinfo", "-f", "null", "-"]], {
|
|
3212
|
+
signal: abortSignal
|
|
3213
|
+
});
|
|
3214
|
+
const match = /pts_time:(-?[\d.]+)/.exec(result.stderr);
|
|
3215
|
+
return match ? Math.max(0, Math.floor(Number(match[1]) * fps + 0.5)) : 0;
|
|
3216
|
+
}
|
|
3110
3217
|
async function extractHdrVideoFrames(args) {
|
|
3111
3218
|
const { job, log, framesDir, composition, prep, width, height, abortSignal, hdrDiagnostics } = args;
|
|
3219
|
+
const maxResident = Math.max(2, args.maxResidentWindows ?? 2);
|
|
3220
|
+
const windowBytes = args.windowBytes ?? DEFAULT_HDR_WINDOW_BYTES;
|
|
3112
3221
|
const runFfmpegImpl = args.runFfmpegImpl ?? runFfmpeg;
|
|
3113
3222
|
const extractMediaMetadataImpl = args.extractMediaMetadataImpl ?? extractMediaMetadata;
|
|
3114
3223
|
const resolveFinalFrameExtractionWindowImpl = args.resolveFinalFrameExtractionWindowImpl ?? resolveFinalFrameExtractionWindow;
|
|
3224
|
+
const fps = fpsToNumber(job.config.fps);
|
|
3115
3225
|
const out = /* @__PURE__ */ new Map();
|
|
3116
3226
|
mkdirSync2(framesDir, { recursive: true });
|
|
3117
|
-
|
|
3227
|
+
let scratchBytes = 0;
|
|
3118
3228
|
const extractionWindows = /* @__PURE__ */ new Map();
|
|
3119
3229
|
for (const [videoId, srcPath] of prep.hdrVideoSrcPaths) {
|
|
3120
3230
|
const video = composition.videos.find((v) => v.id === videoId);
|
|
@@ -3135,16 +3245,13 @@ async function extractHdrVideoFrames(args) {
|
|
|
3135
3245
|
videoStreamLeadSeconds: metadata.videoStreamLeadSeconds
|
|
3136
3246
|
});
|
|
3137
3247
|
prep.hdrVideoStartTimes.set(videoId, window2.compositionStart);
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
height: dims.height
|
|
3142
|
-
});
|
|
3248
|
+
const frameSize = dims.width * dims.height * 6;
|
|
3249
|
+
const frames = window2.finalFrameOnly ? 1 : Math.ceil(window2.durationSeconds * fps);
|
|
3250
|
+
scratchBytes += Math.min(frames, maxResident * hdrWindowFrames(frameSize, windowBytes)) * frameSize;
|
|
3143
3251
|
}
|
|
3144
3252
|
const { estimatedBytes, budgetBytes } = assertHdrExtractionDiskHeadroom(
|
|
3145
3253
|
framesDir,
|
|
3146
|
-
|
|
3147
|
-
fpsToNumber(job.config.fps),
|
|
3254
|
+
scratchBytes,
|
|
3148
3255
|
log
|
|
3149
3256
|
);
|
|
3150
3257
|
const releaseReservation = reserveHdrExtractionBytes(estimatedBytes, budgetBytes);
|
|
@@ -3156,79 +3263,79 @@ async function extractHdrVideoFrames(args) {
|
|
|
3156
3263
|
if (!video || !planned) continue;
|
|
3157
3264
|
const { window: window2 } = planned;
|
|
3158
3265
|
mkdirSync2(framesDir, { recursive: true });
|
|
3159
|
-
const frameDir = mkdtempSync2(
|
|
3266
|
+
const frameDir = mkdtempSync2(join8(framesDir, `hdr_${tempDirSafePrefix(videoId)}-`));
|
|
3160
3267
|
createdFrameDirs.add(frameDir);
|
|
3161
3268
|
const dims = prep.hdrExtractionDims.get(videoId) ?? { width, height };
|
|
3162
|
-
const rawPath = join7(frameDir, "frames.rgb48le");
|
|
3163
|
-
const extractionMediaStart = window2.extractionMediaStart ?? window2.mediaStart;
|
|
3164
|
-
const extractionStart = String(extractionMediaStart);
|
|
3165
|
-
const ffmpegArgs = [];
|
|
3166
|
-
if (window2.finalFrameOnly) {
|
|
3167
|
-
ffmpegArgs.push("-i", srcPath, "-ss", extractionStart, "-frames:v", "1");
|
|
3168
|
-
} else {
|
|
3169
|
-
ffmpegArgs.push(
|
|
3170
|
-
"-ss",
|
|
3171
|
-
extractionStart,
|
|
3172
|
-
"-i",
|
|
3173
|
-
srcPath,
|
|
3174
|
-
"-t",
|
|
3175
|
-
String(window2.durationSeconds)
|
|
3176
|
-
);
|
|
3177
|
-
}
|
|
3178
|
-
if (!window2.finalFrameOnly) {
|
|
3179
|
-
ffmpegArgs.push("-r", fpsToFfmpegArg(job.config.fps));
|
|
3180
|
-
}
|
|
3181
|
-
ffmpegArgs.push(
|
|
3182
|
-
"-vf",
|
|
3183
|
-
`scale=${dims.width}:${dims.height}:force_original_aspect_ratio=increase,crop=${dims.width}:${dims.height}`,
|
|
3184
|
-
"-pix_fmt",
|
|
3185
|
-
"rgb48le",
|
|
3186
|
-
"-f",
|
|
3187
|
-
"rawvideo",
|
|
3188
|
-
"-y",
|
|
3189
|
-
rawPath
|
|
3190
|
-
);
|
|
3191
|
-
const result = await runFfmpegImpl(ffmpegArgs, { signal: abortSignal });
|
|
3192
|
-
if (!result.success) {
|
|
3193
|
-
hdrDiagnostics.videoExtractionFailures += 1;
|
|
3194
|
-
log.error("HDR frame pre-extraction failed; aborting render", {
|
|
3195
|
-
videoId,
|
|
3196
|
-
srcPath,
|
|
3197
|
-
stderr: result.stderr.slice(-400)
|
|
3198
|
-
});
|
|
3199
|
-
throw encoderFailureError(`HDR frame extraction failed for video "${videoId}"`, {
|
|
3200
|
-
error: `Aborting render to avoid shipping black HDR layers: ${result.stderr.slice(-400)}`,
|
|
3201
|
-
failureReason: result.failureReason
|
|
3202
|
-
});
|
|
3203
|
-
}
|
|
3204
3269
|
const frameSize = dims.width * dims.height * 6;
|
|
3205
|
-
const
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3270
|
+
const extractionMediaStart = window2.extractionMediaStart ?? window2.mediaStart;
|
|
3271
|
+
const scale = `scale=${dims.width}:${dims.height}:force_original_aspect_ratio=increase,crop=${dims.width}:${dims.height}`;
|
|
3272
|
+
const firstTick = window2.finalFrameOnly ? 0 : await probeFirstTick(srcPath, extractionMediaStart, fps, runFfmpegImpl, abortSignal);
|
|
3273
|
+
const totalFrames = window2.finalFrameOnly ? 1 : Math.max(1, Math.ceil(window2.durationSeconds * fps - firstTick - 1e-9)) + Number(video.loop);
|
|
3274
|
+
const windowFrames = Math.min(totalFrames, hdrWindowFrames(frameSize, windowBytes));
|
|
3275
|
+
const windows = createHdrFrameWindows({
|
|
3276
|
+
dir: frameDir,
|
|
3277
|
+
frameSize,
|
|
3278
|
+
totalFrames,
|
|
3279
|
+
windowFrames,
|
|
3280
|
+
maxResident,
|
|
3281
|
+
extract: async (spec) => {
|
|
3282
|
+
const ffmpegArgs = window2.finalFrameOnly ? (
|
|
3283
|
+
// Decode before seeking for the one-frame path. Input-side seeking can
|
|
3284
|
+
// return zero frames for valid unindexed/negative-base transports.
|
|
3285
|
+
["-i", srcPath, "-ss", String(extractionMediaStart), "-frames:v", "1", "-vf", scale]
|
|
3286
|
+
) : hdrWindowFfmpegArgs({
|
|
3287
|
+
srcPath,
|
|
3288
|
+
mediaStart: extractionMediaStart,
|
|
3289
|
+
fps,
|
|
3290
|
+
fpsArg: fpsToFfmpegArg(job.config.fps),
|
|
3291
|
+
firstTick,
|
|
3292
|
+
firstFrame: spec.firstFrame,
|
|
3293
|
+
frames: spec.frames,
|
|
3294
|
+
scale
|
|
3295
|
+
});
|
|
3296
|
+
const result = await runFfmpegImpl(
|
|
3297
|
+
[...ffmpegArgs, "-pix_fmt", "rgb48le", "-f", "rawvideo", "-y", spec.path],
|
|
3298
|
+
{ signal: abortSignal }
|
|
3213
3299
|
);
|
|
3300
|
+
if (!result.success) {
|
|
3301
|
+
hdrDiagnostics.videoExtractionFailures += 1;
|
|
3302
|
+
log.error("HDR frame extraction failed; aborting render", {
|
|
3303
|
+
videoId,
|
|
3304
|
+
srcPath,
|
|
3305
|
+
firstFrame: spec.firstFrame,
|
|
3306
|
+
stderr: result.stderr.slice(-400)
|
|
3307
|
+
});
|
|
3308
|
+
throw encoderFailureError(`HDR frame extraction failed for video "${videoId}"`, {
|
|
3309
|
+
error: `Aborting render to avoid shipping black HDR layers: ${result.stderr.slice(-400)}`,
|
|
3310
|
+
failureReason: result.failureReason
|
|
3311
|
+
});
|
|
3312
|
+
}
|
|
3313
|
+
return Math.min(Math.floor(statSync2(spec.path).size / frameSize), spec.frames);
|
|
3214
3314
|
}
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
frameCount,
|
|
3223
|
-
scratch: Buffer.allocUnsafe(frameSize),
|
|
3224
|
-
loop: video.loop,
|
|
3225
|
-
mediaStart: extractionMediaStart,
|
|
3226
|
-
videoStreamLeadSeconds: planned.videoStreamLeadSeconds
|
|
3227
|
-
});
|
|
3228
|
-
handedOff = true;
|
|
3229
|
-
} finally {
|
|
3230
|
-
if (!handedOff) closeSync4(fd);
|
|
3315
|
+
});
|
|
3316
|
+
const first = await windows.lease(0);
|
|
3317
|
+
if (!first) {
|
|
3318
|
+
hdrDiagnostics.videoExtractionFailures += 1;
|
|
3319
|
+
throw new Error(
|
|
3320
|
+
`HDR frame extraction produced no frames for video "${videoId}". Aborting render to avoid shipping black HDR layers.`
|
|
3321
|
+
);
|
|
3231
3322
|
}
|
|
3323
|
+
first.release();
|
|
3324
|
+
if (video.loop) (await windows.lease(totalFrames - 1))?.release();
|
|
3325
|
+
out.set(videoId, {
|
|
3326
|
+
dir: frameDir,
|
|
3327
|
+
windows,
|
|
3328
|
+
width: dims.width,
|
|
3329
|
+
height: dims.height,
|
|
3330
|
+
frameSize,
|
|
3331
|
+
get frameCount() {
|
|
3332
|
+
return windows.totalFrames;
|
|
3333
|
+
},
|
|
3334
|
+
scratch: Buffer.allocUnsafe(frameSize),
|
|
3335
|
+
loop: video.loop,
|
|
3336
|
+
mediaStart: extractionMediaStart,
|
|
3337
|
+
videoStreamLeadSeconds: planned.videoStreamLeadSeconds
|
|
3338
|
+
});
|
|
3232
3339
|
}
|
|
3233
3340
|
return { sources: out, estimatedBytes, releaseReservation };
|
|
3234
3341
|
} catch (error) {
|
|
@@ -3237,12 +3344,23 @@ async function extractHdrVideoFrames(args) {
|
|
|
3237
3344
|
createdFrameDirs.delete(source.dir);
|
|
3238
3345
|
}
|
|
3239
3346
|
for (const frameDir of createdFrameDirs) {
|
|
3240
|
-
cleanupHdrFrameDirectory(frameDir,
|
|
3347
|
+
cleanupHdrFrameDirectory(frameDir, log);
|
|
3241
3348
|
}
|
|
3242
3349
|
releaseReservation();
|
|
3243
3350
|
throw error;
|
|
3244
3351
|
}
|
|
3245
3352
|
}
|
|
3353
|
+
function hdrWindowFfmpegArgs(a) {
|
|
3354
|
+
const unit = Math.ceil(a.fps);
|
|
3355
|
+
const seekFrame = a.firstFrame < unit ? 0 : (Math.floor(a.firstFrame / unit) - 1) * unit;
|
|
3356
|
+
const trim = a.firstFrame - seekFrame;
|
|
3357
|
+
const filters = [`fps=${a.fpsArg}:start_time=${(a.firstTick / a.fps).toFixed(6)}`, a.scale];
|
|
3358
|
+
if (trim > 0) filters.push(`trim=start_frame=${trim}`);
|
|
3359
|
+
return [
|
|
3360
|
+
...["-ss", (a.mediaStart + seekFrame / a.fps).toFixed(6), "-i", a.srcPath],
|
|
3361
|
+
...["-vf", filters.join(","), "-frames:v", String(a.frames)]
|
|
3362
|
+
];
|
|
3363
|
+
}
|
|
3246
3364
|
function decodeHdrImageBuffers(args) {
|
|
3247
3365
|
const { log, hdrImageSrcPaths, prep, hdrDiagnostics } = args;
|
|
3248
3366
|
const out = /* @__PURE__ */ new Map();
|
|
@@ -3262,7 +3380,11 @@ function decodeHdrImageBuffers(args) {
|
|
|
3262
3380
|
fit,
|
|
3263
3381
|
fitInfo?.position
|
|
3264
3382
|
);
|
|
3265
|
-
out.set(imageId, {
|
|
3383
|
+
out.set(imageId, {
|
|
3384
|
+
data: resampled,
|
|
3385
|
+
width: layout.width,
|
|
3386
|
+
height: layout.height
|
|
3387
|
+
});
|
|
3266
3388
|
} else {
|
|
3267
3389
|
out.set(imageId, {
|
|
3268
3390
|
data: Buffer.from(decoded.data),
|
|
@@ -3374,7 +3496,7 @@ async function captureSceneIntoBuffer(a) {
|
|
|
3374
3496
|
hdrPerf
|
|
3375
3497
|
);
|
|
3376
3498
|
} else {
|
|
3377
|
-
blitHdrVideoLayer(
|
|
3499
|
+
await blitHdrVideoLayer(
|
|
3378
3500
|
sceneBuf,
|
|
3379
3501
|
el,
|
|
3380
3502
|
time,
|
|
@@ -3576,7 +3698,7 @@ function isTargetLossError(error) {
|
|
|
3576
3698
|
// ../producer/src/services/render/stages/captureStreamingStage.ts
|
|
3577
3699
|
import { mkdtemp, writeFile } from "fs/promises";
|
|
3578
3700
|
import { tmpdir } from "os";
|
|
3579
|
-
import { join as
|
|
3701
|
+
import { join as join9 } from "path";
|
|
3580
3702
|
var DEFAULT_CAPTURE_STALL_MS = 6e4;
|
|
3581
3703
|
var DE_STALL_POLL_MS = 5e3;
|
|
3582
3704
|
var STALL_ADVICE = "Chrome stopped answering. If another app is keeping the GPU or CPU busy (a 3D render, a game, another export), let it finish or render one job at a time, then retry.";
|
|
@@ -3718,11 +3840,11 @@ function createDrainFrameGuard(args) {
|
|
|
3718
3840
|
return buf;
|
|
3719
3841
|
}
|
|
3720
3842
|
if (db < verifyMinDb) {
|
|
3721
|
-
const dumpDir = await mkdtemp(
|
|
3843
|
+
const dumpDir = await mkdtemp(join9(tmpdir(), "hf-de-verify-fail-")).catch(() => null);
|
|
3722
3844
|
if (dumpDir) {
|
|
3723
3845
|
await Promise.all([
|
|
3724
|
-
writeFile(
|
|
3725
|
-
writeFile(
|
|
3846
|
+
writeFile(join9(dumpDir, `frame-${idx}-de.jpg`), buf),
|
|
3847
|
+
writeFile(join9(dumpDir, `frame-${idx}-truth.jpg`), truth)
|
|
3726
3848
|
]).catch(() => {
|
|
3727
3849
|
});
|
|
3728
3850
|
}
|
|
@@ -3741,11 +3863,21 @@ function createDrainFrameGuard(args) {
|
|
|
3741
3863
|
return buf;
|
|
3742
3864
|
};
|
|
3743
3865
|
}
|
|
3744
|
-
async function runWorkerEncodePipelineLoop(session, totalFrames, job, currentEncoder, reorderBuffer, assertNotAborted, onProgress, log, stats, abortSignal) {
|
|
3866
|
+
async function runWorkerEncodePipelineLoop(session, totalFrames, job, currentEncoder, reorderBuffer, assertNotAborted, onProgress, log, stats, abortSignal, risk) {
|
|
3745
3867
|
let prev = null;
|
|
3746
3868
|
const frameTime = (i) => i * job.config.fps.den / job.config.fps.num;
|
|
3747
3869
|
const guard = createDrainFrameGuard({ log, stats, frameTime });
|
|
3748
|
-
const guardFrame = (
|
|
3870
|
+
const guardFrame = (item, buf) => item.trusted ? Promise.resolve(buf) : guard(session, item.idx, buf);
|
|
3871
|
+
const captureRisk = async (idx) => {
|
|
3872
|
+
await risk.open();
|
|
3873
|
+
lastProgressAt = Date.now();
|
|
3874
|
+
return raceAgainstStall(
|
|
3875
|
+
risk.capture(idx, frameTime(idx)),
|
|
3876
|
+
stallTimeoutMs - (Date.now() - lastProgressAt),
|
|
3877
|
+
{ session, frameIndex: idx, totalFrames, stallTimeoutMs },
|
|
3878
|
+
abortSignal
|
|
3879
|
+
);
|
|
3880
|
+
};
|
|
3749
3881
|
const stallTimeoutMs = resolveCaptureStallTimeoutMs();
|
|
3750
3882
|
let lastProgressAt = Date.now();
|
|
3751
3883
|
const captureWithStallGuard = (idx, promise) => raceAgainstStall(
|
|
@@ -3757,7 +3889,7 @@ async function runWorkerEncodePipelineLoop(session, totalFrames, job, currentEnc
|
|
|
3757
3889
|
const drainPrev = async () => {
|
|
3758
3890
|
if (!prev) return;
|
|
3759
3891
|
assertNotAborted();
|
|
3760
|
-
const buf = await guardFrame(prev
|
|
3892
|
+
const buf = await guardFrame(prev, await prev.encodeResult);
|
|
3761
3893
|
await reorderBuffer.waitForFrame(prev.idx);
|
|
3762
3894
|
ensureFrameWritten(await currentEncoder.writeFrame(buf), prev.idx, currentEncoder);
|
|
3763
3895
|
reorderBuffer.advanceTo(prev.idx + 1);
|
|
@@ -3777,7 +3909,7 @@ async function runWorkerEncodePipelineLoop(session, totalFrames, job, currentEnc
|
|
|
3777
3909
|
const drainBatch = async (batch) => {
|
|
3778
3910
|
for (const item of batch) {
|
|
3779
3911
|
assertNotAborted();
|
|
3780
|
-
const buf = await guardFrame(item
|
|
3912
|
+
const buf = await guardFrame(item, await item.encodeResult);
|
|
3781
3913
|
await reorderBuffer.waitForFrame(item.idx);
|
|
3782
3914
|
ensureFrameWritten(await currentEncoder.writeFrame(buf), item.idx, currentEncoder);
|
|
3783
3915
|
reorderBuffer.advanceTo(item.idx + 1);
|
|
@@ -3795,7 +3927,7 @@ async function runWorkerEncodePipelineLoop(session, totalFrames, job, currentEnc
|
|
|
3795
3927
|
};
|
|
3796
3928
|
if (batchN > 1 && !session.onBeforeCapture) {
|
|
3797
3929
|
const boundarySS = process.env.HF_FAST_CAPTURE_BOUNDARY_SS === "true";
|
|
3798
|
-
const batchable = (f) => !session.staticFrames?.has(f) && !(boundarySS && session.clipBoundaryFrames?.has(f));
|
|
3930
|
+
const batchable = (f) => !session.staticFrames?.has(f) && !(boundarySS && session.clipBoundaryFrames?.has(f)) && !risk?.frames.has(f);
|
|
3799
3931
|
let prevBatch = [];
|
|
3800
3932
|
let i = 0;
|
|
3801
3933
|
while (i < totalFrames) {
|
|
@@ -3812,6 +3944,11 @@ async function runWorkerEncodePipelineLoop(session, totalFrames, job, currentEnc
|
|
|
3812
3944
|
);
|
|
3813
3945
|
await drainBatch(prevBatch);
|
|
3814
3946
|
prevBatch = results.map((r) => ({ idx: r.frameIndex, encodeResult: r.encodeResult }));
|
|
3947
|
+
} else if (risk?.frames.has(i)) {
|
|
3948
|
+
const buffer = await captureRisk(i);
|
|
3949
|
+
await drainBatch(prevBatch);
|
|
3950
|
+
prevBatch = [{ idx: i, encodeResult: Promise.resolve(buffer), trusted: true }];
|
|
3951
|
+
i++;
|
|
3815
3952
|
} else {
|
|
3816
3953
|
const { encodeResult } = await captureWithStallGuard(
|
|
3817
3954
|
i,
|
|
@@ -3827,6 +3964,12 @@ async function runWorkerEncodePipelineLoop(session, totalFrames, job, currentEnc
|
|
|
3827
3964
|
}
|
|
3828
3965
|
for (let i = 0; i < totalFrames; i++) {
|
|
3829
3966
|
assertNotAborted();
|
|
3967
|
+
if (risk?.frames.has(i)) {
|
|
3968
|
+
const buffer = await captureRisk(i);
|
|
3969
|
+
await drainPrev();
|
|
3970
|
+
prev = { idx: i, encodeResult: Promise.resolve(buffer), trusted: true };
|
|
3971
|
+
continue;
|
|
3972
|
+
}
|
|
3830
3973
|
const time = frameTime(i);
|
|
3831
3974
|
const { encodeResult } = await captureWithStallGuard(
|
|
3832
3975
|
i,
|
|
@@ -4073,6 +4216,24 @@ async function runCaptureStreamingStage(input) {
|
|
|
4073
4216
|
prepareCaptureSessionForReuse(session, framesDir, videoInjector);
|
|
4074
4217
|
probeSession = null;
|
|
4075
4218
|
}
|
|
4219
|
+
let riskSession = null;
|
|
4220
|
+
const openRiskSession = async () => {
|
|
4221
|
+
const opened = await createCaptureSession(
|
|
4222
|
+
fileServer.url,
|
|
4223
|
+
framesDir,
|
|
4224
|
+
buildCaptureOptions(),
|
|
4225
|
+
createRenderVideoFrameInjector(),
|
|
4226
|
+
{
|
|
4227
|
+
...captureCfg,
|
|
4228
|
+
useDrawElement: false,
|
|
4229
|
+
staticFrameDedup: false,
|
|
4230
|
+
enableBrowserPool: false
|
|
4231
|
+
}
|
|
4232
|
+
);
|
|
4233
|
+
riskSession = opened;
|
|
4234
|
+
await initializeSession(opened);
|
|
4235
|
+
return opened;
|
|
4236
|
+
};
|
|
4076
4237
|
try {
|
|
4077
4238
|
if (!session.isInitialized) {
|
|
4078
4239
|
await initializeSession(session);
|
|
@@ -4087,6 +4248,7 @@ async function runCaptureStreamingStage(input) {
|
|
|
4087
4248
|
blankDeterministicAccepts: 0,
|
|
4088
4249
|
blankRecaptures: 0
|
|
4089
4250
|
};
|
|
4251
|
+
const riskFrames = session.deRiskFrames;
|
|
4090
4252
|
await runWorkerEncodePipelineLoop(
|
|
4091
4253
|
session,
|
|
4092
4254
|
totalFrames,
|
|
@@ -4097,7 +4259,16 @@ async function runCaptureStreamingStage(input) {
|
|
|
4097
4259
|
onProgress,
|
|
4098
4260
|
log,
|
|
4099
4261
|
deDrainStats,
|
|
4100
|
-
abortSignal
|
|
4262
|
+
abortSignal,
|
|
4263
|
+
riskFrames && riskFrames.size > 0 ? {
|
|
4264
|
+
frames: riskFrames,
|
|
4265
|
+
// Opened on the first risk frame, in a browser of its own: pages sharing a
|
|
4266
|
+
// browser share a compositor, which starves the drawElement page's paint events.
|
|
4267
|
+
open: async () => {
|
|
4268
|
+
riskSession ??= await openRiskSession();
|
|
4269
|
+
},
|
|
4270
|
+
capture: async (frameIndex, time) => (await captureFrameToBuffer(riskSession, frameIndex, time)).buffer
|
|
4271
|
+
} : void 0
|
|
4101
4272
|
);
|
|
4102
4273
|
} else {
|
|
4103
4274
|
const stallTimeoutMs = resolveCaptureStallTimeoutMs();
|
|
@@ -4135,6 +4306,7 @@ async function runCaptureStreamingStage(input) {
|
|
|
4135
4306
|
} finally {
|
|
4136
4307
|
lastBrowserConsole = session.browserConsoleBuffer;
|
|
4137
4308
|
await closeCaptureSession(session);
|
|
4309
|
+
if (riskSession) await closeCaptureSession(riskSession);
|
|
4138
4310
|
}
|
|
4139
4311
|
}
|
|
4140
4312
|
const encodeFrom = job.progress;
|
|
@@ -4171,7 +4343,7 @@ async function runCaptureStreamingStage(input) {
|
|
|
4171
4343
|
|
|
4172
4344
|
// ../producer/src/services/render/stages/captureSegmentedStage.ts
|
|
4173
4345
|
function segmentOutputPath(segmentDir, index) {
|
|
4174
|
-
return
|
|
4346
|
+
return join10(segmentDir, `segment_${String(index).padStart(5, "0")}.mp4`);
|
|
4175
4347
|
}
|
|
4176
4348
|
function segmentEncoderOptions(base, segment) {
|
|
4177
4349
|
return {
|
|
@@ -4247,7 +4419,7 @@ async function captureSegment(ctx, segment) {
|
|
|
4247
4419
|
path: segmentPath,
|
|
4248
4420
|
// Recorded so resume can prove the file on disk is the one that
|
|
4249
4421
|
// finished; absent only in unit tests, whose fake encoder writes none.
|
|
4250
|
-
bytes: existsSync6(segmentPath) ?
|
|
4422
|
+
bytes: existsSync6(segmentPath) ? statSync3(segmentPath).size : 0
|
|
4251
4423
|
});
|
|
4252
4424
|
return encodeResult.durationMs;
|
|
4253
4425
|
} finally {
|
|
@@ -4265,7 +4437,7 @@ var DEFAULT_DEPS = {
|
|
|
4265
4437
|
// is invisible to a test that swaps the engine module after this file has
|
|
4266
4438
|
// been evaluated (bun updates live bindings, not copies).
|
|
4267
4439
|
closeSession: (session) => closeCaptureSession(session),
|
|
4268
|
-
removeFile: (path) =>
|
|
4440
|
+
removeFile: (path) => rmSync6(path, { force: true })
|
|
4269
4441
|
};
|
|
4270
4442
|
function defaultSessionFactory(input) {
|
|
4271
4443
|
let probeSession = input.probeSession;
|
|
@@ -4294,7 +4466,7 @@ function openSegmentedSessionReuse(input, session) {
|
|
|
4294
4466
|
async function openSegmentedSession(input) {
|
|
4295
4467
|
const captureCfg = input.cfg.forceScreenshot === input.plan.forceScreenshot ? input.cfg : { ...input.cfg, forceScreenshot: input.plan.forceScreenshot };
|
|
4296
4468
|
const videoInjector = input.createRenderVideoFrameInjector();
|
|
4297
|
-
const captureOptions = input.buildCaptureOptions();
|
|
4469
|
+
const captureOptions = { ...input.buildCaptureOptions(), deFrameFallback: false };
|
|
4298
4470
|
const ownBrowser = shouldDisableBrowserPoolForParallelWorker({
|
|
4299
4471
|
parallel: (input.workerCount ?? 1) > 1
|
|
4300
4472
|
});
|
|
@@ -4432,7 +4604,7 @@ async function runCaptureSegmentedStage(input) {
|
|
|
4432
4604
|
const { log, dedupPerfs, assertNotAborted } = input;
|
|
4433
4605
|
const deps = { ...DEFAULT_DEPS, ...input.deps };
|
|
4434
4606
|
const segments = planSegments(input.totalFrames, input.segmentFrames);
|
|
4435
|
-
const segmentDir = input.segmentDir ??
|
|
4607
|
+
const segmentDir = input.segmentDir ?? join10(input.workDir, "segments");
|
|
4436
4608
|
mkdirSync3(segmentDir, { recursive: true });
|
|
4437
4609
|
const skip = input.completedSegments ?? /* @__PURE__ */ new Set();
|
|
4438
4610
|
const pending = segments.filter((s) => !skip.has(s.index));
|
|
@@ -4503,10 +4675,83 @@ async function runCaptureSegmentedStage(input) {
|
|
|
4503
4675
|
};
|
|
4504
4676
|
}
|
|
4505
4677
|
|
|
4678
|
+
// ../producer/src/services/render/renderEtaGuard.ts
|
|
4679
|
+
var RENDER_TOO_SLOW = "RENDER_TOO_SLOW";
|
|
4680
|
+
var ETA_MARGIN = 1.2;
|
|
4681
|
+
var MIN_SAMPLE_MS = 6e4;
|
|
4682
|
+
var MIN_SAMPLE_FRAMES = 3;
|
|
4683
|
+
var POLL_MS = 5e3;
|
|
4684
|
+
var RenderTooSlowError = class extends Error {
|
|
4685
|
+
code = RENDER_TOO_SLOW;
|
|
4686
|
+
// The producer server reads these off the error for the wire envelope.
|
|
4687
|
+
// fallow-ignore-next-line unused-class-member
|
|
4688
|
+
owner = "user";
|
|
4689
|
+
// fallow-ignore-next-line unused-class-member
|
|
4690
|
+
retryable = false;
|
|
4691
|
+
publicMetadata;
|
|
4692
|
+
constructor(stage, input) {
|
|
4693
|
+
const { framesCompleted, totalFrames, msPerFrame, etaMs, maxRenderMs } = input;
|
|
4694
|
+
super(
|
|
4695
|
+
`render too slow: stage ${stage}, ${framesCompleted}/${totalFrames} frames, ${Math.round(msPerFrame)} ms/frame, ETA ${etaMs} ms exceeds maxRenderMs ${maxRenderMs}`
|
|
4696
|
+
);
|
|
4697
|
+
this.name = "RenderTooSlowError";
|
|
4698
|
+
this.publicMetadata = { stage, framesCompleted, totalFrames, msPerFrame, etaMs, maxRenderMs };
|
|
4699
|
+
}
|
|
4700
|
+
};
|
|
4701
|
+
function checkRenderEta(stage, input) {
|
|
4702
|
+
const { maxRenderMs, elapsedMs, framesCompleted, totalFrames, msPerFrame } = input;
|
|
4703
|
+
if (!maxRenderMs || maxRenderMs <= 0 || !(msPerFrame > 0)) return void 0;
|
|
4704
|
+
const etaMs = Math.round(elapsedMs + (totalFrames - framesCompleted) * msPerFrame);
|
|
4705
|
+
if (etaMs <= maxRenderMs * ETA_MARGIN) return void 0;
|
|
4706
|
+
return new RenderTooSlowError(stage, { ...input, maxRenderMs, etaMs });
|
|
4707
|
+
}
|
|
4708
|
+
function createRateSampler() {
|
|
4709
|
+
let base;
|
|
4710
|
+
let lastFrames = 0;
|
|
4711
|
+
return {
|
|
4712
|
+
observe(done, at) {
|
|
4713
|
+
if (done === 0 || done < lastFrames) base = void 0;
|
|
4714
|
+
lastFrames = done;
|
|
4715
|
+
if (done === 0) return void 0;
|
|
4716
|
+
base ??= { at, frames: done };
|
|
4717
|
+
const sampleMs = at - base.at;
|
|
4718
|
+
const sampleFrames = done - base.frames;
|
|
4719
|
+
if (sampleMs < MIN_SAMPLE_MS || sampleFrames < MIN_SAMPLE_FRAMES) return void 0;
|
|
4720
|
+
return sampleMs / sampleFrames;
|
|
4721
|
+
}
|
|
4722
|
+
};
|
|
4723
|
+
}
|
|
4724
|
+
function startRenderEtaGuard(options) {
|
|
4725
|
+
const { maxRenderMs, job, totalFrames, pipelineStartMs, onTooSlow, now = Date.now } = options;
|
|
4726
|
+
if (!maxRenderMs || maxRenderMs <= 0) return () => {
|
|
4727
|
+
};
|
|
4728
|
+
const sampler = createRateSampler();
|
|
4729
|
+
const stop = () => clearInterval(timer);
|
|
4730
|
+
const timer = setInterval(() => {
|
|
4731
|
+
const done = job.framesRendered ?? 0;
|
|
4732
|
+
if (done >= totalFrames) return stop();
|
|
4733
|
+
const at = now();
|
|
4734
|
+
const msPerFrame = sampler.observe(done, at);
|
|
4735
|
+
if (msPerFrame === void 0) return;
|
|
4736
|
+
const error = checkRenderEta("capture", {
|
|
4737
|
+
maxRenderMs,
|
|
4738
|
+
elapsedMs: at - pipelineStartMs,
|
|
4739
|
+
framesCompleted: done,
|
|
4740
|
+
totalFrames,
|
|
4741
|
+
msPerFrame
|
|
4742
|
+
});
|
|
4743
|
+
if (!error) return;
|
|
4744
|
+
stop();
|
|
4745
|
+
onTooSlow(error);
|
|
4746
|
+
}, options.pollMs ?? POLL_MS);
|
|
4747
|
+
timer.unref?.();
|
|
4748
|
+
return stop;
|
|
4749
|
+
}
|
|
4750
|
+
|
|
4506
4751
|
// ../producer/src/services/render/segmentManifest.ts
|
|
4507
4752
|
import { createHash as createHash2 } from "crypto";
|
|
4508
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync4, readFileSync as readFileSync4, statSync as
|
|
4509
|
-
import { join as
|
|
4753
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync4, readFileSync as readFileSync4, statSync as statSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
4754
|
+
import { join as join11 } from "path";
|
|
4510
4755
|
var MANIFEST_FILENAME = "segments.json";
|
|
4511
4756
|
function computeSegmentPlanHash(input) {
|
|
4512
4757
|
const ordered = [
|
|
@@ -4531,7 +4776,7 @@ function computeSegmentPlanHash(input) {
|
|
|
4531
4776
|
return createHash2("sha256").update(ordered).digest("hex").slice(0, 16);
|
|
4532
4777
|
}
|
|
4533
4778
|
function segmentDirFor(projectRendersDir, planHash) {
|
|
4534
|
-
return
|
|
4779
|
+
return join11(projectRendersDir, ".hf-segments", planHash);
|
|
4535
4780
|
}
|
|
4536
4781
|
function hasNumber(value, key) {
|
|
4537
4782
|
return key in value && typeof Reflect.get(value, key) === "number";
|
|
@@ -4549,7 +4794,7 @@ function isManifest(value) {
|
|
|
4549
4794
|
return Reflect.get(value, "version") === 1 && hasString(value, "planHash") && hasNumber(value, "totalFrames") && hasNumber(value, "segmentFrames") && Array.isArray(completed) && completed.every(isEntry);
|
|
4550
4795
|
}
|
|
4551
4796
|
function readSegmentManifest(segmentDir) {
|
|
4552
|
-
const path =
|
|
4797
|
+
const path = join11(segmentDir, MANIFEST_FILENAME);
|
|
4553
4798
|
if (!existsSync7(path)) return null;
|
|
4554
4799
|
try {
|
|
4555
4800
|
const parsed = JSON.parse(readFileSync4(path, "utf-8"));
|
|
@@ -4560,9 +4805,9 @@ function readSegmentManifest(segmentDir) {
|
|
|
4560
4805
|
}
|
|
4561
4806
|
function writeSegmentManifest(segmentDir, manifest) {
|
|
4562
4807
|
mkdirSync4(segmentDir, { recursive: true });
|
|
4563
|
-
const tmp =
|
|
4808
|
+
const tmp = join11(segmentDir, `${MANIFEST_FILENAME}.${process.pid}.tmp`);
|
|
4564
4809
|
writeFileSync3(tmp, JSON.stringify(manifest, null, 2), "utf-8");
|
|
4565
|
-
renameWithRetry(tmp,
|
|
4810
|
+
renameWithRetry(tmp, join11(segmentDir, MANIFEST_FILENAME));
|
|
4566
4811
|
}
|
|
4567
4812
|
async function probeSegmentFrameCount(path, probe) {
|
|
4568
4813
|
try {
|
|
@@ -4580,7 +4825,7 @@ async function validateCompletedSegments(manifest, expectedHash, probeFrames) {
|
|
|
4580
4825
|
if (manifest.planHash !== expectedHash) return ok;
|
|
4581
4826
|
for (const entry of manifest.completed) {
|
|
4582
4827
|
if (!existsSync7(entry.path)) continue;
|
|
4583
|
-
const size =
|
|
4828
|
+
const size = statSync4(entry.path).size;
|
|
4584
4829
|
if (size <= 0 || size !== entry.bytes) continue;
|
|
4585
4830
|
const frames = await probeFrames(entry.path);
|
|
4586
4831
|
if (frames !== entry.endFrame - entry.startFrame) continue;
|
|
@@ -4667,7 +4912,7 @@ function resolveVideoCaptureBeyondViewport(videoCount) {
|
|
|
4667
4912
|
}
|
|
4668
4913
|
|
|
4669
4914
|
// ../producer/src/services/render/captureCost.ts
|
|
4670
|
-
import { join as
|
|
4915
|
+
import { join as join12 } from "path";
|
|
4671
4916
|
var CAPTURE_CALIBRATION_TARGET_MS = 600;
|
|
4672
4917
|
var MAX_MEASURED_CAPTURE_COST_MULTIPLIER = 8;
|
|
4673
4918
|
var CAPTURE_CALIBRATION_PROTOCOL_TIMEOUT_MS = 3e4;
|
|
@@ -4903,7 +5148,7 @@ async function runCaptureCalibration(input) {
|
|
|
4903
5148
|
});
|
|
4904
5149
|
let calibration;
|
|
4905
5150
|
try {
|
|
4906
|
-
calibration = await runOneCalibration(
|
|
5151
|
+
calibration = await runOneCalibration(join12(workDir, "capture-calibration"), calibrationCfg);
|
|
4907
5152
|
} catch (error) {
|
|
4908
5153
|
const shouldFallback = !forceScreenshot && shouldFallbackToScreenshotAfterCalibrationError(error);
|
|
4909
5154
|
if (!shouldFallback) {
|
|
@@ -4936,7 +5181,7 @@ async function runCaptureCalibration(input) {
|
|
|
4936
5181
|
const screenshotCfg = createCaptureCalibrationConfig({ ...cfg, forceScreenshot: true });
|
|
4937
5182
|
try {
|
|
4938
5183
|
calibration = await runOneCalibration(
|
|
4939
|
-
|
|
5184
|
+
join12(workDir, "capture-calibration-screenshot"),
|
|
4940
5185
|
screenshotCfg
|
|
4941
5186
|
);
|
|
4942
5187
|
} catch (fallbackError) {
|
|
@@ -5356,12 +5601,12 @@ function countAuthoredTimedClips(html) {
|
|
|
5356
5601
|
}
|
|
5357
5602
|
|
|
5358
5603
|
// ../producer/src/services/render/stages/compileStage.ts
|
|
5359
|
-
import { join as
|
|
5604
|
+
import { join as join14 } from "path";
|
|
5360
5605
|
|
|
5361
5606
|
// ../producer/src/services/htmlCompiler.ts
|
|
5362
5607
|
import { createHash as createHash4 } from "crypto";
|
|
5363
5608
|
import { createReadStream as createReadStream2, existsSync as existsSync9, mkdirSync as mkdirSync5, readFileSync as readFileSync5 } from "fs";
|
|
5364
|
-
import { join as
|
|
5609
|
+
import { join as join13, dirname as dirname5, resolve as resolve5, basename as basename4, relative as relative2 } from "path";
|
|
5365
5610
|
|
|
5366
5611
|
// ../producer/src/services/renderMediaCollector.ts
|
|
5367
5612
|
function resolveHostEnd(host, hostStart) {
|
|
@@ -5490,7 +5735,7 @@ function placeAudio(audio, window2) {
|
|
|
5490
5735
|
}
|
|
5491
5736
|
|
|
5492
5737
|
// ../core/dist/generated/position-edits-render-inline.js
|
|
5493
|
-
var POSITION_EDITS_RENDER_IIFE = '"use strict";(()=>{function
|
|
5738
|
+
var POSITION_EDITS_RENDER_IIFE = '"use strict";(()=>{function P(){return globalThis}function T(e,t){if(typeof window>"u")return;let o=P(),r=o.__hf?.onSwallowed;if(r)try{r({label:e,error:t})}catch(s){}(o.__hfDebug||o.__HYPERFRAMES_DEBUG)&&console.debug(`[hyperframes] ${e} swallowed:`,t)}var x=null;function R(e,t){if(x)try{x({source:"hf-preview",type:"analytics",event:e,properties:t??{}})}catch(o){T("runtime.analytics.site1",o)}}var W="http://www.w3.org/1999/xhtml";function N(e){return e!=null&&e.nodeType===1}function k(e){return N(e)&&(e.namespaceURI===W||e.namespaceURI==="http://www.w3.org/2000/svg")}var w="data-hf-edit-base-x",y="data-hf-edit-base-y",m="data-hf-edit-original-translate",_=e=>{let t=parseFloat(e??"");return Number.isFinite(t)?t:0},C=e=>{let t=[],o=0,r="";for(let s of e.trim())s==="("&&(o+=1),s===")"&&(o=Math.max(0,o-1)),/\\s/.test(s)&&o===0?(r&&t.push(r),r=""):r+=s;return r&&t.push(r),t},L=/^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)px$/,E=(e,t)=>L.test(e)&&L.test(t)?`${parseFloat(e)+parseFloat(t)}px`:`calc(${e} + ${t})`,O=(e,t,o)=>{if(!e||e==="none")return`${t} ${o}`;let[r,s,a]=C(e);if(r===void 0)return`${t} ${o}`;if(s===void 0)return`${E(r,t)} ${o}`;let i=a===void 0?"":` ${a}`;return`${E(r,t)} ${E(s,o)}${i}`},V=e=>{try{e.ownerDocument.defaultView?.gsap?.getProperty?.(e,"x")}catch{}},j=e=>{let t=e.style.getPropertyValue("translate").trim();if(t)return t==="none"?"":t;try{let o=e.ownerDocument.defaultView,r=o?o.getComputedStyle(e).getPropertyValue("translate").trim():"";return r==="none"?"":r}catch{return""}},b=new WeakMap;function B(e,t){let o=b.get(e);if(!t?.force&&o!==void 0&&e.style.getPropertyValue("translate")!==o){R("position_edit_fold_skipped",{hfId:e.getAttribute("data-hf-id")});return}let r=_(e.getAttribute("data-x"))-_(e.getAttribute(w)),s=_(e.getAttribute("data-y"))-_(e.getAttribute(y));e.hasAttribute(m)||e.setAttribute(m,j(e)),o===void 0&&V(e);let a=e.getAttribute(m)??"",i=O(a,`${r}px`,`${s}px`);e.style.setProperty("translate",i),b.set(e,e.style.getPropertyValue("translate"))}function S(e,t){let o=e.querySelectorAll(`[${m}]:not([${w}]):not([${y}])`);for(let a=0;a<o.length;a++){let i=o[a];if(i===void 0||!k(i))continue;let g=i.getAttribute(m)??"";g===""?i.style.removeProperty("translate"):i.style.setProperty("translate",g),i.removeAttribute(m),b.delete(i)}let r=e.querySelectorAll(`[${w}], [${y}]`),s=0;for(let a=0;a<r.length;a++){let i=r[a];i===void 0||!k(i)||(B(i,t),s+=1)}return s}var $="__hfPositionEditsSeekReapplyWrapped",D=new WeakSet,F=new WeakMap,I=new WeakMap;function M(e){let t=e,o=()=>{try{S(t.document)}catch{}},r=n=>typeof n=="function"&&(D.has(n)||!!n[$]),s=n=>{D.add(n);try{Object.defineProperty(n,$,{value:!0})}catch{}},a=n=>{if(typeof n!="function"||r(n))return n;let l=function(...u){let d=n.apply(this,u);return o(),d};return s(l),l},i=(n,l)=>{let u=F.get(n);if(u?.has(l))return!0;let d=Object.getOwnPropertyDescriptor(n,l);if(d?.configurable===!1){let c=n[l];return typeof c=="function"&&(n[l]=a(c),o()),!1}let p=n[l],f=d?.set;return Object.defineProperty(n,l,{configurable:!0,enumerable:d?.enumerable??!0,get:()=>p,set:c=>{p=a(c),f?.call(n,c)}}),p=a(p),u??(u=new Set),u.add(l),F.set(n,u),o(),!0},g=(n,l)=>{let u=I.get(t),d=Object.getOwnPropertyDescriptor(t,n);if(!u?.has(n)){if(d?.configurable===!1){let c=t[n];return c?i(c,l):!1}let f=t[n];Object.defineProperty(t,n,{configurable:!0,enumerable:d?.enumerable??!0,get:()=>f,set:c=>{f=c,f&&i(f,l)}}),u??(u=new Set),u.add(n),I.set(t,u)}let p=t[n];return p?i(p,l):!1},h=()=>{let n=g("__hf","seek"),l=g("__player","renderSeek");return n&&l};if(h())return;let v=120,A=t.setInterval(()=>{if(h()){t.clearInterval(A);return}v-=1,v<=0&&t.clearInterval(A)},50)}function H(){document.querySelector(`[${w}], [${y}]`)&&(S(document),M(window))}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",H,{once:!0}):H();})();\n';
|
|
5494
5739
|
function getPositionEditsRenderScript() {
|
|
5495
5740
|
return POSITION_EDITS_RENDER_IIFE;
|
|
5496
5741
|
}
|
|
@@ -5803,10 +6048,6 @@ var THREE_D_CONTEXT_PATTERN = /transform-style\s*:\s*preserve-3d|backface-visibi
|
|
|
5803
6048
|
function detectThreeDTransformUsage(html) {
|
|
5804
6049
|
return THREE_D_CONTEXT_PATTERN.test(html);
|
|
5805
6050
|
}
|
|
5806
|
-
var MIX_BLEND_MODE_PATTERN = /mix-blend-mode\s*:/i;
|
|
5807
|
-
function detectMixBlendModeUsage(html) {
|
|
5808
|
-
return MIX_BLEND_MODE_PATTERN.test(html);
|
|
5809
|
-
}
|
|
5810
6051
|
var BACKGROUND_IMAGE_DECL_PATTERN = /(?:^|;|\{)\s*background(?:-image)?\s*:[^;}]*(?:\bgradient\s*\(|url\s*\()/i;
|
|
5811
6052
|
function detectAncestorBackgroundImage(html) {
|
|
5812
6053
|
const { document: document2 } = parseHTML(html);
|
|
@@ -5866,7 +6107,7 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, baseDir, down
|
|
|
5866
6107
|
}
|
|
5867
6108
|
} else {
|
|
5868
6109
|
filePath = decodedUrlPath(src);
|
|
5869
|
-
if (!filePath.startsWith("/")) filePath =
|
|
6110
|
+
if (!filePath.startsWith("/")) filePath = join13(baseDir, filePath);
|
|
5870
6111
|
filePath = urlByAbsentLocalPath?.get(filePath) ?? filePath;
|
|
5871
6112
|
}
|
|
5872
6113
|
if (!isHttpUrl(filePath) && !existsSync9(filePath)) {
|
|
@@ -6486,7 +6727,7 @@ async function localizeRemoteMediaSources(html, downloadDir) {
|
|
|
6486
6727
|
return downloadAndRewriteUrls(
|
|
6487
6728
|
urlSet,
|
|
6488
6729
|
html,
|
|
6489
|
-
|
|
6730
|
+
join13(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
6490
6731
|
"Remote media download failed",
|
|
6491
6732
|
"Localized remote media source(s)"
|
|
6492
6733
|
);
|
|
@@ -6501,7 +6742,7 @@ async function localizeRemoteImageSources(html, downloadDir) {
|
|
|
6501
6742
|
return downloadAndRewriteUrls(
|
|
6502
6743
|
urlSet,
|
|
6503
6744
|
html,
|
|
6504
|
-
|
|
6745
|
+
join13(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
6505
6746
|
"Remote image download failed",
|
|
6506
6747
|
"Localized remote image source(s)"
|
|
6507
6748
|
);
|
|
@@ -6517,7 +6758,7 @@ async function localizeRemoteBackgroundImages(html, downloadDir) {
|
|
|
6517
6758
|
return downloadAndRewriteUrls(
|
|
6518
6759
|
urlSet,
|
|
6519
6760
|
html,
|
|
6520
|
-
|
|
6761
|
+
join13(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
6521
6762
|
"Remote background-image download failed",
|
|
6522
6763
|
"Localized remote background-image(s)",
|
|
6523
6764
|
// Quoted url('..')/url("..") are rewritten by downloadAndRewriteUrls' default
|
|
@@ -6652,7 +6893,7 @@ async function localizeRemoteFontFaces(html, downloadDir) {
|
|
|
6652
6893
|
return downloadAndRewriteUrls(
|
|
6653
6894
|
urlSet,
|
|
6654
6895
|
processed,
|
|
6655
|
-
|
|
6896
|
+
join13(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
6656
6897
|
"Remote font download failed",
|
|
6657
6898
|
"Localized remote font face(s)",
|
|
6658
6899
|
(h, url, relPath) => h.replaceAll(`url(${url})`, `url("${relPath}")`)
|
|
@@ -6819,7 +7060,6 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
6819
7060
|
const renderModeHints = detectRenderModeHints(sanitizedHtml, options.pageMotionBlur);
|
|
6820
7061
|
const hasShaderTransitions = detectShaderTransitionUsage(sanitizedHtml);
|
|
6821
7062
|
const usesThreeDTransforms = detectThreeDTransformUsage(sanitizedHtml);
|
|
6822
|
-
const usesMixBlendMode = detectMixBlendModeUsage(sanitizedHtml);
|
|
6823
7063
|
const hasAncestorBackgroundImage = detectAncestorBackgroundImage(sanitizedHtml);
|
|
6824
7064
|
const normalizedFontHtml = normalizeSystemFontPrimaryFamilies(
|
|
6825
7065
|
injectTextRenderingRule(
|
|
@@ -6933,7 +7173,6 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
6933
7173
|
renderModeHints,
|
|
6934
7174
|
hasShaderTransitions,
|
|
6935
7175
|
usesThreeDTransforms,
|
|
6936
|
-
usesMixBlendMode,
|
|
6937
7176
|
hasAncestorBackgroundImage
|
|
6938
7177
|
};
|
|
6939
7178
|
}
|
|
@@ -7319,7 +7558,7 @@ async function runCompileStage(input) {
|
|
|
7319
7558
|
abortSignal
|
|
7320
7559
|
} = input;
|
|
7321
7560
|
const compileStart = Date.now();
|
|
7322
|
-
const compiled = await compileForRender(projectDir, htmlPath,
|
|
7561
|
+
const compiled = await compileForRender(projectDir, htmlPath, join14(workDir, "downloads"), {
|
|
7323
7562
|
log,
|
|
7324
7563
|
failClosedFontFetch: failClosedFontFetch === true,
|
|
7325
7564
|
allowSystemFontCapture,
|
|
@@ -7327,7 +7566,7 @@ async function runCompileStage(input) {
|
|
|
7327
7566
|
variables: input.variables,
|
|
7328
7567
|
urlByAbsentLocalPath: input.urlByAbsentLocalPath,
|
|
7329
7568
|
pageMotionBlur: input.pageMotionBlur,
|
|
7330
|
-
animatedGifCacheDir: cfg.extractCacheDir ?
|
|
7569
|
+
animatedGifCacheDir: cfg.extractCacheDir ? join14(cfg.extractCacheDir, "animated-gif") : void 0,
|
|
7331
7570
|
ffmpegProcessTimeout: cfg.ffmpegProcessTimeout
|
|
7332
7571
|
});
|
|
7333
7572
|
assertNotAborted();
|
|
@@ -7340,13 +7579,6 @@ async function runCompileStage(input) {
|
|
|
7340
7579
|
"[Render] Fast capture: composition uses a CSS 3D rendering context (perspective / preserve-3d / backface-visibility), so disabling drawElementImage for this render. Capture uses the platform's baseline route."
|
|
7341
7580
|
);
|
|
7342
7581
|
}
|
|
7343
|
-
if (cfg.useDrawElement && process.env.HF_FAST_CAPTURE_BLEND !== "true" && compiled.usesMixBlendMode) {
|
|
7344
|
-
cfg.useDrawElement = false;
|
|
7345
|
-
deCompileGate = "mix_blend_mode";
|
|
7346
|
-
log.info(
|
|
7347
|
-
"[Render] Fast capture: composition uses mix-blend-mode, so disabling drawElementImage for this render. Capture uses the platform's baseline route."
|
|
7348
|
-
);
|
|
7349
|
-
}
|
|
7350
7582
|
if (cfg.useDrawElement && process.env.HF_FAST_CAPTURE_ANCESTOR_BG !== "true" && compiled.hasAncestorBackgroundImage) {
|
|
7351
7583
|
cfg.useDrawElement = false;
|
|
7352
7584
|
deCompileGate = "ancestor_background_image";
|
|
@@ -7390,7 +7622,7 @@ async function runCompileStage(input) {
|
|
|
7390
7622
|
};
|
|
7391
7623
|
await preflightCompositionAssetMediaTypes({
|
|
7392
7624
|
projectDir,
|
|
7393
|
-
compiledDir:
|
|
7625
|
+
compiledDir: join14(workDir, "compiled"),
|
|
7394
7626
|
composition,
|
|
7395
7627
|
signal: abortSignal
|
|
7396
7628
|
});
|
|
@@ -7435,7 +7667,7 @@ async function runCompileStage(input) {
|
|
|
7435
7667
|
}
|
|
7436
7668
|
|
|
7437
7669
|
// ../producer/src/services/render/stages/probeStage.ts
|
|
7438
|
-
import { join as
|
|
7670
|
+
import { join as join15 } from "path";
|
|
7439
7671
|
|
|
7440
7672
|
// ../producer/src/services/render/stages/probeFailures.ts
|
|
7441
7673
|
var NETWORK_FAILURE_PATTERN = /404|ERR_NAME_NOT_RESOLVED|ERR_CONNECTION_REFUSED|net::ERR_/i;
|
|
@@ -7605,7 +7837,7 @@ async function runProbeStage(input) {
|
|
|
7605
7837
|
});
|
|
7606
7838
|
fileServer = await createFileServer({
|
|
7607
7839
|
projectDir,
|
|
7608
|
-
compiledDir:
|
|
7840
|
+
compiledDir: join15(workDir, "compiled"),
|
|
7609
7841
|
port: 0,
|
|
7610
7842
|
preHeadScripts: [VIRTUAL_TIME_SHIM],
|
|
7611
7843
|
fps: job.config.fps
|
|
@@ -7633,7 +7865,7 @@ async function runProbeStage(input) {
|
|
|
7633
7865
|
log.info("Creating capture session...", { attempt, maxAttempts: PROBE_MAX_ATTEMPTS });
|
|
7634
7866
|
probeSession = await createCaptureSession(
|
|
7635
7867
|
fileServer.url,
|
|
7636
|
-
|
|
7868
|
+
join15(workDir, "probe"),
|
|
7637
7869
|
captureOpts,
|
|
7638
7870
|
null,
|
|
7639
7871
|
probeCfg
|
|
@@ -7718,7 +7950,7 @@ async function runProbeStage(input) {
|
|
|
7718
7950
|
});
|
|
7719
7951
|
probeSession = await createCaptureSession(
|
|
7720
7952
|
fileServer.url,
|
|
7721
|
-
|
|
7953
|
+
join15(workDir, "probe-screenshot"),
|
|
7722
7954
|
captureOpts,
|
|
7723
7955
|
null,
|
|
7724
7956
|
{ ...probeCfg, forceScreenshot: true }
|
|
@@ -7754,7 +7986,7 @@ async function runProbeStage(input) {
|
|
|
7754
7986
|
compiled,
|
|
7755
7987
|
resolutions,
|
|
7756
7988
|
projectDir,
|
|
7757
|
-
|
|
7989
|
+
join15(workDir, "downloads")
|
|
7758
7990
|
);
|
|
7759
7991
|
assertNotAborted();
|
|
7760
7992
|
composition.videos = compiled.videos;
|
|
@@ -7945,7 +8177,7 @@ async function runProbeStage(input) {
|
|
|
7945
8177
|
}
|
|
7946
8178
|
await preflightCompositionAssetMediaTypes({
|
|
7947
8179
|
projectDir,
|
|
7948
|
-
compiledDir:
|
|
8180
|
+
compiledDir: join15(workDir, "compiled"),
|
|
7949
8181
|
composition,
|
|
7950
8182
|
signal: abortSignal
|
|
7951
8183
|
});
|
|
@@ -8101,7 +8333,7 @@ function validateDistributedDuration(input) {
|
|
|
8101
8333
|
|
|
8102
8334
|
// ../producer/src/services/render/stages/extractVideosStage.ts
|
|
8103
8335
|
import { existsSync as existsSync10 } from "fs";
|
|
8104
|
-
import { join as
|
|
8336
|
+
import { join as join16 } from "path";
|
|
8105
8337
|
|
|
8106
8338
|
// ../producer/src/services/render/extractionFailureMetadata.ts
|
|
8107
8339
|
function stringOrEmpty(value) {
|
|
@@ -8404,14 +8636,14 @@ async function runExtractVideosStage(input) {
|
|
|
8404
8636
|
// because short boundary counts can differ by one frame.
|
|
8405
8637
|
{
|
|
8406
8638
|
fps: job.config.fps,
|
|
8407
|
-
outputDir:
|
|
8639
|
+
outputDir: join16(compiledDir, "__hyperframes_video_frames"),
|
|
8408
8640
|
format: job.config.videoFrameFormat ?? "auto",
|
|
8409
8641
|
toneMapHdrToSdr: job.config.hdrMode === "force-sdr",
|
|
8410
8642
|
timelineEnd: composition.duration,
|
|
8411
8643
|
maxTransientRetries: extractionPolicy.maxTransientRetries,
|
|
8412
8644
|
collectProbeFailures: extractionPolicy.failureMode === "enforce",
|
|
8413
8645
|
deferRangeExtraction,
|
|
8414
|
-
contentKeyedDirs: [
|
|
8646
|
+
contentKeyedDirs: [join16(compiledDir, REMOTE_MEDIA_SUBDIR)],
|
|
8415
8647
|
urlByAbsentLocalPath
|
|
8416
8648
|
},
|
|
8417
8649
|
abortSignal,
|
|
@@ -8478,13 +8710,13 @@ function appendAutoDetectedVideoAudio(composition, extracted) {
|
|
|
8478
8710
|
}
|
|
8479
8711
|
|
|
8480
8712
|
// ../producer/src/services/render/stages/audioStage.ts
|
|
8481
|
-
import { join as
|
|
8482
|
-
import { rmSync as
|
|
8713
|
+
import { join as join18 } from "path";
|
|
8714
|
+
import { rmSync as rmSync8 } from "fs";
|
|
8483
8715
|
|
|
8484
8716
|
// ../producer/src/services/render/audioPadTrim.ts
|
|
8485
8717
|
import { spawn } from "child_process";
|
|
8486
|
-
import { mkdtempSync as mkdtempSync3, rmSync as
|
|
8487
|
-
import { dirname as dirname6, join as
|
|
8718
|
+
import { mkdtempSync as mkdtempSync3, rmSync as rmSync7 } from "fs";
|
|
8719
|
+
import { dirname as dirname6, join as join17 } from "path";
|
|
8488
8720
|
|
|
8489
8721
|
// ../producer/src/services/render/audioTruePeak.ts
|
|
8490
8722
|
var toDbfs = (token) => token.toLowerCase() === "-inf" ? Number.NEGATIVE_INFINITY : Number(token);
|
|
@@ -8669,7 +8901,7 @@ async function padOrTrimAudioToVideoFrameCount(input) {
|
|
|
8669
8901
|
error: `audioPadTrim: failed to materialize ${plan2.operation}: ${err instanceof Error ? err.message : String(err)}`
|
|
8670
8902
|
};
|
|
8671
8903
|
} finally {
|
|
8672
|
-
for (const path of plan2.cleanupPaths)
|
|
8904
|
+
for (const path of plan2.cleanupPaths) rmSync7(path, { force: true });
|
|
8673
8905
|
}
|
|
8674
8906
|
let loweredDb = 0;
|
|
8675
8907
|
if (probeTruePeak) {
|
|
@@ -8706,19 +8938,21 @@ async function constrainAacTruePeak(input) {
|
|
|
8706
8938
|
const timeoutMs = input.timeoutMs ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
|
|
8707
8939
|
return enforceAacTruePeak({
|
|
8708
8940
|
audioPath: input.audioPath,
|
|
8941
|
+
sourcePath: input.sourcePath,
|
|
8709
8942
|
targetDurationSeconds: input.targetDurationSeconds,
|
|
8710
8943
|
signal: input.signal,
|
|
8711
|
-
probeTruePeak: (audioPath, signal) => measureTruePeakDbfs(audioPath, { timeoutMs, signal }),
|
|
8712
|
-
encode: defaultAacEncoder(timeoutMs, input.signal, input.sourcePath)
|
|
8944
|
+
probeTruePeak: input.probeTruePeakDbfs ?? ((audioPath, signal) => measureTruePeakDbfs(audioPath, { timeoutMs, signal })),
|
|
8945
|
+
encode: input.encodeAac ?? defaultAacEncoder(timeoutMs, input.signal, input.sourcePath)
|
|
8713
8946
|
});
|
|
8714
8947
|
}
|
|
8715
8948
|
async function enforceAacTruePeak(input) {
|
|
8716
8949
|
let scratchDir;
|
|
8717
8950
|
try {
|
|
8718
|
-
scratchDir = mkdtempSync3(
|
|
8719
|
-
const correctedPath =
|
|
8951
|
+
scratchDir = mkdtempSync3(join17(dirname6(input.audioPath), ".true-peak-"));
|
|
8952
|
+
const correctedPath = join17(scratchDir, "audio.m4a");
|
|
8720
8953
|
const measurements = [];
|
|
8721
8954
|
let attenuationDb = 0;
|
|
8955
|
+
let sourcePeakDbfs;
|
|
8722
8956
|
let measuredPath = input.audioPath;
|
|
8723
8957
|
for (let pass = 0; pass <= MAX_TRUE_PEAK_CORRECTION_PASSES; pass += 1) {
|
|
8724
8958
|
const truePeakDbfs = await input.probeTruePeak(measuredPath, input.signal);
|
|
@@ -8735,7 +8969,11 @@ async function enforceAacTruePeak(input) {
|
|
|
8735
8969
|
}
|
|
8736
8970
|
if (pass === MAX_TRUE_PEAK_CORRECTION_PASSES) break;
|
|
8737
8971
|
const headroomDb = AAC_TRUE_PEAK_CORRECTION_HEADROOM_DB * 2 ** pass;
|
|
8738
|
-
|
|
8972
|
+
if (input.sourcePath && sourcePeakDbfs === void 0) {
|
|
8973
|
+
sourcePeakDbfs = await input.probeTruePeak(input.sourcePath, input.signal);
|
|
8974
|
+
}
|
|
8975
|
+
const referenceDbfs = Math.max(truePeakDbfs, (sourcePeakDbfs ?? -Infinity) + attenuationDb);
|
|
8976
|
+
attenuationDb += AAC_DELIVERY_TRUE_PEAK_DBFS - headroomDb - referenceDbfs;
|
|
8739
8977
|
const result = await input.encode(
|
|
8740
8978
|
input.audioPath,
|
|
8741
8979
|
correctedPath,
|
|
@@ -8767,7 +9005,7 @@ async function enforceAacTruePeak(input) {
|
|
|
8767
9005
|
)}`
|
|
8768
9006
|
};
|
|
8769
9007
|
} finally {
|
|
8770
|
-
if (scratchDir)
|
|
9008
|
+
if (scratchDir) rmSync7(scratchDir, { recursive: true, force: true });
|
|
8771
9009
|
}
|
|
8772
9010
|
}
|
|
8773
9011
|
function failResult(outputPath, target, source, error) {
|
|
@@ -8914,7 +9152,7 @@ function assertAudioNotInterrupted(failures) {
|
|
|
8914
9152
|
}
|
|
8915
9153
|
async function runAudioStage(input) {
|
|
8916
9154
|
const stageStart = Date.now();
|
|
8917
|
-
const pcmSourcePath =
|
|
9155
|
+
const pcmSourcePath = join18(input.workDir, "audio-source.wav");
|
|
8918
9156
|
const duration = input.totalFrames * input.fps.den / input.fps.num;
|
|
8919
9157
|
try {
|
|
8920
9158
|
const result = await mixAudioForDelivery(input, duration, pcmSourcePath);
|
|
@@ -8934,7 +9172,7 @@ async function runAudioStage(input) {
|
|
|
8934
9172
|
}
|
|
8935
9173
|
return { ...result, audioLoweredDb, audioProcessMs: Date.now() - stageStart };
|
|
8936
9174
|
} finally {
|
|
8937
|
-
|
|
9175
|
+
rmSync8(pcmSourcePath, { force: true });
|
|
8938
9176
|
}
|
|
8939
9177
|
}
|
|
8940
9178
|
async function mixAudioForDelivery(input, duration, pcmSourcePath) {
|
|
@@ -8952,7 +9190,7 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
|
|
|
8952
9190
|
assertNotAborted,
|
|
8953
9191
|
log
|
|
8954
9192
|
} = input;
|
|
8955
|
-
const audioOutputPath =
|
|
9193
|
+
const audioOutputPath = join18(workDir, MIXED_AUDIO_FILENAME);
|
|
8956
9194
|
let hasAudio = false;
|
|
8957
9195
|
let audioError;
|
|
8958
9196
|
let audioFailures;
|
|
@@ -8963,7 +9201,7 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
|
|
|
8963
9201
|
audioResult = await processCompositionAudio(
|
|
8964
9202
|
audios,
|
|
8965
9203
|
projectDir,
|
|
8966
|
-
|
|
9204
|
+
join18(workDir, "audio-work"),
|
|
8967
9205
|
audioOutputPath,
|
|
8968
9206
|
duration,
|
|
8969
9207
|
abortSignal,
|
|
@@ -9032,7 +9270,7 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
|
|
|
9032
9270
|
|
|
9033
9271
|
// ../producer/src/services/render/stages/captureStage.ts
|
|
9034
9272
|
import { existsSync as existsSync11, readdirSync as readdirSync3, statfsSync as statfsSync2 } from "fs";
|
|
9035
|
-
import { join as
|
|
9273
|
+
import { join as join19 } from "path";
|
|
9036
9274
|
function shouldAllowAdaptiveCaptureRetry(workerCount, _explicitlyConfigured) {
|
|
9037
9275
|
return workerCount > 1;
|
|
9038
9276
|
}
|
|
@@ -9091,13 +9329,13 @@ function measureCaptureFrameBytes(workDir, framesDir) {
|
|
|
9091
9329
|
if (!existsSync11(workDir)) return total;
|
|
9092
9330
|
for (const attempt of readdirSync3(workDir)) {
|
|
9093
9331
|
if (/^retry-\d+-batch-\d+-worker-\d+$/.test(attempt)) {
|
|
9094
|
-
total += sampleDirectoryBytes(
|
|
9332
|
+
total += sampleDirectoryBytes(join19(workDir, attempt));
|
|
9095
9333
|
continue;
|
|
9096
9334
|
}
|
|
9097
9335
|
if (!/^capture-attempt-\d+$/.test(attempt)) continue;
|
|
9098
|
-
const attemptDir =
|
|
9336
|
+
const attemptDir = join19(workDir, attempt);
|
|
9099
9337
|
for (const name of readdirSync3(attemptDir)) {
|
|
9100
|
-
if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(
|
|
9338
|
+
if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(join19(attemptDir, name));
|
|
9101
9339
|
}
|
|
9102
9340
|
}
|
|
9103
9341
|
return total;
|
|
@@ -9157,7 +9395,7 @@ async function runCaptureStage(input) {
|
|
|
9157
9395
|
);
|
|
9158
9396
|
}
|
|
9159
9397
|
}
|
|
9160
|
-
const captureOptions = buildCaptureOptions();
|
|
9398
|
+
const captureOptions = { ...buildCaptureOptions(), deFrameFallback: false };
|
|
9161
9399
|
const remedy = diskCaptureRemedy(cfg, job.config.format ?? "mp4", job.duration ?? 0, workerCount);
|
|
9162
9400
|
const checkDiskProjection = createDiskCaptureProjection({
|
|
9163
9401
|
framesDir,
|
|
@@ -9384,7 +9622,7 @@ async function captureSessionFrames(session, { input, rangeStart, rangeEnd, resu
|
|
|
9384
9622
|
|
|
9385
9623
|
// ../producer/src/services/render/stages/captureHdrStage.ts
|
|
9386
9624
|
import { existsSync as existsSync13, mkdirSync as mkdirSync6 } from "fs";
|
|
9387
|
-
import { join as
|
|
9625
|
+
import { join as join23 } from "path";
|
|
9388
9626
|
|
|
9389
9627
|
// ../producer/src/services/hdrImageTransferCache.ts
|
|
9390
9628
|
var DEFAULT_MAX_BYTES = 200 * 1024 * 1024;
|
|
@@ -9446,7 +9684,7 @@ function createHdrImageTransferCache(options = {}) {
|
|
|
9446
9684
|
}
|
|
9447
9685
|
|
|
9448
9686
|
// ../producer/src/services/render/stages/captureHdrSequentialLoop.ts
|
|
9449
|
-
import { join as
|
|
9687
|
+
import { join as join20 } from "path";
|
|
9450
9688
|
async function runSequentialLayeredFrameLoop(input) {
|
|
9451
9689
|
const {
|
|
9452
9690
|
job,
|
|
@@ -9567,7 +9805,7 @@ async function runSequentialLayeredFrameLoop(input) {
|
|
|
9567
9805
|
);
|
|
9568
9806
|
if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
|
|
9569
9807
|
writeFileExclusiveSync(
|
|
9570
|
-
|
|
9808
|
+
join20(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
|
|
9571
9809
|
normalCanvas
|
|
9572
9810
|
);
|
|
9573
9811
|
}
|
|
@@ -9599,12 +9837,12 @@ async function runSequentialLayeredFrameLoop(input) {
|
|
|
9599
9837
|
}
|
|
9600
9838
|
|
|
9601
9839
|
// ../producer/src/services/render/stages/captureHdrHybridLoop.ts
|
|
9602
|
-
import { join as
|
|
9840
|
+
import { join as join22 } from "path";
|
|
9603
9841
|
|
|
9604
9842
|
// ../producer/src/services/shaderTransitionWorkerPool.ts
|
|
9605
9843
|
import { Worker } from "worker_threads";
|
|
9606
9844
|
import { fileURLToPath as fileURLToPath3, pathToFileURL } from "url";
|
|
9607
|
-
import { dirname as dirname7, join as
|
|
9845
|
+
import { dirname as dirname7, join as join21 } from "path";
|
|
9608
9846
|
import { createRequire } from "module";
|
|
9609
9847
|
import { existsSync as existsSync12 } from "fs";
|
|
9610
9848
|
import { cpus as cpus2 } from "os";
|
|
@@ -9618,9 +9856,9 @@ function resolveWorkerEntry(explicit) {
|
|
|
9618
9856
|
return { path: override, isTs };
|
|
9619
9857
|
}
|
|
9620
9858
|
const moduleDir = dirname7(fileURLToPath3(import.meta.url));
|
|
9621
|
-
const jsPath =
|
|
9859
|
+
const jsPath = join21(moduleDir, "shaderTransitionWorker.js");
|
|
9622
9860
|
if (existsSync12(jsPath)) return { path: jsPath, isTs: false };
|
|
9623
|
-
const tsPath =
|
|
9861
|
+
const tsPath = join21(moduleDir, "shaderTransitionWorker.ts");
|
|
9624
9862
|
return { path: tsPath, isTs: true };
|
|
9625
9863
|
}
|
|
9626
9864
|
function buildExecArgv(entryIsTs) {
|
|
@@ -9988,7 +10226,7 @@ async function runHybridLayeredFrameLoop(input) {
|
|
|
9988
10226
|
);
|
|
9989
10227
|
if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
|
|
9990
10228
|
writeFileExclusiveSync(
|
|
9991
|
-
|
|
10229
|
+
join22(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
|
|
9992
10230
|
canvas
|
|
9993
10231
|
);
|
|
9994
10232
|
}
|
|
@@ -10157,7 +10395,8 @@ async function runCaptureHdrStage(input) {
|
|
|
10157
10395
|
width,
|
|
10158
10396
|
height,
|
|
10159
10397
|
abortSignal,
|
|
10160
|
-
hdrDiagnostics
|
|
10398
|
+
hdrDiagnostics,
|
|
10399
|
+
maxResidentWindows: Math.max(1, workerCount) + 1
|
|
10161
10400
|
});
|
|
10162
10401
|
releaseHdrExtractionReservation = extracted.releaseReservation;
|
|
10163
10402
|
for (const [id, source] of extracted.sources) hdrVideoFrameSources.set(id, source);
|
|
@@ -10175,7 +10414,7 @@ async function runCaptureHdrStage(input) {
|
|
|
10175
10414
|
if (hdrVideoFrameSources.has(v.id)) hdrVideoEndTimes.set(v.id, v.end);
|
|
10176
10415
|
}
|
|
10177
10416
|
const debugDumpEnabled = process.env.KEEP_TEMP === "1";
|
|
10178
|
-
const debugDumpDir = debugDumpEnabled ?
|
|
10417
|
+
const debugDumpDir = debugDumpEnabled ? join23(framesDir, "debug-composite") : null;
|
|
10179
10418
|
if (debugDumpDir && !existsSync13(debugDumpDir)) {
|
|
10180
10419
|
mkdirSync6(debugDumpDir, { recursive: true });
|
|
10181
10420
|
}
|
|
@@ -10335,12 +10574,12 @@ import {
|
|
|
10335
10574
|
mkdirSync as mkdirSync7,
|
|
10336
10575
|
readdirSync as readdirSync4,
|
|
10337
10576
|
readFileSync as readFileSync6,
|
|
10338
|
-
rmSync as
|
|
10339
|
-
statSync as
|
|
10577
|
+
rmSync as rmSync9,
|
|
10578
|
+
statSync as statSync5,
|
|
10340
10579
|
writeFileSync as writeFileSync4
|
|
10341
10580
|
} from "fs";
|
|
10342
10581
|
import { readFile as readFile2 } from "fs/promises";
|
|
10343
|
-
import { dirname as dirname8, join as
|
|
10582
|
+
import { dirname as dirname8, join as join24 } from "path";
|
|
10344
10583
|
|
|
10345
10584
|
// ../producer/src/services/render/stages/gifEncodeArgs.ts
|
|
10346
10585
|
function fpsToFfmpegArg2(fps) {
|
|
@@ -10450,7 +10689,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
|
|
|
10450
10689
|
const failure = await reencodeWithClearedWholeFrames(argsInput, run, startTime);
|
|
10451
10690
|
if (failure) return failure;
|
|
10452
10691
|
}
|
|
10453
|
-
const fileSize = existsSync14(outputPath) ?
|
|
10692
|
+
const fileSize = existsSync14(outputPath) ? statSync5(outputPath).size : 0;
|
|
10454
10693
|
return {
|
|
10455
10694
|
success: true,
|
|
10456
10695
|
outputPath,
|
|
@@ -10459,7 +10698,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
|
|
|
10459
10698
|
fileSize
|
|
10460
10699
|
};
|
|
10461
10700
|
} finally {
|
|
10462
|
-
|
|
10701
|
+
rmSync9(input.palettePath, { force: true });
|
|
10463
10702
|
}
|
|
10464
10703
|
}
|
|
10465
10704
|
function startEncodeProgress(job, stage, onProgress) {
|
|
@@ -10534,7 +10773,7 @@ function encodeWhileCapturing(input, totalFrames) {
|
|
|
10534
10773
|
await new Promise((resolve11) => wake = resolve11);
|
|
10535
10774
|
}
|
|
10536
10775
|
if (signal.aborted) return;
|
|
10537
|
-
const mergedPath =
|
|
10776
|
+
const mergedPath = join24(input.framesDir, formatCaptureFrameName(next, "jpg"));
|
|
10538
10777
|
const frame = await readLandedFrame(landed.get(next), mergedPath);
|
|
10539
10778
|
landed.delete(next);
|
|
10540
10779
|
if (!await stream.writeFrame(frame)) {
|
|
@@ -10617,11 +10856,11 @@ async function runEncodeStage(input) {
|
|
|
10617
10856
|
);
|
|
10618
10857
|
}
|
|
10619
10858
|
captured.forEach((name, i) => {
|
|
10620
|
-
const dst =
|
|
10621
|
-
copyFileSync2(
|
|
10859
|
+
const dst = join24(outputPath, formatExportFrameName(i, "png"));
|
|
10860
|
+
copyFileSync2(join24(framesDir, name), dst);
|
|
10622
10861
|
});
|
|
10623
10862
|
if (hasAudio && audioOutputPath && existsSync14(audioOutputPath)) {
|
|
10624
|
-
copyFileSync2(audioOutputPath,
|
|
10863
|
+
copyFileSync2(audioOutputPath, join24(outputPath, MIXED_AUDIO_FILENAME));
|
|
10625
10864
|
log.info(
|
|
10626
10865
|
`[Render] png-sequence: ${MIXED_AUDIO_FILENAME} sidecar written to ${outputPath}/${MIXED_AUDIO_FILENAME}`
|
|
10627
10866
|
);
|
|
@@ -10641,7 +10880,7 @@ async function runEncodeStage(input) {
|
|
|
10641
10880
|
const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
|
|
10642
10881
|
fps: job.config.fps,
|
|
10643
10882
|
loop,
|
|
10644
|
-
palettePath:
|
|
10883
|
+
palettePath: join24(dirname8(videoOnlyPath), "gif-palette.png"),
|
|
10645
10884
|
preserveAlpha: needsAlpha,
|
|
10646
10885
|
signal: abortSignal,
|
|
10647
10886
|
timeout: engineCfg.ffmpegEncodeTimeout
|
|
@@ -10853,9 +11092,9 @@ function sampleDirectoryBytes(dir) {
|
|
|
10853
11092
|
continue;
|
|
10854
11093
|
}
|
|
10855
11094
|
for (const name of entries) {
|
|
10856
|
-
const full =
|
|
11095
|
+
const full = join25(current, name);
|
|
10857
11096
|
try {
|
|
10858
|
-
const st =
|
|
11097
|
+
const st = statSync6(full);
|
|
10859
11098
|
if (st.isDirectory()) {
|
|
10860
11099
|
stack.push(full);
|
|
10861
11100
|
} else if (st.isFile()) {
|
|
@@ -11002,8 +11241,8 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
|
|
|
11002
11241
|
const ranges = [];
|
|
11003
11242
|
let rangeStart = null;
|
|
11004
11243
|
for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
|
|
11005
|
-
const framePath =
|
|
11006
|
-
const missing = !existsSync15(framePath) ||
|
|
11244
|
+
const framePath = join25(framesDir, formatCaptureFrameName(frameIndex, frameExt));
|
|
11245
|
+
const missing = !existsSync15(framePath) || statSync6(framePath).size <= 8;
|
|
11007
11246
|
if (missing && rangeStart === null) {
|
|
11008
11247
|
rangeStart = frameIndex;
|
|
11009
11248
|
} else if (!missing && rangeStart !== null) {
|
|
@@ -11025,7 +11264,7 @@ function buildMissingFrameRetryBatches(ranges, maxWorkers, workDir, attempt, ran
|
|
|
11025
11264
|
workerId,
|
|
11026
11265
|
startFrame: rangeStart + range.startFrame,
|
|
11027
11266
|
endFrame: rangeStart + range.endFrame,
|
|
11028
|
-
outputDir:
|
|
11267
|
+
outputDir: join25(workDir, `retry-${attempt}-batch-${batchIndex}-worker-${workerId}`),
|
|
11029
11268
|
outputFrameOffset: rangeStart
|
|
11030
11269
|
}));
|
|
11031
11270
|
batches.push(batch);
|
|
@@ -11053,8 +11292,8 @@ function getNextRetryWorkerCount(currentWorkers) {
|
|
|
11053
11292
|
return Math.max(1, Math.floor(currentWorkers / 2));
|
|
11054
11293
|
}
|
|
11055
11294
|
function resolveRenderWorkDirPrefix(outputPath, jobId, platform2 = process.platform, systemTempDir = tmpdir2()) {
|
|
11056
|
-
if (platform2 === "win32" || platform2 === "darwin") return
|
|
11057
|
-
return
|
|
11295
|
+
if (platform2 === "win32" || platform2 === "darwin") return join25(systemTempDir, "hf-render-");
|
|
11296
|
+
return join25(dirname9(outputPath), `work-${jobId}-`);
|
|
11058
11297
|
}
|
|
11059
11298
|
var MAX_TRANSIENT_CAPTURE_RETRIES = 1;
|
|
11060
11299
|
function isTransientCaptureRetryEligible(failureKind, missing, retriesUsed) {
|
|
@@ -11086,7 +11325,7 @@ The composition is too large for the available memory. To reduce memory pressure
|
|
|
11086
11325
|
function countCapturedFrames(totalFrames, framesDir, frameExt) {
|
|
11087
11326
|
let captured = 0;
|
|
11088
11327
|
for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
|
|
11089
|
-
const framePath =
|
|
11328
|
+
const framePath = join25(framesDir, formatCaptureFrameName(frameIndex, frameExt));
|
|
11090
11329
|
if (existsSync15(framePath)) captured++;
|
|
11091
11330
|
}
|
|
11092
11331
|
return captured;
|
|
@@ -11112,7 +11351,7 @@ async function executeDiskCaptureWithAdaptiveRetry(options) {
|
|
|
11112
11351
|
reason: attempt === 0 ? "initial" : pendingTransientRetry ? "transient-retry" : "retry"
|
|
11113
11352
|
});
|
|
11114
11353
|
pendingTransientRetry = false;
|
|
11115
|
-
const attemptWorkDir =
|
|
11354
|
+
const attemptWorkDir = join25(options.workDir, `capture-attempt-${attempt}`);
|
|
11116
11355
|
const batches = missingRanges ? buildMissingFrameRetryBatches(
|
|
11117
11356
|
missingRanges,
|
|
11118
11357
|
currentWorkers,
|
|
@@ -11569,7 +11808,10 @@ function resolveDeShortBand(args) {
|
|
|
11569
11808
|
return args.bandOpen ? "applied" : "skipped_elements";
|
|
11570
11809
|
}
|
|
11571
11810
|
function shouldPreferSingleWorkerDrawElement(args) {
|
|
11572
|
-
return args.workerCount > 1 &&
|
|
11811
|
+
return args.workerCount > 1 && args.useDrawElement && !args.deCompileGate && !args.forceScreenshot && outputUsesH264Pipeline(args.outputFormat) && args.minFrames > 0 && args.totalFrames >= args.minFrames && args.singleWorkerStreamingOk && !args.layeredOrEffectRoute && !args.supersampling && !args.probeDeGated && !args.experimentalParallelDeOptIn;
|
|
11812
|
+
}
|
|
11813
|
+
function probeNeedsScreenshotFrames(session) {
|
|
11814
|
+
return (session?.deRiskFrames?.size ?? 0) > 0;
|
|
11573
11815
|
}
|
|
11574
11816
|
function isProbeDeGated(session) {
|
|
11575
11817
|
return session !== null && session.captureMode !== "drawelement" && !session.deInitDeferred;
|
|
@@ -11705,17 +11947,17 @@ function deVerifyFallbackTelemetry(err) {
|
|
|
11705
11947
|
}
|
|
11706
11948
|
function resolveRenderDebugDir() {
|
|
11707
11949
|
const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve6(process.env.PRODUCER_RENDERS_DIR, "..") : resolve6(dirname9(fileURLToPath4(import.meta.url)), "../..");
|
|
11708
|
-
return
|
|
11950
|
+
return join25(producerRoot, ".debug");
|
|
11709
11951
|
}
|
|
11710
11952
|
async function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
|
|
11711
11953
|
validateHlsRenderConfig(job.config);
|
|
11712
11954
|
const debugDir = resolveRenderDebugDir();
|
|
11713
11955
|
const outputDir = dirname9(outputPath);
|
|
11714
11956
|
if (!existsSync15(outputDir)) mkdirSync8(outputDir, { recursive: true });
|
|
11715
|
-
const workDir = job.config.debug ?
|
|
11957
|
+
const workDir = job.config.debug ? join25(debugDir, job.id) : createRenderWorkDir(resolveRenderWorkDirPrefix(outputPath, job.id), outputDir);
|
|
11716
11958
|
const pipelineStart = Date.now();
|
|
11717
11959
|
const baseLog = job.config.logger ?? defaultLogger;
|
|
11718
|
-
const logPath = job.config.debug ?
|
|
11960
|
+
const logPath = job.config.debug ? join25(workDir, "render.log") : null;
|
|
11719
11961
|
const execution = new RenderExecutionContext({
|
|
11720
11962
|
request: { renderJobId: job.id, projectDir, outputPath },
|
|
11721
11963
|
logger: logPath ? createRenderFileLogger(logPath, baseLog) : baseLog,
|
|
@@ -11729,7 +11971,7 @@ async function executeRenderJob(job, projectDir, outputPath, progressSink, abort
|
|
|
11729
11971
|
log.info("KEEP_TEMP=1, leaving workDir on disk for inspection", { workDir });
|
|
11730
11972
|
return;
|
|
11731
11973
|
}
|
|
11732
|
-
|
|
11974
|
+
rmSync10(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
11733
11975
|
});
|
|
11734
11976
|
try {
|
|
11735
11977
|
await executeRenderPipeline({
|
|
@@ -11760,7 +12002,9 @@ async function executeRenderPipeline(input) {
|
|
|
11760
12002
|
const log = execution.logger;
|
|
11761
12003
|
const eventPublisher = execution.events;
|
|
11762
12004
|
const onProgress = execution.onProgress;
|
|
11763
|
-
const
|
|
12005
|
+
const tooSlow = new AbortController();
|
|
12006
|
+
let tooSlowError;
|
|
12007
|
+
const executionSignal = job.config.maxRenderMs ? AbortSignal.any([tooSlow.signal, ...execution.signal ? [execution.signal] : []]) : execution.signal;
|
|
11764
12008
|
let fileServer = null;
|
|
11765
12009
|
let probeSession = null;
|
|
11766
12010
|
let lastBrowserConsole = [];
|
|
@@ -11773,7 +12017,7 @@ async function executeRenderPipeline(input) {
|
|
|
11773
12017
|
imageDecodeFailures: 0
|
|
11774
12018
|
};
|
|
11775
12019
|
let hdrPerf;
|
|
11776
|
-
const perfOutputPath =
|
|
12020
|
+
const perfOutputPath = join25(workDir, "perf-summary.json");
|
|
11777
12021
|
const cfg = { ...job.config.producerConfig ?? resolveConfig() };
|
|
11778
12022
|
const observability = new RenderObservabilityRecorder({
|
|
11779
12023
|
pipelineStartMs: pipelineStart,
|
|
@@ -11875,15 +12119,15 @@ async function executeRenderPipeline(input) {
|
|
|
11875
12119
|
requestedWorkers: job.config.workers ?? "auto"
|
|
11876
12120
|
});
|
|
11877
12121
|
const entryFile = job.config.entryFile || "index.html";
|
|
11878
|
-
let htmlPath =
|
|
12122
|
+
let htmlPath = join25(projectDir, entryFile);
|
|
11879
12123
|
if (!existsSync15(htmlPath)) {
|
|
11880
12124
|
throw new Error(`Entry file not found: ${htmlPath}`);
|
|
11881
12125
|
}
|
|
11882
12126
|
assertNotAborted();
|
|
11883
12127
|
const rawEntry = readFileSync7(htmlPath, "utf-8");
|
|
11884
12128
|
if (entryFile !== "index.html" && isTemplateEntry(rawEntry)) {
|
|
11885
|
-
const wrapperPath =
|
|
11886
|
-
const projectIndexPath =
|
|
12129
|
+
const wrapperPath = join25(workDir, "standalone-entry.html");
|
|
12130
|
+
const projectIndexPath = join25(projectDir, "index.html");
|
|
11887
12131
|
if (!existsSync15(projectIndexPath)) {
|
|
11888
12132
|
throw new Error(
|
|
11889
12133
|
`Template entry file "${entryFile}" requires a project index.html to extract its render shell.`
|
|
@@ -12046,7 +12290,7 @@ async function executeRenderPipeline(input) {
|
|
|
12046
12290
|
updateJobStatus(job, "preprocessing", "Extracting video frames", 10, onProgress, {
|
|
12047
12291
|
code: "extract_video"
|
|
12048
12292
|
});
|
|
12049
|
-
const compiledDir =
|
|
12293
|
+
const compiledDir = join25(workDir, "compiled");
|
|
12050
12294
|
const extractResult = await observeRenderStage(
|
|
12051
12295
|
observability,
|
|
12052
12296
|
"video_extract",
|
|
@@ -12180,7 +12424,7 @@ async function executeRenderPipeline(input) {
|
|
|
12180
12424
|
try {
|
|
12181
12425
|
fileServer = await createFileServer({
|
|
12182
12426
|
projectDir,
|
|
12183
|
-
compiledDir:
|
|
12427
|
+
compiledDir: join25(workDir, "compiled"),
|
|
12184
12428
|
port: 0,
|
|
12185
12429
|
preHeadScripts: [VIRTUAL_TIME_SHIM],
|
|
12186
12430
|
fps: job.config.fps
|
|
@@ -12198,7 +12442,7 @@ async function executeRenderPipeline(input) {
|
|
|
12198
12442
|
if (!activeFileServer) {
|
|
12199
12443
|
throw new Error("File server failed to initialize before frame capture");
|
|
12200
12444
|
}
|
|
12201
|
-
const framesDir =
|
|
12445
|
+
const framesDir = join25(workDir, "captured-frames");
|
|
12202
12446
|
if (!existsSync15(framesDir)) mkdirSync8(framesDir, { recursive: true });
|
|
12203
12447
|
updateJobStatus(job, "rendering", "Checking browser GPU", 25, onProgress, {
|
|
12204
12448
|
code: "start_browsers"
|
|
@@ -12247,6 +12491,7 @@ async function executeRenderPipeline(input) {
|
|
|
12247
12491
|
// Probe-resolved duration: drawElement self-verification derives its
|
|
12248
12492
|
// sample frame indices from this so they land inside the drained range.
|
|
12249
12493
|
compositionDurationSeconds: job.duration,
|
|
12494
|
+
deFrameFallback: true,
|
|
12250
12495
|
requiresWebGpu: compositionRequiresWebGpu(compiled.html),
|
|
12251
12496
|
// Live route for Chrome memory (spec §5 Phase −1). The aggregate route
|
|
12252
12497
|
// through CapturePerfSummary only exists on success; a mid-capture
|
|
@@ -12302,7 +12547,6 @@ async function executeRenderPipeline(input) {
|
|
|
12302
12547
|
const WOULD_RESOLVE_MULTI_WORKER = 2;
|
|
12303
12548
|
const deInversionArgs = {
|
|
12304
12549
|
workerCount: WOULD_RESOLVE_MULTI_WORKER,
|
|
12305
|
-
requestedWorkers: job.config.workers,
|
|
12306
12550
|
useDrawElement: cfg.useDrawElement,
|
|
12307
12551
|
deCompileGate,
|
|
12308
12552
|
forceScreenshot: captureForceScreenshot,
|
|
@@ -12348,7 +12592,7 @@ async function executeRenderPipeline(input) {
|
|
|
12348
12592
|
minFrames: deParallelMinFrames,
|
|
12349
12593
|
layeredOrEffectRoute: hasHdrContent || compiled.hasShaderTransitions,
|
|
12350
12594
|
supersampling: deviceScaleFactor !== 1,
|
|
12351
|
-
probeDeGated: isProbeDeGated(probeSession),
|
|
12595
|
+
probeDeGated: isProbeDeGated(probeSession) || probeNeedsScreenshotFrames(probeSession),
|
|
12352
12596
|
experimentalParallelDeOptIn: process.env.PRODUCER_EXPERIMENTAL_FAST_CAPTURE === "true" || process.env.HF_DE_PARALLEL_STREAM === "true",
|
|
12353
12597
|
routerEnabled: deParallelRouterEnabled,
|
|
12354
12598
|
// Router pins 3 workers for the streaming path; don't pin when a
|
|
@@ -12390,6 +12634,8 @@ async function executeRenderPipeline(input) {
|
|
|
12390
12634
|
deInversionEligible = false;
|
|
12391
12635
|
deParallelRouterEligible = false;
|
|
12392
12636
|
deShortBand = void 0;
|
|
12637
|
+
} else if (probeNeedsScreenshotFrames(probeSession)) {
|
|
12638
|
+
deParallelRouterEligible = false;
|
|
12393
12639
|
}
|
|
12394
12640
|
}
|
|
12395
12641
|
const deProbeGateReason = isProbeDeGated(probeSession) ? probeSession.deGateReason : void 0;
|
|
@@ -12508,7 +12754,7 @@ async function executeRenderPipeline(input) {
|
|
|
12508
12754
|
} else if (deInversionEligible && workerCount > 1) {
|
|
12509
12755
|
deWorkerInversion = "inverted";
|
|
12510
12756
|
log.info(
|
|
12511
|
-
`[Render] Fast capture: single-worker drawElement streaming preferred over ${workerCount}-worker screenshot capture (${totalFrames} frames >= ${deInversionEffectiveMinFrames}; verified path, measured faster at every worker count). Set HF_DE_SINGLE_MIN_FRAMES=0
|
|
12757
|
+
`[Render] Fast capture: single-worker drawElement streaming preferred over ${workerCount}-worker screenshot capture (${totalFrames} frames >= ${deInversionEffectiveMinFrames}; verified path, measured faster at every worker count). Set HF_DE_SINGLE_MIN_FRAMES=0 to override.`
|
|
12512
12758
|
);
|
|
12513
12759
|
workerCount = 1;
|
|
12514
12760
|
}
|
|
@@ -12552,6 +12798,27 @@ async function executeRenderPipeline(input) {
|
|
|
12552
12798
|
deWorkerInversion: deWorkerInversion ?? "none",
|
|
12553
12799
|
deParallelRouter: deParallelRouter ?? "none"
|
|
12554
12800
|
});
|
|
12801
|
+
const calibratedTooSlow = checkRenderEta("capture_calibration", {
|
|
12802
|
+
maxRenderMs: job.config.maxRenderMs,
|
|
12803
|
+
elapsedMs: Date.now() - pipelineStart,
|
|
12804
|
+
framesCompleted: 0,
|
|
12805
|
+
totalFrames,
|
|
12806
|
+
msPerFrame: (captureCalibration?.estimate.p95Ms ?? 0) / workerCount
|
|
12807
|
+
});
|
|
12808
|
+
if (calibratedTooSlow) throw calibratedTooSlow;
|
|
12809
|
+
execution.defer(
|
|
12810
|
+
"stop render ETA guard",
|
|
12811
|
+
startRenderEtaGuard({
|
|
12812
|
+
maxRenderMs: job.config.maxRenderMs,
|
|
12813
|
+
job,
|
|
12814
|
+
totalFrames,
|
|
12815
|
+
pipelineStartMs: pipelineStart,
|
|
12816
|
+
onTooSlow: (error) => {
|
|
12817
|
+
tooSlowError = error;
|
|
12818
|
+
tooSlow.abort(error);
|
|
12819
|
+
}
|
|
12820
|
+
})
|
|
12821
|
+
);
|
|
12555
12822
|
let useStreamingEncode = shouldUseStreamingEncode(
|
|
12556
12823
|
cfg,
|
|
12557
12824
|
outputFormat,
|
|
@@ -12560,7 +12827,8 @@ async function executeRenderPipeline(input) {
|
|
|
12560
12827
|
deParallelStreamForced
|
|
12561
12828
|
);
|
|
12562
12829
|
const deParallelStreamVerified = (deParallelStreamForced || process.env.HF_DE_PARALLEL_STREAM === "true") && useStreamingEncode && workerCount > 1;
|
|
12563
|
-
|
|
12830
|
+
const routeDropsScreenshotFrames = cfg.useDrawElement && probeNeedsScreenshotFrames(probeSession) && (!useStreamingEncode || workerCount !== 1);
|
|
12831
|
+
if (routeDropsScreenshotFrames || shouldClampDefaultDrawElement({
|
|
12564
12832
|
useDrawElement: cfg.useDrawElement,
|
|
12565
12833
|
fastCaptureExplicitOptIn: process.env.PRODUCER_EXPERIMENTAL_FAST_CAPTURE === "true",
|
|
12566
12834
|
useStreamingEncode,
|
|
@@ -12645,7 +12913,7 @@ async function executeRenderPipeline(input) {
|
|
|
12645
12913
|
hls: ".mp4"
|
|
12646
12914
|
};
|
|
12647
12915
|
const videoExt = FORMAT_EXT[outputFormat] ?? ".mp4";
|
|
12648
|
-
const videoOnlyPath =
|
|
12916
|
+
const videoOnlyPath = join25(workDir, `video-only${videoExt}`);
|
|
12649
12917
|
const usePageSideCompositingForTransitions = (cfg.enablePageSideCompositing || isGif) && compiled.hasShaderTransitions && !hasHdrContent && outputSupportsPageSideShaderCompositing(outputFormat);
|
|
12650
12918
|
if (usePageSideCompositingForTransitions) {
|
|
12651
12919
|
activeFileServer.addPreHeadScript(HF_PAGE_SIDE_COMPOSITING_STUB);
|
|
@@ -12891,7 +13159,7 @@ async function executeRenderPipeline(input) {
|
|
|
12891
13159
|
pageMotionBlur: job.config.pageMotionBlur,
|
|
12892
13160
|
captureQuality: captureOptions.quality
|
|
12893
13161
|
});
|
|
12894
|
-
const segmentDir = segmentDirFor(
|
|
13162
|
+
const segmentDir = segmentDirFor(join25(projectDir, "renders"), segmentPlanHash);
|
|
12895
13163
|
let completedSegments = /* @__PURE__ */ new Set();
|
|
12896
13164
|
if (job.config.resumeSegments === true) {
|
|
12897
13165
|
const existing = readSegmentManifest(segmentDir);
|
|
@@ -12906,10 +13174,10 @@ async function executeRenderPipeline(input) {
|
|
|
12906
13174
|
});
|
|
12907
13175
|
}
|
|
12908
13176
|
if (completedSegments.size === 0) {
|
|
12909
|
-
|
|
13177
|
+
rmSync10(segmentDir, { recursive: true, force: true });
|
|
12910
13178
|
}
|
|
12911
13179
|
} else {
|
|
12912
|
-
|
|
13180
|
+
rmSync10(segmentDir, { recursive: true, force: true });
|
|
12913
13181
|
}
|
|
12914
13182
|
const segmentManifest = readSegmentManifest(segmentDir) ?? {
|
|
12915
13183
|
version: 1,
|
|
@@ -12990,7 +13258,7 @@ async function executeRenderPipeline(input) {
|
|
|
12990
13258
|
);
|
|
12991
13259
|
updateCaptureObservability({ segmentRetries: segmentedRes.segmentRetries });
|
|
12992
13260
|
if (job.config.keepSegments !== true) {
|
|
12993
|
-
|
|
13261
|
+
rmSync10(segmentDir, { recursive: true, force: true });
|
|
12994
13262
|
}
|
|
12995
13263
|
} else {
|
|
12996
13264
|
capturePlan = replanAfterFailure(capturePlan, { kind: "streaming_unavailable" });
|
|
@@ -13259,7 +13527,7 @@ async function executeRenderPipeline(input) {
|
|
|
13259
13527
|
"capture_disk",
|
|
13260
13528
|
"drawElement capture failed; retrying with a fresh screenshot session"
|
|
13261
13529
|
);
|
|
13262
|
-
|
|
13530
|
+
rmSync10(framesDir, { recursive: true, force: true });
|
|
13263
13531
|
mkdirSync8(framesDir, { recursive: true });
|
|
13264
13532
|
resetCaptureAttemptProgress(job);
|
|
13265
13533
|
dedupPerfs.length = 0;
|
|
@@ -13446,7 +13714,7 @@ async function executeRenderPipeline(input) {
|
|
|
13446
13714
|
}
|
|
13447
13715
|
if (job.config.debug) {
|
|
13448
13716
|
if (!isPngSequence && !isHls && existsSync15(stagedOutputPath)) {
|
|
13449
|
-
const debugOutput =
|
|
13717
|
+
const debugOutput = join25(workDir, `output${videoExt}`);
|
|
13450
13718
|
copyFileSync3(stagedOutputPath, debugOutput);
|
|
13451
13719
|
}
|
|
13452
13720
|
}
|
|
@@ -13457,8 +13725,9 @@ async function executeRenderPipeline(input) {
|
|
|
13457
13725
|
job.outputPath = outputPath;
|
|
13458
13726
|
updateJobStatus(job, "complete", "Render complete", 100, onProgress);
|
|
13459
13727
|
await eventPublisher.flush();
|
|
13460
|
-
} catch (
|
|
13461
|
-
|
|
13728
|
+
} catch (caught) {
|
|
13729
|
+
const error = tooSlowError ?? caught;
|
|
13730
|
+
if (!tooSlowError && (error instanceof RenderCancelledError || executionSignal?.aborted)) {
|
|
13462
13731
|
job.error = error instanceof Error ? error.message : "render_cancelled";
|
|
13463
13732
|
updateJobStatus(job, "cancelled", "Render cancelled", job.progress, onProgress);
|
|
13464
13733
|
await eventPublisher.flush();
|
|
@@ -13555,21 +13824,21 @@ import {
|
|
|
13555
13824
|
existsSync as existsSync20,
|
|
13556
13825
|
linkSync,
|
|
13557
13826
|
mkdirSync as mkdirSync12,
|
|
13558
|
-
rmSync as
|
|
13827
|
+
rmSync as rmSync12,
|
|
13559
13828
|
writeFileSync as writeFileSync8
|
|
13560
13829
|
} from "fs";
|
|
13561
|
-
import { extname as extname6, isAbsolute as isAbsolute2, join as
|
|
13830
|
+
import { extname as extname6, isAbsolute as isAbsolute2, join as join33, relative as relative5, sep as sep2 } from "path";
|
|
13562
13831
|
|
|
13563
13832
|
// ../producer/src/services/distributed/planFrameCost.ts
|
|
13564
|
-
import { join as
|
|
13833
|
+
import { join as join28 } from "path";
|
|
13565
13834
|
|
|
13566
13835
|
// ../producer/src/services/distributed/chunkFrames.ts
|
|
13567
13836
|
import { existsSync as existsSync17, readdirSync as readdirSync6 } from "fs";
|
|
13568
|
-
import { extname as extname4, join as
|
|
13837
|
+
import { extname as extname4, join as join27 } from "path";
|
|
13569
13838
|
|
|
13570
13839
|
// ../producer/src/services/distributed/shared.ts
|
|
13571
13840
|
import { execFile as execFileCallback } from "child_process";
|
|
13572
|
-
import { dirname as dirname10, join as
|
|
13841
|
+
import { dirname as dirname10, join as join26 } from "path";
|
|
13573
13842
|
import { existsSync as existsSync16, readFileSync as readFileSync8 } from "fs";
|
|
13574
13843
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
13575
13844
|
import { promisify as promisify2 } from "util";
|
|
@@ -13581,7 +13850,7 @@ function isPlanAudioArtifactPath(path) {
|
|
|
13581
13850
|
}
|
|
13582
13851
|
function resolvePlanAudioPath(planDir) {
|
|
13583
13852
|
for (const name of [PLAN_AUDIO_RELATIVE_PATH, PLAN_AUDIO_LEGACY_RELATIVE_PATH]) {
|
|
13584
|
-
const candidate =
|
|
13853
|
+
const candidate = join26(planDir, name);
|
|
13585
13854
|
if (existsSync16(candidate)) return candidate;
|
|
13586
13855
|
}
|
|
13587
13856
|
return null;
|
|
@@ -13841,7 +14110,7 @@ function readProducerVersion() {
|
|
|
13841
14110
|
const startDir = dirname10(fileURLToPath5(import.meta.url));
|
|
13842
14111
|
let current = startDir;
|
|
13843
14112
|
for (let i = 0; i < 10; i++) {
|
|
13844
|
-
const candidate =
|
|
14113
|
+
const candidate = join26(current, "package.json");
|
|
13845
14114
|
if (existsSync16(candidate)) {
|
|
13846
14115
|
try {
|
|
13847
14116
|
const pkg = JSON.parse(readFileSync8(candidate, "utf-8"));
|
|
@@ -13895,7 +14164,7 @@ function frameNumberFromFileName(name) {
|
|
|
13895
14164
|
function rebuildExtractedFramesFromPlanDir(planDir, videos, indexMode = "dense-v1") {
|
|
13896
14165
|
const result = [];
|
|
13897
14166
|
for (const v of videos) {
|
|
13898
|
-
const outputDir =
|
|
14167
|
+
const outputDir = join27(planDir, "video-frames", v.videoId);
|
|
13899
14168
|
if (!existsSync17(outputDir)) {
|
|
13900
14169
|
throw new Error(
|
|
13901
14170
|
`[renderChunk] planDir missing extracted video frames for ${JSON.stringify(v.videoId)}: ${outputDir} not present. plan() should have written frames here; the planDir is malformed.`
|
|
@@ -13914,7 +14183,7 @@ function rebuildExtractedFramesFromPlanDir(planDir, videos, indexMode = "dense-v
|
|
|
13914
14183
|
if (!frameName) continue;
|
|
13915
14184
|
const frameNumber = indexMode === "sparse-v2" ? frameNumberFromFileName(frameName) : null;
|
|
13916
14185
|
const frameIndex = frameNumber === null ? i : frameNumber - 1;
|
|
13917
|
-
framePaths.set(frameIndex,
|
|
14186
|
+
framePaths.set(frameIndex, join27(outputDir, frameName));
|
|
13918
14187
|
}
|
|
13919
14188
|
result.push({
|
|
13920
14189
|
videoId: v.videoId,
|
|
@@ -14004,14 +14273,14 @@ async function extractDeferredVideoFramesForChunk(input) {
|
|
|
14004
14273
|
const shown = shownDeferredFrameIndexes(input.planVideos, input.frames, input.fps);
|
|
14005
14274
|
return Promise.all(
|
|
14006
14275
|
deferred.map(async (video) => {
|
|
14007
|
-
const outputDir =
|
|
14276
|
+
const outputDir = join27(input.outputRoot, video.videoId);
|
|
14008
14277
|
const indexes = [...shown.get(video.videoId) ?? []].sort((a, b) => a - b);
|
|
14009
14278
|
if (indexes.length === 0) {
|
|
14010
14279
|
return { ...video, outputDir, framePaths: /* @__PURE__ */ new Map(), ownedByLookup: false };
|
|
14011
14280
|
}
|
|
14012
14281
|
const range = video.deferredRange;
|
|
14013
14282
|
const remoteUrl = remoteSources[range.sourcePath];
|
|
14014
|
-
const sourcePath = remoteUrl ??
|
|
14283
|
+
const sourcePath = remoteUrl ?? join27(input.planDir, ...range.sourcePath.split("/"));
|
|
14015
14284
|
if (remoteUrl === void 0 && !existsSync17(sourcePath)) {
|
|
14016
14285
|
throw new RenderChunkValidationError(
|
|
14017
14286
|
MISSING_PLAN_ARTIFACT,
|
|
@@ -14060,12 +14329,12 @@ async function measurePlanSecondsPerFrame(input) {
|
|
|
14060
14329
|
planVideos,
|
|
14061
14330
|
frames: sampled,
|
|
14062
14331
|
fps: fpsRatio,
|
|
14063
|
-
outputRoot:
|
|
14332
|
+
outputRoot: join28(workDir, "frame-cost-video-frames"),
|
|
14064
14333
|
cfg: input.cfg
|
|
14065
14334
|
})
|
|
14066
14335
|
];
|
|
14067
14336
|
const lookup = extracted.length > 0 ? createFrameLookupTable(planVideos.videos, extracted, resolveRenderFpsConfig(fpsRatio).value) : null;
|
|
14068
|
-
const compiledDir =
|
|
14337
|
+
const compiledDir = join28(planDir, "compiled");
|
|
14069
14338
|
const fileServer = await createFileServer({
|
|
14070
14339
|
projectDir: compiledDir,
|
|
14071
14340
|
compiledDir,
|
|
@@ -14077,7 +14346,7 @@ async function measurePlanSecondsPerFrame(input) {
|
|
|
14077
14346
|
try {
|
|
14078
14347
|
session = await createCaptureSession(
|
|
14079
14348
|
fileServer.url,
|
|
14080
|
-
|
|
14349
|
+
join28(workDir, "frame-cost"),
|
|
14081
14350
|
buildChunkCaptureOptions({
|
|
14082
14351
|
dimensions: { ...input, fpsNum: fps, fpsDen: 1 },
|
|
14083
14352
|
encoder: input,
|
|
@@ -14134,6 +14403,18 @@ function planFrameWeights(input) {
|
|
|
14134
14403
|
}
|
|
14135
14404
|
return weights;
|
|
14136
14405
|
}
|
|
14406
|
+
function withChunkCaptureCost(slices, weights) {
|
|
14407
|
+
const lightest = weights.reduce((least, weight) => Math.min(least, weight), Infinity);
|
|
14408
|
+
return slices.map((slice) => {
|
|
14409
|
+
let sum2 = 0;
|
|
14410
|
+
for (let frame = slice.startFrame; frame < slice.endFrame; frame++) sum2 += weights[frame];
|
|
14411
|
+
const cost = Math.round(sum2 / (slice.endFrame - slice.startFrame) / lightest * 100) / 100;
|
|
14412
|
+
return cost > 1 ? { ...slice, captureCost: cost } : slice;
|
|
14413
|
+
});
|
|
14414
|
+
}
|
|
14415
|
+
function effectiveChunkFrames(frames, captureCost = 1) {
|
|
14416
|
+
return Math.round(frames * captureCost);
|
|
14417
|
+
}
|
|
14137
14418
|
function buildWeightedChunkSlices(weights, chunkCount, minFrames, maxFrames) {
|
|
14138
14419
|
if (isUniformFrameCost(weights)) return null;
|
|
14139
14420
|
const totalFrames = weights.length;
|
|
@@ -14162,7 +14443,7 @@ function buildWeightedChunkSlices(weights, chunkCount, minFrames, maxFrames) {
|
|
|
14162
14443
|
|
|
14163
14444
|
// ../producer/src/services/render/stages/freezePlan.ts
|
|
14164
14445
|
import { existsSync as existsSync18, mkdirSync as mkdirSync9, readFileSync as readFileSync9, readdirSync as readdirSync7, writeFileSync as writeFileSync6 } from "fs";
|
|
14165
|
-
import { join as
|
|
14446
|
+
import { join as join29, relative as relative3, resolve as resolve7 } from "path";
|
|
14166
14447
|
|
|
14167
14448
|
// ../producer/src/services/distributed/planProtocol.ts
|
|
14168
14449
|
var PLAN_SCHEMA_VERSION = 1;
|
|
@@ -14261,7 +14542,7 @@ function readPlanProtocolV1(planJson, capabilities = DISTRIBUTED_RENDER_CAPABILI
|
|
|
14261
14542
|
|
|
14262
14543
|
// ../producer/src/services/render/stages/planHash.ts
|
|
14263
14544
|
import { createHash as createHash5 } from "crypto";
|
|
14264
|
-
import { closeSync as
|
|
14545
|
+
import { closeSync as closeSync4, createReadStream as createReadStream3, openSync as openSync4, readSync as readSync3 } from "fs";
|
|
14265
14546
|
var PLAN_HASH_SCHEMA_PREFIX = "hyperframes-plan-hash-v1\0";
|
|
14266
14547
|
var FIELD_DELIMITER = Buffer.from([0]);
|
|
14267
14548
|
function computePlanHash(input) {
|
|
@@ -14327,7 +14608,7 @@ function sha256File(path) {
|
|
|
14327
14608
|
if (bytesRead > 0) hash.update(buffer.subarray(0, bytesRead));
|
|
14328
14609
|
} while (bytesRead > 0);
|
|
14329
14610
|
} finally {
|
|
14330
|
-
|
|
14611
|
+
closeSync4(fd);
|
|
14331
14612
|
}
|
|
14332
14613
|
return hash.digest("hex");
|
|
14333
14614
|
}
|
|
@@ -14380,7 +14661,7 @@ function listPlanFiles(planDir) {
|
|
|
14380
14661
|
function walk(dir) {
|
|
14381
14662
|
const entries = readdirSync7(dir, { withFileTypes: true });
|
|
14382
14663
|
for (const entry of entries) {
|
|
14383
|
-
const full =
|
|
14664
|
+
const full = join29(dir, entry.name);
|
|
14384
14665
|
if (entry.isDirectory()) {
|
|
14385
14666
|
walk(full);
|
|
14386
14667
|
} else if (entry.isFile()) {
|
|
@@ -14421,15 +14702,15 @@ var PLAN_REMOTE_FILES_RELATIVE_PATH = "meta/remote-files.json";
|
|
|
14421
14702
|
function writePlanRemoteFiles(planDir, files) {
|
|
14422
14703
|
if (files.length === 0) return;
|
|
14423
14704
|
const sorted = [...files].sort((a, b) => a.path < b.path ? -1 : 1);
|
|
14424
|
-
writeFileSync6(
|
|
14705
|
+
writeFileSync6(join29(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH), JSON.stringify(sorted), "utf-8");
|
|
14425
14706
|
}
|
|
14426
14707
|
function readPlanRemoteFiles(planDir) {
|
|
14427
|
-
const path =
|
|
14708
|
+
const path = join29(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH);
|
|
14428
14709
|
return existsSync18(path) ? JSON.parse(readFileSync9(path, "utf-8")) : [];
|
|
14429
14710
|
}
|
|
14430
14711
|
function recomputePlanHashFromPlanDir(planDir, digests) {
|
|
14431
|
-
const planJsonPath =
|
|
14432
|
-
const encoderJsonPath =
|
|
14712
|
+
const planJsonPath = join29(planDir, "plan.json");
|
|
14713
|
+
const encoderJsonPath = join29(planDir, "meta", "encoder.json");
|
|
14433
14714
|
if (!existsSync18(planJsonPath)) {
|
|
14434
14715
|
throw new Error(`[freezePlan] plan.json missing: ${planJsonPath}`);
|
|
14435
14716
|
}
|
|
@@ -14466,18 +14747,18 @@ async function freezePlan(input) {
|
|
|
14466
14747
|
if (!existsSync18(planDir)) {
|
|
14467
14748
|
throw new Error(`[freezePlan] planDir does not exist: ${planDir}`);
|
|
14468
14749
|
}
|
|
14469
|
-
const metaDir =
|
|
14750
|
+
const metaDir = join29(planDir, "meta");
|
|
14470
14751
|
if (!existsSync18(metaDir)) mkdirSync9(metaDir, { recursive: true });
|
|
14471
14752
|
writeFileSync6(
|
|
14472
|
-
|
|
14753
|
+
join29(metaDir, "composition.json"),
|
|
14473
14754
|
`${JSON.stringify(composition, null, 2)}
|
|
14474
14755
|
`,
|
|
14475
14756
|
"utf-8"
|
|
14476
14757
|
);
|
|
14477
14758
|
const encoderForCanonical = stripUndefined(encoder);
|
|
14478
14759
|
const encoderConfigCanonicalJson = canonicalJsonStringify(encoderForCanonical);
|
|
14479
|
-
writeFileSync6(
|
|
14480
|
-
writeFileSync6(
|
|
14760
|
+
writeFileSync6(join29(metaDir, "encoder.json"), encoderConfigCanonicalJson, "utf-8");
|
|
14761
|
+
writeFileSync6(join29(metaDir, "chunks.json"), `${JSON.stringify(chunks, null, 2)}
|
|
14481
14762
|
`, "utf-8");
|
|
14482
14763
|
const { compositionHtml, assets } = collectPlanAssetShas(planDir, digests);
|
|
14483
14764
|
const planHash = computePlanHash({
|
|
@@ -14501,7 +14782,7 @@ async function freezePlan(input) {
|
|
|
14501
14782
|
duration: durationSeconds,
|
|
14502
14783
|
hasAudio
|
|
14503
14784
|
};
|
|
14504
|
-
const planJsonPath =
|
|
14785
|
+
const planJsonPath = join29(planDir, "plan.json");
|
|
14505
14786
|
writeFileSync6(planJsonPath, `${JSON.stringify(planJson, null, 2)}
|
|
14506
14787
|
`, "utf-8");
|
|
14507
14788
|
return { planJsonPath, planHash };
|
|
@@ -14543,14 +14824,14 @@ function applyRuntimeEnvSnapshot(snapshot, env = process.env) {
|
|
|
14543
14824
|
}
|
|
14544
14825
|
|
|
14545
14826
|
// ../producer/src/services/distributed/chunkAudio.ts
|
|
14546
|
-
import { closeSync as
|
|
14827
|
+
import { closeSync as closeSync5, existsSync as existsSync19, ftruncateSync, mkdirSync as mkdirSync11, openSync as openSync5, readFileSync as readFileSync10 } from "fs";
|
|
14547
14828
|
import { writeFileSync as writeFileSync7, writeSync } from "fs";
|
|
14548
|
-
import { join as
|
|
14829
|
+
import { join as join31 } from "path";
|
|
14549
14830
|
|
|
14550
14831
|
// ../producer/src/services/distributed/mp4Stitch.ts
|
|
14551
|
-
import { createReadStream as createReadStream4, createWriteStream, mkdirSync as mkdirSync10, mkdtempSync as mkdtempSync4, rmSync as
|
|
14832
|
+
import { createReadStream as createReadStream4, createWriteStream, mkdirSync as mkdirSync10, mkdtempSync as mkdtempSync4, rmSync as rmSync11 } from "fs";
|
|
14552
14833
|
import { open } from "fs/promises";
|
|
14553
|
-
import { dirname as dirname11, join as
|
|
14834
|
+
import { dirname as dirname11, join as join30 } from "path";
|
|
14554
14835
|
import { finished, pipeline } from "stream/promises";
|
|
14555
14836
|
function boxAt(src, off, at, limit) {
|
|
14556
14837
|
let size = src.readUInt32BE(off);
|
|
@@ -14916,16 +15197,16 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
|
|
|
14916
15197
|
const header = audioPath ? buildStitchedHeader(layouts.slice(1), layouts[0]) : buildStitchedHeader(layouts);
|
|
14917
15198
|
mkdirSync10(dirname11(outputPath), { recursive: true });
|
|
14918
15199
|
const workDir = mkdtempSync4(`${outputPath}.stitch-`);
|
|
14919
|
-
const out = createWriteStream(
|
|
15200
|
+
const out = createWriteStream(join30(workDir, "out.mp4"));
|
|
14920
15201
|
try {
|
|
14921
15202
|
out.write(header);
|
|
14922
15203
|
for (const [i, path] of sourcePaths.entries()) await copyPayload(path, layouts[i], i, out);
|
|
14923
15204
|
out.end();
|
|
14924
15205
|
await finished(out);
|
|
14925
|
-
renameWithRetry(
|
|
15206
|
+
renameWithRetry(join30(workDir, "out.mp4"), outputPath);
|
|
14926
15207
|
} finally {
|
|
14927
15208
|
out.destroy();
|
|
14928
|
-
|
|
15209
|
+
rmSync11(workDir, { recursive: true, force: true });
|
|
14929
15210
|
}
|
|
14930
15211
|
}
|
|
14931
15212
|
|
|
@@ -15016,7 +15297,7 @@ async function writeChunkAudioSlices(input) {
|
|
|
15016
15297
|
});
|
|
15017
15298
|
const bytes = readFileSync10(input.audioPath);
|
|
15018
15299
|
const layout = { sizeBytes: bytes.length, payloadStart, payloadEnd, partStarts: {} };
|
|
15019
|
-
mkdirSync11(
|
|
15300
|
+
mkdirSync11(join31(input.planDir, SLICE_DIR), { recursive: true });
|
|
15020
15301
|
input.chunks.forEach((_, index) => {
|
|
15021
15302
|
const cut = audioCutForChunk(grid, input.chunks, index, input.fps);
|
|
15022
15303
|
if (!cut) return;
|
|
@@ -15024,17 +15305,17 @@ async function writeChunkAudioSlices(input) {
|
|
|
15024
15305
|
const start = offsets[cut.firstPacket];
|
|
15025
15306
|
layout.partStarts[index] = start;
|
|
15026
15307
|
const end = offsets[last] + track.sizes[last];
|
|
15027
|
-
writeFileSync7(
|
|
15308
|
+
writeFileSync7(join31(input.planDir, chunkAudioSlicePath(index)), bytes.subarray(start, end));
|
|
15028
15309
|
});
|
|
15029
15310
|
const frame = [bytes.subarray(0, payloadStart), bytes.subarray(payloadEnd)];
|
|
15030
|
-
writeFileSync7(
|
|
15031
|
-
writeFileSync7(
|
|
15311
|
+
writeFileSync7(join31(input.planDir, SLICE_FRAME), Buffer.concat(frame));
|
|
15312
|
+
writeFileSync7(join31(input.planDir, SLICE_LAYOUT), JSON.stringify(layout));
|
|
15032
15313
|
}
|
|
15033
15314
|
function chunkAudioSource(planDir, chunkIndex, scratchPath) {
|
|
15034
|
-
const layoutPath =
|
|
15315
|
+
const layoutPath = join31(planDir, SLICE_LAYOUT);
|
|
15035
15316
|
if (!existsSync19(layoutPath)) return resolvePlanAudioPath(planDir);
|
|
15036
15317
|
const layout = JSON.parse(readFileSync10(layoutPath, "utf-8"));
|
|
15037
|
-
const frame = readFileSync10(
|
|
15318
|
+
const frame = readFileSync10(join31(planDir, SLICE_FRAME));
|
|
15038
15319
|
const fd = openSync5(scratchPath, "w");
|
|
15039
15320
|
try {
|
|
15040
15321
|
writeSync(fd, frame, 0, layout.payloadStart, 0);
|
|
@@ -15047,12 +15328,12 @@ function chunkAudioSource(planDir, chunkIndex, scratchPath) {
|
|
|
15047
15328
|
);
|
|
15048
15329
|
const start = layout.partStarts[chunkIndex];
|
|
15049
15330
|
if (start !== void 0) {
|
|
15050
|
-
const part = readFileSync10(
|
|
15331
|
+
const part = readFileSync10(join31(planDir, chunkAudioSlicePath(chunkIndex)));
|
|
15051
15332
|
writeSync(fd, part, 0, part.length, start);
|
|
15052
15333
|
}
|
|
15053
15334
|
ftruncateSync(fd, layout.sizeBytes);
|
|
15054
15335
|
} finally {
|
|
15055
|
-
|
|
15336
|
+
closeSync5(fd);
|
|
15056
15337
|
}
|
|
15057
15338
|
return scratchPath;
|
|
15058
15339
|
}
|
|
@@ -15103,7 +15384,7 @@ async function muxChunkWithAudio(input) {
|
|
|
15103
15384
|
// ../producer/src/services/distributed/planSize.ts
|
|
15104
15385
|
import { createHash as createHash6 } from "crypto";
|
|
15105
15386
|
import { lstatSync as lstatSync2, readdirSync as readdirSync8 } from "fs";
|
|
15106
|
-
import { extname as extname5, join as
|
|
15387
|
+
import { extname as extname5, join as join32, relative as relative4 } from "path";
|
|
15107
15388
|
var MAX_TOP_COMPONENTS = 10;
|
|
15108
15389
|
var SOURCE_MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
15109
15390
|
".aac",
|
|
@@ -15215,7 +15496,7 @@ function walkRegularFiles(dir, visit) {
|
|
|
15215
15496
|
return;
|
|
15216
15497
|
}
|
|
15217
15498
|
for (const entry of entries) {
|
|
15218
|
-
const full =
|
|
15499
|
+
const full = join32(dir, entry.name);
|
|
15219
15500
|
if (entry.isDirectory()) {
|
|
15220
15501
|
walkRegularFiles(full, visit);
|
|
15221
15502
|
} else if (entry.isFile()) {
|
|
@@ -15427,13 +15708,13 @@ function assertPositiveInteger2(name, value) {
|
|
|
15427
15708
|
}
|
|
15428
15709
|
var FREEZE_OWNED_PLAN_FILES = [
|
|
15429
15710
|
"plan.json",
|
|
15430
|
-
|
|
15431
|
-
|
|
15432
|
-
|
|
15711
|
+
join33("meta", "composition.json"),
|
|
15712
|
+
join33("meta", "encoder.json"),
|
|
15713
|
+
join33("meta", "chunks.json")
|
|
15433
15714
|
];
|
|
15434
15715
|
function removeFreezeOwnedPlanFiles(planDir) {
|
|
15435
15716
|
for (const relativePath of FREEZE_OWNED_PLAN_FILES) {
|
|
15436
|
-
|
|
15717
|
+
rmSync12(join33(planDir, relativePath), { force: true });
|
|
15437
15718
|
}
|
|
15438
15719
|
}
|
|
15439
15720
|
function buildChunkSlices(totalFrames, chunkCount, effectiveChunkSize) {
|
|
@@ -15452,7 +15733,10 @@ function buildPlanChunkSlices(frameWeights, config, chunkCount, effectiveChunkSi
|
|
|
15452
15733
|
MIN_CHUNK_SIZE,
|
|
15453
15734
|
Math.min(config.targetChunkFrames ?? MAX_CHUNK_SIZE, MAX_CHUNK_SIZE, maxFramesPerChunk)
|
|
15454
15735
|
) : null;
|
|
15455
|
-
return
|
|
15736
|
+
return withChunkCaptureCost(
|
|
15737
|
+
weighted ?? buildChunkSlices(frameWeights.length, chunkCount, effectiveChunkSize),
|
|
15738
|
+
frameWeights
|
|
15739
|
+
);
|
|
15456
15740
|
}
|
|
15457
15741
|
async function readFontSnapshotSha() {
|
|
15458
15742
|
const module = await import("./fontData.generated-NXAOI4GH.js");
|
|
@@ -15575,19 +15859,19 @@ function createVideoSourceShipper(input) {
|
|
|
15575
15859
|
const known = shipped.get(srcPath);
|
|
15576
15860
|
if (known) return known;
|
|
15577
15861
|
const stagedRel = pathInside(input.workVideoFramesDir, srcPath);
|
|
15578
|
-
const current = stagedRel === null ? srcPath :
|
|
15862
|
+
const current = stagedRel === null ? srcPath : join33(input.planDir, "video-frames", stagedRel);
|
|
15579
15863
|
let result = null;
|
|
15580
15864
|
for (const root of stagedRel === null ? [input.workCompiledDir, input.projectDir] : []) {
|
|
15581
15865
|
const rel = pathInside(root, srcPath);
|
|
15582
|
-
if (rel !== null && (existsSync20(
|
|
15866
|
+
if (rel !== null && (existsSync20(join33(input.planDir, "compiled", rel)) || input.isRemote(srcPath))) {
|
|
15583
15867
|
result = ["compiled", ...rel.split(sep2)].join("/");
|
|
15584
15868
|
break;
|
|
15585
15869
|
}
|
|
15586
15870
|
}
|
|
15587
15871
|
if (result === null) {
|
|
15588
15872
|
result = `video-sources/${shipped.size}${extname6(current)}`;
|
|
15589
|
-
const destination =
|
|
15590
|
-
mkdirSync12(
|
|
15873
|
+
const destination = join33(input.planDir, ...result.split("/"));
|
|
15874
|
+
mkdirSync12(join33(input.planDir, "video-sources"), { recursive: true });
|
|
15591
15875
|
try {
|
|
15592
15876
|
linkSync(current, destination);
|
|
15593
15877
|
} catch {
|
|
@@ -15636,14 +15920,14 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
15636
15920
|
variables: config.variables
|
|
15637
15921
|
});
|
|
15638
15922
|
const entryFile = config.entryFile ?? "index.html";
|
|
15639
|
-
const htmlPath =
|
|
15923
|
+
const htmlPath = join33(projectDir, entryFile);
|
|
15640
15924
|
if (!existsSync20(htmlPath)) {
|
|
15641
15925
|
throw new Error(`[plan] entry file not found: ${htmlPath}`);
|
|
15642
15926
|
}
|
|
15643
|
-
const workDir =
|
|
15644
|
-
|
|
15927
|
+
const workDir = join33(planDir, ".plan-work");
|
|
15928
|
+
rmSync12(workDir, { recursive: true, force: true });
|
|
15645
15929
|
mkdirSync12(workDir, { recursive: true });
|
|
15646
|
-
const compiledDir =
|
|
15930
|
+
const compiledDir = join33(workDir, "compiled");
|
|
15647
15931
|
mkdirSync12(compiledDir, { recursive: true });
|
|
15648
15932
|
let stageStarted = Date.now();
|
|
15649
15933
|
cpSync2(projectDir, compiledDir, {
|
|
@@ -15657,10 +15941,10 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
15657
15941
|
}
|
|
15658
15942
|
});
|
|
15659
15943
|
logPlanStage(log, "copy", stageStarted);
|
|
15660
|
-
const finalCompiledDir =
|
|
15944
|
+
const finalCompiledDir = join33(planDir, "compiled");
|
|
15661
15945
|
const needsAlpha = outputNeedsAlpha(config.format);
|
|
15662
15946
|
const remoteFiles = Object.entries(options.remoteFiles ?? {});
|
|
15663
|
-
const remoteLocalPath = (rel) =>
|
|
15947
|
+
const remoteLocalPath = (rel) => join33(projectDir, ...rel.split("/"));
|
|
15664
15948
|
for (const [, file] of remoteFiles) {
|
|
15665
15949
|
declareContentAddressedUrl(file.url, file.sha256);
|
|
15666
15950
|
if (file.probeFactsUrl) declareProbeFactsUrl(file.url, file.probeFactsUrl);
|
|
@@ -15739,7 +16023,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
15739
16023
|
if (probeResult.fileServer) closeFileServerSafely(probeResult.fileServer, "plan", log);
|
|
15740
16024
|
if (probeResult.probeSession) {
|
|
15741
16025
|
try {
|
|
15742
|
-
const { closeCaptureSession: closeCaptureSession2 } = await import("./src-
|
|
16026
|
+
const { closeCaptureSession: closeCaptureSession2 } = await import("./src-WEECPY6E.js");
|
|
15743
16027
|
await closeCaptureSession2(probeResult.probeSession);
|
|
15744
16028
|
} catch (err) {
|
|
15745
16029
|
log.warn("[plan] probe session close failed", {
|
|
@@ -15846,17 +16130,17 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
15846
16130
|
let stageStarted = Date.now();
|
|
15847
16131
|
const extractResult = await extractPlanVideos(c, options.deferVideoExtraction);
|
|
15848
16132
|
logPlanStage(log, "extract", stageStarted);
|
|
15849
|
-
const stagedVideoFrames =
|
|
15850
|
-
const videoFramesDst =
|
|
15851
|
-
if (existsSync20(videoFramesDst))
|
|
15852
|
-
const videoSourcesDir =
|
|
15853
|
-
|
|
16133
|
+
const stagedVideoFrames = join33(compiledDir, "__hyperframes_video_frames");
|
|
16134
|
+
const videoFramesDst = join33(planDir, "video-frames");
|
|
16135
|
+
if (existsSync20(videoFramesDst)) rmSync12(videoFramesDst, { recursive: true, force: true });
|
|
16136
|
+
const videoSourcesDir = join33(planDir, "video-sources");
|
|
16137
|
+
rmSync12(videoSourcesDir, { recursive: true, force: true });
|
|
15854
16138
|
if (existsSync20(stagedVideoFrames)) {
|
|
15855
16139
|
renameWithRetry(stagedVideoFrames, videoFramesDst);
|
|
15856
16140
|
} else {
|
|
15857
16141
|
mkdirSync12(videoFramesDst, { recursive: true });
|
|
15858
16142
|
}
|
|
15859
|
-
if (existsSync20(finalCompiledDir))
|
|
16143
|
+
if (existsSync20(finalCompiledDir)) rmSync12(finalCompiledDir, { recursive: true, force: true });
|
|
15860
16144
|
renameWithRetry(compiledDir, finalCompiledDir);
|
|
15861
16145
|
const shipVideoSource = createVideoSourceShipper({
|
|
15862
16146
|
planDir,
|
|
@@ -15886,7 +16170,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
15886
16170
|
};
|
|
15887
16171
|
})
|
|
15888
16172
|
});
|
|
15889
|
-
mkdirSync12(
|
|
16173
|
+
mkdirSync12(join33(planDir, "meta"), { recursive: true });
|
|
15890
16174
|
writePlanRemoteFiles(
|
|
15891
16175
|
planDir,
|
|
15892
16176
|
remoteFiles.map(([rel, { sha256, sizeBytes }]) => ({
|
|
@@ -15896,7 +16180,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
15896
16180
|
}))
|
|
15897
16181
|
);
|
|
15898
16182
|
writeFileSync8(
|
|
15899
|
-
|
|
16183
|
+
join33(planDir, PLAN_VIDEOS_META_RELATIVE_PATH),
|
|
15900
16184
|
JSON.stringify(planVideosJson, null, 2),
|
|
15901
16185
|
"utf-8"
|
|
15902
16186
|
);
|
|
@@ -15975,7 +16259,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
15975
16259
|
if (audioResult?.audioError) {
|
|
15976
16260
|
applyDistributedAudioWarningPolicy(job, audioResult.audioError, audioResult.audioFailures, log);
|
|
15977
16261
|
}
|
|
15978
|
-
const planAudioPath =
|
|
16262
|
+
const planAudioPath = join33(planDir, PLAN_AUDIO_RELATIVE_PATH);
|
|
15979
16263
|
if (audioResult?.hasAudio && existsSync20(audioResult.audioOutputPath)) {
|
|
15980
16264
|
renameWithRetry(audioResult.audioOutputPath, planAudioPath);
|
|
15981
16265
|
}
|
|
@@ -16024,7 +16308,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
16024
16308
|
format: config.format
|
|
16025
16309
|
};
|
|
16026
16310
|
try {
|
|
16027
|
-
|
|
16311
|
+
rmSync12(workDir, { recursive: true, force: true });
|
|
16028
16312
|
} catch (err) {
|
|
16029
16313
|
log.warn("[plan] failed to remove temp work dir", {
|
|
16030
16314
|
workDir,
|
|
@@ -16399,6 +16683,7 @@ function assertRequestOptionScalars(options) {
|
|
|
16399
16683
|
assertOptionalInteger(options, "gifLoop");
|
|
16400
16684
|
assertOptionalInteger(options, "hlsSegmentSeconds", 1);
|
|
16401
16685
|
assertOptionalInteger(options, "workers", 1);
|
|
16686
|
+
assertOptionalInteger(options, "maxRenderMs");
|
|
16402
16687
|
assertOptionalInteger(options, "crf");
|
|
16403
16688
|
for (const field of ["useGpu", "debug", "outputResolutionAspectAgnostic"]) {
|
|
16404
16689
|
assertOptionalBoolean(options, field);
|
|
@@ -16573,13 +16858,13 @@ function renderRequestFromDistributedConfig(input) {
|
|
|
16573
16858
|
import {
|
|
16574
16859
|
existsSync as existsSync23,
|
|
16575
16860
|
mkdirSync as mkdirSync13,
|
|
16576
|
-
statSync as
|
|
16861
|
+
statSync as statSync8,
|
|
16577
16862
|
mkdtempSync as mkdtempSync5,
|
|
16578
16863
|
writeFileSync as writeFileSync9,
|
|
16579
|
-
rmSync as
|
|
16864
|
+
rmSync as rmSync13,
|
|
16580
16865
|
createReadStream as createReadStream5
|
|
16581
16866
|
} from "fs";
|
|
16582
|
-
import { resolve as resolve9, dirname as dirname13, join as
|
|
16867
|
+
import { resolve as resolve9, dirname as dirname13, join as join36 } from "path";
|
|
16583
16868
|
import { tmpdir as tmpdir3 } from "os";
|
|
16584
16869
|
import { parseArgs } from "util";
|
|
16585
16870
|
import crypto from "crypto";
|
|
@@ -16591,13 +16876,13 @@ import { serve as serve2 } from "@hono/node-server";
|
|
|
16591
16876
|
import {
|
|
16592
16877
|
existsSync as existsSync21,
|
|
16593
16878
|
readFileSync as readFileSync11,
|
|
16594
|
-
statSync as
|
|
16879
|
+
statSync as statSync7,
|
|
16595
16880
|
openSync as openSync6,
|
|
16596
|
-
fstatSync as
|
|
16597
|
-
closeSync as
|
|
16881
|
+
fstatSync as fstatSync3,
|
|
16882
|
+
closeSync as closeSync6,
|
|
16598
16883
|
constants as constants3
|
|
16599
16884
|
} from "fs";
|
|
16600
|
-
import { resolve as resolve8, join as
|
|
16885
|
+
import { resolve as resolve8, join as join34, relative as relative6, isAbsolute as isAbsolute3, sep as sep3 } from "path";
|
|
16601
16886
|
function isStringRecord(value) {
|
|
16602
16887
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
16603
16888
|
return false;
|
|
@@ -16630,19 +16915,19 @@ function readEntryHtml(filePath) {
|
|
|
16630
16915
|
} catch (error) {
|
|
16631
16916
|
if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
|
|
16632
16917
|
return null;
|
|
16633
|
-
if (!
|
|
16918
|
+
if (!statSync7(filePath, { throwIfNoEntry: false })?.isFile()) return null;
|
|
16634
16919
|
throw error;
|
|
16635
16920
|
}
|
|
16636
16921
|
try {
|
|
16637
|
-
if (!
|
|
16922
|
+
if (!fstatSync3(fd).isFile()) return null;
|
|
16638
16923
|
return readFileSync11(fd, "utf-8");
|
|
16639
16924
|
} finally {
|
|
16640
|
-
|
|
16925
|
+
closeSync6(fd);
|
|
16641
16926
|
}
|
|
16642
16927
|
}
|
|
16643
16928
|
function readProjectEntryFile(projectDir, preferredEntryFile) {
|
|
16644
16929
|
const absProjectDir = resolve8(projectDir);
|
|
16645
|
-
if (!existsSync21(absProjectDir) || !
|
|
16930
|
+
if (!existsSync21(absProjectDir) || !statSync7(absProjectDir).isDirectory()) {
|
|
16646
16931
|
return { error: `Project directory not found: ${absProjectDir}` };
|
|
16647
16932
|
}
|
|
16648
16933
|
const entryCandidates = [preferredEntryFile, "index.html", "src/index.html"].filter(
|
|
@@ -16664,7 +16949,7 @@ function readProjectEntryFile(projectDir, preferredEntryFile) {
|
|
|
16664
16949
|
}
|
|
16665
16950
|
}
|
|
16666
16951
|
return {
|
|
16667
|
-
error: `No HTML entry file found in project directory: ${
|
|
16952
|
+
error: `No HTML entry file found in project directory: ${join34(absProjectDir, preferredEntryFile || "index.html")}`
|
|
16668
16953
|
};
|
|
16669
16954
|
}
|
|
16670
16955
|
function prepareHyperframeLintBody(body) {
|
|
@@ -16710,7 +16995,7 @@ async function runHyperframeLint(prepared) {
|
|
|
16710
16995
|
// ../producer/src/services/healthWorker.ts
|
|
16711
16996
|
import { Worker as Worker2 } from "worker_threads";
|
|
16712
16997
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
16713
|
-
import { dirname as dirname12, join as
|
|
16998
|
+
import { dirname as dirname12, join as join35 } from "path";
|
|
16714
16999
|
import { existsSync as existsSync22 } from "fs";
|
|
16715
17000
|
var DEFAULT_HEALTH_PORT = 9848;
|
|
16716
17001
|
async function startHealthWorker(options = {}) {
|
|
@@ -16786,7 +17071,7 @@ function defaultLogger2() {
|
|
|
16786
17071
|
}
|
|
16787
17072
|
function resolveWorkerEntry2() {
|
|
16788
17073
|
const here = dirname12(fileURLToPath6(import.meta.url));
|
|
16789
|
-
const candidates = [
|
|
17074
|
+
const candidates = [join35(here, "healthWorkerThread.js"), join35(here, "healthWorkerThread.ts")];
|
|
16790
17075
|
for (const candidate of candidates) {
|
|
16791
17076
|
if (existsSync22(candidate)) return candidate;
|
|
16792
17077
|
}
|
|
@@ -16801,7 +17086,8 @@ var SAFE_RENDER_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
16801
17086
|
"INVALID_VIDEO_METADATA",
|
|
16802
17087
|
"VIDEO_SOURCE_UNRENDERABLE",
|
|
16803
17088
|
"VIDEO_EXTRACTION_FAILED",
|
|
16804
|
-
"ENCODER_INTERRUPTED"
|
|
17089
|
+
"ENCODER_INTERRUPTED",
|
|
17090
|
+
"RENDER_TOO_SLOW"
|
|
16805
17091
|
]);
|
|
16806
17092
|
function extractSafeRenderErrorCode(error) {
|
|
16807
17093
|
if (typeof error !== "object" || error === null || !("code" in error)) return void 0;
|
|
@@ -16860,6 +17146,7 @@ function parseRenderOptions(body) {
|
|
|
16860
17146
|
const fps = parseServerFps(body.fps);
|
|
16861
17147
|
const quality = parseServerQuality(body.quality);
|
|
16862
17148
|
const workers = typeof body.workers === "number" ? body.workers : void 0;
|
|
17149
|
+
const maxRenderMs = typeof body.maxRenderMs === "number" ? body.maxRenderMs : void 0;
|
|
16863
17150
|
const useGpu = body.gpu === true;
|
|
16864
17151
|
const debug = body.debug === true;
|
|
16865
17152
|
const strictness = body.bestEffort === false ? "strict" : "best-effort";
|
|
@@ -16875,6 +17162,7 @@ function parseRenderOptions(body) {
|
|
|
16875
17162
|
fps,
|
|
16876
17163
|
quality,
|
|
16877
17164
|
workers,
|
|
17165
|
+
maxRenderMs,
|
|
16878
17166
|
crf,
|
|
16879
17167
|
videoBitrate,
|
|
16880
17168
|
useGpu,
|
|
@@ -16908,6 +17196,7 @@ function buildRenderJobConfig(input, outputPath, log) {
|
|
|
16908
17196
|
quality: input.quality,
|
|
16909
17197
|
format: input.format ?? "mp4",
|
|
16910
17198
|
workers: input.workers,
|
|
17199
|
+
maxRenderMs: input.maxRenderMs,
|
|
16911
17200
|
crf: input.crf,
|
|
16912
17201
|
videoBitrate: input.videoBitrate,
|
|
16913
17202
|
useGpu: input.useGpu,
|
|
@@ -16934,6 +17223,9 @@ function resolvePreparedRenderOutput(prepared, rendersDir, log) {
|
|
|
16934
17223
|
function validateRenderOverrides(body) {
|
|
16935
17224
|
const encoder = parseEncoderOptions(body, parseServerFormat(body.format) ?? "mp4");
|
|
16936
17225
|
if (!encoder.ok) return encoder.error;
|
|
17226
|
+
if (body.maxRenderMs !== void 0 && (typeof body.maxRenderMs !== "number" || !Number.isInteger(body.maxRenderMs) || body.maxRenderMs < 0)) {
|
|
17227
|
+
return "maxRenderMs must be a non-negative integer number of milliseconds";
|
|
17228
|
+
}
|
|
16937
17229
|
if (body.variables !== void 0 && !isPlainObject2(body.variables)) {
|
|
16938
17230
|
return 'variables must be a JSON object keyed by variable id (e.g. {"title":"Hello"})';
|
|
16939
17231
|
}
|
|
@@ -16966,7 +17258,7 @@ function prepareProjectDirectory(projectDir, options) {
|
|
|
16966
17258
|
const candidate = nonEmptyString(projectDir);
|
|
16967
17259
|
if (!candidate) return null;
|
|
16968
17260
|
const absProjectDir = resolve9(candidate);
|
|
16969
|
-
if (!existsSync23(absProjectDir) || !
|
|
17261
|
+
if (!existsSync23(absProjectDir) || !statSync8(absProjectDir).isDirectory()) {
|
|
16970
17262
|
return { error: `Project directory not found: ${absProjectDir}` };
|
|
16971
17263
|
}
|
|
16972
17264
|
const entry = options.entryFile || "index.html";
|
|
@@ -16991,8 +17283,8 @@ async function resolveInlineRenderHtml(body) {
|
|
|
16991
17283
|
}
|
|
16992
17284
|
function materializeInlineProject(html, options) {
|
|
16993
17285
|
const tempRoot = process.env.PRODUCER_TMP_PROJECT_DIR || tmpdir3();
|
|
16994
|
-
const tempProjectDir = mkdtempSync5(
|
|
16995
|
-
writeFileSync9(
|
|
17286
|
+
const tempProjectDir = mkdtempSync5(join36(tempRoot, "producer-project-"));
|
|
17287
|
+
writeFileSync9(join36(tempProjectDir, "index.html"), html, "utf-8");
|
|
16996
17288
|
return {
|
|
16997
17289
|
prepared: {
|
|
16998
17290
|
input: { projectDir: tempProjectDir, ...options },
|
|
@@ -17053,7 +17345,7 @@ function createArtifactStore(ttlMs) {
|
|
|
17053
17345
|
function cleanupTempDir(dir, log) {
|
|
17054
17346
|
if (!dir) return;
|
|
17055
17347
|
try {
|
|
17056
|
-
|
|
17348
|
+
rmSync13(dir, { recursive: true, force: true });
|
|
17057
17349
|
} catch (error) {
|
|
17058
17350
|
log.warn("Failed to cleanup temp project dir", {
|
|
17059
17351
|
cleanupProjectDir: dir,
|
|
@@ -17062,7 +17354,7 @@ function cleanupTempDir(dir, log) {
|
|
|
17062
17354
|
}
|
|
17063
17355
|
}
|
|
17064
17356
|
function outputFileSize(path) {
|
|
17065
|
-
return existsSync23(path) ?
|
|
17357
|
+
return existsSync23(path) ? statSync8(path).size : 0;
|
|
17066
17358
|
}
|
|
17067
17359
|
function createBlockingProgressReporter(log, requestId) {
|
|
17068
17360
|
let lastLoggedPct = -10;
|
|
@@ -17362,7 +17654,7 @@ function createRenderHandlers(options = {}) {
|
|
|
17362
17654
|
store.delete(token);
|
|
17363
17655
|
return c.json({ success: false, error: "Output artifact file missing" }, 404);
|
|
17364
17656
|
}
|
|
17365
|
-
const stats =
|
|
17657
|
+
const stats = statSync8(artifact.path);
|
|
17366
17658
|
return new Response(createReadStream5(artifact.path), {
|
|
17367
17659
|
headers: {
|
|
17368
17660
|
"content-type": "video/mp4",
|
|
@@ -17405,7 +17697,7 @@ function startServer(options = {}) {
|
|
|
17405
17697
|
});
|
|
17406
17698
|
async function shutdown(signal) {
|
|
17407
17699
|
log.info(`Received ${signal}, shutting down`);
|
|
17408
|
-
const { drainBrowserPool } = await import("./src-
|
|
17700
|
+
const { drainBrowserPool } = await import("./src-WEECPY6E.js");
|
|
17409
17701
|
await drainBrowserPool().catch(() => {
|
|
17410
17702
|
});
|
|
17411
17703
|
const handle = await Promise.race([
|
|
@@ -17449,12 +17741,12 @@ import {
|
|
|
17449
17741
|
mkdtempSync as mkdtempSync7,
|
|
17450
17742
|
readFileSync as readFileSync12,
|
|
17451
17743
|
readdirSync as readdirSync9,
|
|
17452
|
-
rmSync as
|
|
17453
|
-
statSync as
|
|
17744
|
+
rmSync as rmSync15,
|
|
17745
|
+
statSync as statSync10,
|
|
17454
17746
|
writeFileSync as writeFileSync11
|
|
17455
17747
|
} from "fs";
|
|
17456
17748
|
import { tmpdir as tmpdir4 } from "os";
|
|
17457
|
-
import { dirname as dirname15, isAbsolute as isAbsolute4, join as
|
|
17749
|
+
import { dirname as dirname15, isAbsolute as isAbsolute4, join as join39, relative as relative7, resolve as resolve10, sep as sep4 } from "path";
|
|
17458
17750
|
|
|
17459
17751
|
// ../producer/src/services/distributed/planV2Publisher.ts
|
|
17460
17752
|
import {
|
|
@@ -17463,11 +17755,11 @@ import {
|
|
|
17463
17755
|
linkSync as linkSync2,
|
|
17464
17756
|
mkdirSync as mkdirSync14,
|
|
17465
17757
|
mkdtempSync as mkdtempSync6,
|
|
17466
|
-
rmSync as
|
|
17467
|
-
statSync as
|
|
17758
|
+
rmSync as rmSync14,
|
|
17759
|
+
statSync as statSync9,
|
|
17468
17760
|
writeFileSync as writeFileSync10
|
|
17469
17761
|
} from "fs";
|
|
17470
|
-
import { dirname as dirname14, join as
|
|
17762
|
+
import { dirname as dirname14, join as join38 } from "path";
|
|
17471
17763
|
|
|
17472
17764
|
// ../producer/src/services/distributed/planV2Errors.ts
|
|
17473
17765
|
var PLAN_V2_INTEGRITY_UNRECOVERABLE = "PLAN_V2_INTEGRITY_UNRECOVERABLE";
|
|
@@ -17482,7 +17774,7 @@ var PlanV2IntegrityError = class extends Error {
|
|
|
17482
17774
|
};
|
|
17483
17775
|
|
|
17484
17776
|
// ../producer/src/services/distributed/planV2Layout.ts
|
|
17485
|
-
import { join as
|
|
17777
|
+
import { join as join37 } from "path";
|
|
17486
17778
|
var SHA256_PATTERN = /^[0-9a-f]{64}$/;
|
|
17487
17779
|
function assertPlanV2Sha256(value, field) {
|
|
17488
17780
|
if (typeof value !== "string" || !SHA256_PATTERN.test(value)) {
|
|
@@ -17492,7 +17784,7 @@ function assertPlanV2Sha256(value, field) {
|
|
|
17492
17784
|
}
|
|
17493
17785
|
function planV2BlobPath(root, sha256) {
|
|
17494
17786
|
const digest = assertPlanV2Sha256(sha256, "artifact sha256");
|
|
17495
|
-
return
|
|
17787
|
+
return join37(root, "artifacts", "sha256", digest.slice(0, 2), digest);
|
|
17496
17788
|
}
|
|
17497
17789
|
|
|
17498
17790
|
// ../producer/src/services/distributed/planV2Publisher.ts
|
|
@@ -17533,11 +17825,11 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
17533
17825
|
this.destinationDir = destinationDir;
|
|
17534
17826
|
this.#linkFile = options.linkFile ?? linkSync2;
|
|
17535
17827
|
mkdirSync14(dirname14(destinationDir), { recursive: true });
|
|
17536
|
-
this.temporaryDir = mkdtempSync6(
|
|
17828
|
+
this.temporaryDir = mkdtempSync6(join38(dirname14(destinationDir), ".plan-v2-publish-"));
|
|
17537
17829
|
}
|
|
17538
17830
|
async putBlob(blob) {
|
|
17539
17831
|
const digest = assertPlanV2Sha256(blob.sha256, "published blob sha256");
|
|
17540
|
-
const sourceSize =
|
|
17832
|
+
const sourceSize = statSync9(blob.sourcePath).size;
|
|
17541
17833
|
if (sourceSize !== blob.sizeBytes) {
|
|
17542
17834
|
throw new PlanV2IntegrityError(
|
|
17543
17835
|
`published blob size changed for ${digest}: expected ${blob.sizeBytes}, got ${sourceSize}`
|
|
@@ -17546,8 +17838,8 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
17546
17838
|
const destinationPath = planV2BlobPath(this.temporaryDir, digest);
|
|
17547
17839
|
if (existsSync24(destinationPath)) return;
|
|
17548
17840
|
mkdirSync14(dirname14(destinationPath), { recursive: true });
|
|
17549
|
-
const stagingDir = mkdtempSync6(
|
|
17550
|
-
const temporaryPath =
|
|
17841
|
+
const stagingDir = mkdtempSync6(join38(dirname14(destinationPath), ".plan-v2-blob-"));
|
|
17842
|
+
const temporaryPath = join38(stagingDir, "blob");
|
|
17551
17843
|
try {
|
|
17552
17844
|
try {
|
|
17553
17845
|
this.#linkFile(blob.sourcePath, temporaryPath);
|
|
@@ -17557,7 +17849,7 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
17557
17849
|
}
|
|
17558
17850
|
renameWithRetry(temporaryPath, destinationPath);
|
|
17559
17851
|
} finally {
|
|
17560
|
-
|
|
17852
|
+
rmSync14(stagingDir, { recursive: true, force: true });
|
|
17561
17853
|
}
|
|
17562
17854
|
}
|
|
17563
17855
|
async commitManifest(manifestBytes) {
|
|
@@ -17568,13 +17860,13 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
17568
17860
|
);
|
|
17569
17861
|
}
|
|
17570
17862
|
}
|
|
17571
|
-
writeFileSync10(
|
|
17863
|
+
writeFileSync10(join38(this.temporaryDir, "plan.json"), manifestBytes, "utf-8");
|
|
17572
17864
|
renameWithRetry(this.temporaryDir, this.destinationDir);
|
|
17573
17865
|
this.#committed = true;
|
|
17574
17866
|
}
|
|
17575
17867
|
async abort() {
|
|
17576
17868
|
if (!this.#committed) {
|
|
17577
|
-
|
|
17869
|
+
rmSync14(this.temporaryDir, { recursive: true, force: true });
|
|
17578
17870
|
}
|
|
17579
17871
|
}
|
|
17580
17872
|
};
|
|
@@ -17613,7 +17905,7 @@ function listFiles(root) {
|
|
|
17613
17905
|
const rootResolved = resolve10(root);
|
|
17614
17906
|
function walk(dir) {
|
|
17615
17907
|
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
17616
|
-
const absolutePath =
|
|
17908
|
+
const absolutePath = join39(dir, entry.name);
|
|
17617
17909
|
if (entry.isDirectory()) {
|
|
17618
17910
|
walk(absolutePath);
|
|
17619
17911
|
} else if (entry.isFile()) {
|
|
@@ -17640,13 +17932,13 @@ function assertValidExtractionCacheCompleteSentinel(path) {
|
|
|
17640
17932
|
}
|
|
17641
17933
|
}
|
|
17642
17934
|
function validateExtractionCacheCompleteSentinels(executionPlanDir) {
|
|
17643
|
-
const videoRoot =
|
|
17935
|
+
const videoRoot = join39(executionPlanDir, "video-frames");
|
|
17644
17936
|
if (!existsSync25(videoRoot)) return;
|
|
17645
17937
|
for (const videoEntry of readdirSync9(videoRoot, { withFileTypes: true })) {
|
|
17646
17938
|
if (!videoEntry.isDirectory()) continue;
|
|
17647
|
-
const videoDir =
|
|
17939
|
+
const videoDir = join39(videoRoot, videoEntry.name);
|
|
17648
17940
|
if (readdirSync9(videoDir).includes(EXTRACTION_CACHE_COMPLETE_SENTINEL)) {
|
|
17649
|
-
const sentinelPath =
|
|
17941
|
+
const sentinelPath = join39(videoDir, EXTRACTION_CACHE_COMPLETE_SENTINEL);
|
|
17650
17942
|
assertValidExtractionCacheCompleteSentinel(sentinelPath);
|
|
17651
17943
|
}
|
|
17652
17944
|
}
|
|
@@ -17693,7 +17985,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
|
|
|
17693
17985
|
if (video.deferredRange) {
|
|
17694
17986
|
const framePaths2 = /* @__PURE__ */ new Map();
|
|
17695
17987
|
for (let index = 0; index < video.totalFrames; index++) {
|
|
17696
|
-
framePaths2.set(index,
|
|
17988
|
+
framePaths2.set(index, join39(outputDir, String(index)));
|
|
17697
17989
|
}
|
|
17698
17990
|
return { ...video, outputDir, framePaths: framePaths2, ownedByLookup: false };
|
|
17699
17991
|
}
|
|
@@ -17701,7 +17993,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
|
|
|
17701
17993
|
const framePaths = /* @__PURE__ */ new Map();
|
|
17702
17994
|
for (const frameName of frameNames) {
|
|
17703
17995
|
if (frameName === EXTRACTION_CACHE_COMPLETE_SENTINEL) {
|
|
17704
|
-
assertValidExtractionCacheCompleteSentinel(
|
|
17996
|
+
assertValidExtractionCacheCompleteSentinel(join39(outputDir, frameName));
|
|
17705
17997
|
continue;
|
|
17706
17998
|
}
|
|
17707
17999
|
const match = /(\d+)(?=\.[^.]+$)/.exec(frameName);
|
|
@@ -17720,7 +18012,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
|
|
|
17720
18012
|
`duplicate extracted frame index ${frameIndex} in ${outputDir}`
|
|
17721
18013
|
);
|
|
17722
18014
|
}
|
|
17723
|
-
framePaths.set(frameIndex,
|
|
18015
|
+
framePaths.set(frameIndex, join39(outputDir, frameName));
|
|
17724
18016
|
}
|
|
17725
18017
|
return {
|
|
17726
18018
|
...video,
|
|
@@ -17741,7 +18033,7 @@ function parsePlanVideosJson2(value) {
|
|
|
17741
18033
|
}
|
|
17742
18034
|
}
|
|
17743
18035
|
function materializeExtractedVideoDirectories(planDir) {
|
|
17744
|
-
const videosPath =
|
|
18036
|
+
const videosPath = join39(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
|
|
17745
18037
|
if (!existsSync25(videosPath)) return;
|
|
17746
18038
|
const videos = parsePlanVideosJson2(readJsonFile(videosPath, PLAN_VIDEOS_META_RELATIVE_PATH));
|
|
17747
18039
|
for (const video of videos.extracted) {
|
|
@@ -17766,17 +18058,22 @@ function parseChunkSlices(value) {
|
|
|
17766
18058
|
throw new PlanV2IntegrityError(`meta/chunks.json contains duplicate chunk index ${index}`);
|
|
17767
18059
|
}
|
|
17768
18060
|
indexes.add(index);
|
|
17769
|
-
return { index, startFrame, endFrame };
|
|
18061
|
+
if (chunk.captureCost === void 0) return { index, startFrame, endFrame };
|
|
18062
|
+
const captureCost = chunk.captureCost;
|
|
18063
|
+
if (typeof captureCost !== "number" || !Number.isFinite(captureCost) || captureCost <= 1) {
|
|
18064
|
+
throw new PlanV2IntegrityError(`${field}.captureCost must be a number above 1`);
|
|
18065
|
+
}
|
|
18066
|
+
return { index, startFrame, endFrame, captureCost };
|
|
17770
18067
|
});
|
|
17771
18068
|
}
|
|
17772
18069
|
function buildVideoChunkDependencies(executionPlanDir, dimensions) {
|
|
17773
|
-
const videoRoot =
|
|
18070
|
+
const videoRoot = join39(executionPlanDir, "video-frames");
|
|
17774
18071
|
const hasExtractedFrames = existsSync25(videoRoot) && listFiles(videoRoot).length > 0;
|
|
17775
|
-
const videosPath =
|
|
18072
|
+
const videosPath = join39(executionPlanDir, PLAN_VIDEOS_META_RELATIVE_PATH);
|
|
17776
18073
|
if (!existsSync25(videosPath)) {
|
|
17777
18074
|
return hasExtractedFrames ? { mode: "full-source-pack", dependencies: null } : { mode: "exact-rendered-frames", dependencies: /* @__PURE__ */ new Map() };
|
|
17778
18075
|
}
|
|
17779
|
-
const chunksPath =
|
|
18076
|
+
const chunksPath = join39(executionPlanDir, "meta", "chunks.json");
|
|
17780
18077
|
const videos = readJsonFile(videosPath, PLAN_VIDEOS_META_RELATIVE_PATH);
|
|
17781
18078
|
const chunks = readJsonFile(chunksPath, "meta/chunks.json");
|
|
17782
18079
|
const parsedVideos = parsePlanVideosJson2(videos);
|
|
@@ -17832,20 +18129,20 @@ function computeManifestHash(manifest) {
|
|
|
17832
18129
|
function writeBlob(sourcePath, destinationPath) {
|
|
17833
18130
|
if (existsSync25(destinationPath)) return;
|
|
17834
18131
|
mkdirSync15(dirname15(destinationPath), { recursive: true });
|
|
17835
|
-
const temporaryDir = mkdtempSync7(
|
|
17836
|
-
const temporaryPath =
|
|
18132
|
+
const temporaryDir = mkdtempSync7(join39(dirname15(destinationPath), ".plan-v2-blob-"));
|
|
18133
|
+
const temporaryPath = join39(temporaryDir, "blob");
|
|
17837
18134
|
try {
|
|
17838
18135
|
copyFileSync6(sourcePath, temporaryPath);
|
|
17839
18136
|
renameWithRetry(temporaryPath, destinationPath);
|
|
17840
18137
|
} finally {
|
|
17841
|
-
|
|
18138
|
+
rmSync15(temporaryDir, { recursive: true, force: true });
|
|
17842
18139
|
}
|
|
17843
18140
|
}
|
|
17844
18141
|
function publishBlobFor(absolutePath, digests) {
|
|
17845
18142
|
return {
|
|
17846
18143
|
sourcePath: absolutePath,
|
|
17847
18144
|
sha256: planFileSha256(absolutePath, digests),
|
|
17848
|
-
sizeBytes:
|
|
18145
|
+
sizeBytes: statSync10(absolutePath).size
|
|
17849
18146
|
};
|
|
17850
18147
|
}
|
|
17851
18148
|
async function putBlobs(publisher, blobs) {
|
|
@@ -17869,7 +18166,7 @@ async function putTasks(tasks) {
|
|
|
17869
18166
|
if (failure) throw failure.reason;
|
|
17870
18167
|
}
|
|
17871
18168
|
function buildPlanV2Publication(executionPlanDir, digests) {
|
|
17872
|
-
const executionPlanPath =
|
|
18169
|
+
const executionPlanPath = join39(executionPlanDir, "plan.json");
|
|
17873
18170
|
if (!existsSync25(executionPlanPath)) {
|
|
17874
18171
|
throw new PlanV2IntegrityError(`execution plan is missing plan.json: ${executionPlanPath}`);
|
|
17875
18172
|
}
|
|
@@ -17897,7 +18194,7 @@ function buildPlanV2Publication(executionPlanDir, digests) {
|
|
|
17897
18194
|
}
|
|
17898
18195
|
validateExtractionCacheCompleteSentinels(executionPlanDir);
|
|
17899
18196
|
const videoDependencyPlan = buildVideoChunkDependencies(executionPlanDir, dimensions);
|
|
17900
|
-
const encoder = readJsonFile(
|
|
18197
|
+
const encoder = readJsonFile(join39(executionPlanDir, "meta", "encoder.json"), "meta/encoder.json");
|
|
17901
18198
|
const files = listFiles(executionPlanDir);
|
|
17902
18199
|
const chunkAudio = !isRecord3(encoder) || encoder.chunksCarryAudio !== true ? "none" : files.some((file) => chunkAudioSliceTarget(file.path) !== null) ? "sliced" : "whole";
|
|
17903
18200
|
for (const file of files) {
|
|
@@ -17958,20 +18255,20 @@ function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
|
|
|
17958
18255
|
throw new PlanV2IntegrityError("a local plan v2 directory cannot reference remote files");
|
|
17959
18256
|
}
|
|
17960
18257
|
mkdirSync15(dirname15(planV2Dir), { recursive: true });
|
|
17961
|
-
const tempDir = mkdtempSync7(
|
|
18258
|
+
const tempDir = mkdtempSync7(join39(dirname15(planV2Dir), ".plan-v2-build-"));
|
|
17962
18259
|
try {
|
|
17963
18260
|
for (const blob of publication.blobs) {
|
|
17964
18261
|
writeBlob(blob.sourcePath, planV2BlobPath(tempDir, blob.sha256));
|
|
17965
18262
|
}
|
|
17966
18263
|
writeFileSync11(
|
|
17967
|
-
|
|
18264
|
+
join39(tempDir, "plan.json"),
|
|
17968
18265
|
canonicalJsonStringify(publication.manifest),
|
|
17969
18266
|
"utf-8"
|
|
17970
18267
|
);
|
|
17971
18268
|
renameWithRetry(tempDir, planV2Dir);
|
|
17972
18269
|
return resultFromManifest(planV2Dir, publication.manifest);
|
|
17973
18270
|
} catch (error) {
|
|
17974
|
-
|
|
18271
|
+
rmSync15(tempDir, { recursive: true, force: true });
|
|
17975
18272
|
throw error;
|
|
17976
18273
|
}
|
|
17977
18274
|
}
|
|
@@ -18011,7 +18308,7 @@ async function publishPlanV2FromV1(executionPlanDir, publisher) {
|
|
|
18011
18308
|
return publishPlanV2FromExecutionPlan(executionPlanDir, publisher);
|
|
18012
18309
|
}
|
|
18013
18310
|
async function planV2WithPublisher(projectDir, config, publisher, options = {}) {
|
|
18014
|
-
const stagingRoot = mkdtempSync7(
|
|
18311
|
+
const stagingRoot = mkdtempSync7(join39(options.stagingParentDir ?? tmpdir4(), ".execution-plan-"));
|
|
18015
18312
|
const digests = /* @__PURE__ */ new Map();
|
|
18016
18313
|
try {
|
|
18017
18314
|
await buildLocalExecutionPlan(projectDir, config, stagingRoot, {
|
|
@@ -18022,7 +18319,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
|
|
|
18022
18319
|
// artifactTargets ships every compiled/ file to all chunks, so each is in the manifest.
|
|
18023
18320
|
whileAudioMixes: () => putBlobs(
|
|
18024
18321
|
publisher,
|
|
18025
|
-
listFiles(
|
|
18322
|
+
listFiles(join39(stagingRoot, "compiled")).map(
|
|
18026
18323
|
(file) => publishBlobFor(file.absolutePath, digests)
|
|
18027
18324
|
)
|
|
18028
18325
|
),
|
|
@@ -18038,7 +18335,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
|
|
|
18038
18335
|
}
|
|
18039
18336
|
throw error;
|
|
18040
18337
|
} finally {
|
|
18041
|
-
|
|
18338
|
+
rmSync15(stagingRoot, { recursive: true, force: true });
|
|
18042
18339
|
}
|
|
18043
18340
|
}
|
|
18044
18341
|
async function planV2(projectDir, config, planV2Dir) {
|
|
@@ -18054,7 +18351,7 @@ async function planV2(projectDir, config, planV2Dir) {
|
|
|
18054
18351
|
function resultFromManifest(planV2Dir, manifest) {
|
|
18055
18352
|
return {
|
|
18056
18353
|
planDir: planV2Dir,
|
|
18057
|
-
manifestPath:
|
|
18354
|
+
manifestPath: join39(planV2Dir, "plan.json"),
|
|
18058
18355
|
planProtocol: PLAN_PROTOCOL_V2,
|
|
18059
18356
|
planHash: manifest.planHash,
|
|
18060
18357
|
sourcePlanV1Hash: getPlanV2ExecutionPlanHash(manifest),
|
|
@@ -18190,7 +18487,7 @@ function parsePlanV2Manifest(value) {
|
|
|
18190
18487
|
return parsed;
|
|
18191
18488
|
}
|
|
18192
18489
|
function readPlanV2Manifest(planV2Dir) {
|
|
18193
|
-
const manifestPath =
|
|
18490
|
+
const manifestPath = join39(planV2Dir, "plan.json");
|
|
18194
18491
|
if (!existsSync25(manifestPath)) {
|
|
18195
18492
|
throw new PlanV2IntegrityError(`missing v2 manifest: ${manifestPath}`);
|
|
18196
18493
|
}
|
|
@@ -18213,7 +18510,7 @@ function verifyBlob(planV2Dir, artifact) {
|
|
|
18213
18510
|
if (!existsSync25(sourcePath)) {
|
|
18214
18511
|
throw new PlanV2IntegrityError(`missing content-addressed artifact ${artifact.sha256}`);
|
|
18215
18512
|
}
|
|
18216
|
-
const stats =
|
|
18513
|
+
const stats = statSync10(sourcePath);
|
|
18217
18514
|
if (!stats.isFile() || stats.size !== artifact.sizeBytes) {
|
|
18218
18515
|
throw new PlanV2IntegrityError(`artifact size mismatch for ${artifact.path}`);
|
|
18219
18516
|
}
|
|
@@ -18236,16 +18533,16 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
|
|
|
18236
18533
|
sourcePath: verifyBlob(planV2Dir, artifact)
|
|
18237
18534
|
}));
|
|
18238
18535
|
mkdirSync15(dirname15(destinationDir), { recursive: true });
|
|
18239
|
-
const tempDir = mkdtempSync7(
|
|
18536
|
+
const tempDir = mkdtempSync7(join39(dirname15(destinationDir), ".plan-v2-materialize-"));
|
|
18240
18537
|
try {
|
|
18241
18538
|
for (const { artifact, sourcePath } of verified) {
|
|
18242
|
-
const destinationPath =
|
|
18539
|
+
const destinationPath = join39(tempDir, ...artifact.path.split("/"));
|
|
18243
18540
|
mkdirSync15(dirname15(destinationPath), { recursive: true });
|
|
18244
18541
|
copyFileSync6(sourcePath, destinationPath);
|
|
18245
18542
|
}
|
|
18246
18543
|
if (target.role === "chunk") materializeExtractedVideoDirectories(tempDir);
|
|
18247
18544
|
writeFileSync11(
|
|
18248
|
-
|
|
18545
|
+
join39(tempDir, PLAN_V2_MATERIALIZATION_MARKER),
|
|
18249
18546
|
canonicalJsonStringify({
|
|
18250
18547
|
manifest,
|
|
18251
18548
|
target,
|
|
@@ -18255,7 +18552,7 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
|
|
|
18255
18552
|
);
|
|
18256
18553
|
renameWithRetry(tempDir, destinationDir);
|
|
18257
18554
|
} catch (error) {
|
|
18258
|
-
|
|
18555
|
+
rmSync15(tempDir, { recursive: true, force: true });
|
|
18259
18556
|
throw error;
|
|
18260
18557
|
}
|
|
18261
18558
|
return {
|
|
@@ -18268,7 +18565,7 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
|
|
|
18268
18565
|
// Join the artifact's OWN name, not the current constant: a plan written
|
|
18269
18566
|
// before the container change carries the legacy name, and materializing it
|
|
18270
18567
|
// under the new one would point at a file that was never written.
|
|
18271
|
-
audioPath: target.role === "assembler" ? audioArtifact ?
|
|
18568
|
+
audioPath: target.role === "assembler" ? audioArtifact ? join39(destinationDir, audioArtifact.path) : null : null
|
|
18272
18569
|
};
|
|
18273
18570
|
}
|
|
18274
18571
|
function assertRemoteSources(remoteSources, artifacts) {
|
|
@@ -18287,7 +18584,7 @@ function validatePlanV2MaterializedTarget(planDir, expectedTarget) {
|
|
|
18287
18584
|
return readValidatedPlanV2Materialization(planDir, expectedTarget)?.manifest ?? null;
|
|
18288
18585
|
}
|
|
18289
18586
|
function readValidatedPlanV2Materialization(planDir, expectedTarget) {
|
|
18290
|
-
const markerPath =
|
|
18587
|
+
const markerPath = join39(planDir, PLAN_V2_MATERIALIZATION_MARKER);
|
|
18291
18588
|
if (!existsSync25(markerPath)) return null;
|
|
18292
18589
|
const marker = readJsonFile(markerPath, "materialization marker");
|
|
18293
18590
|
if (!isRecord3(marker) || !isRecord3(marker.manifest) || !isRecord3(marker.target)) {
|
|
@@ -18305,8 +18602,8 @@ function readValidatedPlanV2Materialization(planDir, expectedTarget) {
|
|
|
18305
18602
|
assertRemoteSources(remoteSources, required);
|
|
18306
18603
|
for (const artifact of required) {
|
|
18307
18604
|
if (Object.hasOwn(remoteSources, artifact.path)) continue;
|
|
18308
|
-
const path =
|
|
18309
|
-
if (!existsSync25(path) ||
|
|
18605
|
+
const path = join39(planDir, ...artifact.path.split("/"));
|
|
18606
|
+
if (!existsSync25(path) || statSync10(path).size !== artifact.sizeBytes) {
|
|
18310
18607
|
throw new PlanV2IntegrityError(
|
|
18311
18608
|
`materialized artifact missing or truncated: ${artifact.path}`
|
|
18312
18609
|
);
|
|
@@ -18319,9 +18616,9 @@ function readValidatedPlanV2Materialization(planDir, expectedTarget) {
|
|
|
18319
18616
|
}
|
|
18320
18617
|
|
|
18321
18618
|
// ../producer/src/services/distributed/planV2Execution.ts
|
|
18322
|
-
import { mkdtempSync as mkdtempSync9, rmSync as
|
|
18619
|
+
import { mkdtempSync as mkdtempSync9, rmSync as rmSync18 } from "fs";
|
|
18323
18620
|
import { tmpdir as tmpdir5 } from "os";
|
|
18324
|
-
import { join as
|
|
18621
|
+
import { join as join42 } from "path";
|
|
18325
18622
|
|
|
18326
18623
|
// ../producer/src/services/distributed/assemble.ts
|
|
18327
18624
|
import {
|
|
@@ -18331,11 +18628,11 @@ import {
|
|
|
18331
18628
|
mkdtempSync as mkdtempSync8,
|
|
18332
18629
|
readFileSync as readFileSync13,
|
|
18333
18630
|
readdirSync as readdirSync10,
|
|
18334
|
-
rmSync as
|
|
18335
|
-
statSync as
|
|
18631
|
+
rmSync as rmSync16,
|
|
18632
|
+
statSync as statSync11,
|
|
18336
18633
|
writeFileSync as writeFileSync12
|
|
18337
18634
|
} from "fs";
|
|
18338
|
-
import { dirname as dirname16, join as
|
|
18635
|
+
import { dirname as dirname16, join as join40 } from "path";
|
|
18339
18636
|
function cfrRateControlArgs(locked) {
|
|
18340
18637
|
const preset = getEncoderPreset(locked.quality ?? "standard", "mp4");
|
|
18341
18638
|
if (locked.crf == null && locked.bitrate) {
|
|
@@ -18359,7 +18656,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
18359
18656
|
outputPath,
|
|
18360
18657
|
durationMs: Date.now() - start,
|
|
18361
18658
|
framesEncoded: plan2.totalFrames,
|
|
18362
|
-
fileSize:
|
|
18659
|
+
fileSize: statSync11(outputPath).size
|
|
18363
18660
|
};
|
|
18364
18661
|
}
|
|
18365
18662
|
const format = plan2.dimensions.format;
|
|
@@ -18387,7 +18684,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
18387
18684
|
};
|
|
18388
18685
|
try {
|
|
18389
18686
|
const videoSources = cfrEncoder ? [await reencodeCfr(ctx, chunkPaths, cfrEncoder)] : chunkPaths;
|
|
18390
|
-
const finalPath =
|
|
18687
|
+
const finalPath = join40(workDir, `output.${format}`);
|
|
18391
18688
|
const audio = audioPath !== null && existsSync26(audioPath) ? audioPath : null;
|
|
18392
18689
|
await writeJoined(ctx, videoSources, audio, finalPath);
|
|
18393
18690
|
renameWithRetry(finalPath, outputPath);
|
|
@@ -18398,7 +18695,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
18398
18695
|
});
|
|
18399
18696
|
} finally {
|
|
18400
18697
|
try {
|
|
18401
|
-
|
|
18698
|
+
rmSync16(workDir, { recursive: true, force: true });
|
|
18402
18699
|
} catch (err) {
|
|
18403
18700
|
log.warn("[assemble] failed to remove work dir", {
|
|
18404
18701
|
workDir,
|
|
@@ -18406,7 +18703,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
18406
18703
|
});
|
|
18407
18704
|
}
|
|
18408
18705
|
}
|
|
18409
|
-
const fileSize = existsSync26(outputPath) ?
|
|
18706
|
+
const fileSize = existsSync26(outputPath) ? statSync11(outputPath).size : 0;
|
|
18410
18707
|
return {
|
|
18411
18708
|
outputPath,
|
|
18412
18709
|
durationMs: Date.now() - start,
|
|
@@ -18415,8 +18712,8 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
18415
18712
|
};
|
|
18416
18713
|
}
|
|
18417
18714
|
function readAssemblePlan(planDir, chunkPaths) {
|
|
18418
|
-
const planJsonPath =
|
|
18419
|
-
const chunksJsonPath =
|
|
18715
|
+
const planJsonPath = join40(planDir, "plan.json");
|
|
18716
|
+
const chunksJsonPath = join40(planDir, "meta", "chunks.json");
|
|
18420
18717
|
if (!existsSync26(planJsonPath)) {
|
|
18421
18718
|
throw new Error(`[assemble] planDir missing plan.json: ${planJsonPath}`);
|
|
18422
18719
|
}
|
|
@@ -18464,7 +18761,7 @@ function cfrEncodeArgs(inputArgs, encoder, fpsArg) {
|
|
|
18464
18761
|
return args;
|
|
18465
18762
|
}
|
|
18466
18763
|
async function reencodeCfr(ctx, chunkPaths, encoder) {
|
|
18467
|
-
const cfrOutputPath =
|
|
18764
|
+
const cfrOutputPath = join40(ctx.workDir, `cfr.${ctx.format}`);
|
|
18468
18765
|
const cfrArgs = cfrEncodeArgs(videoInputArgs(ctx, chunkPaths), encoder, ctx.fpsArg);
|
|
18469
18766
|
appendRenderProvenanceArgs(cfrArgs, cfrOutputPath);
|
|
18470
18767
|
cfrArgs.push("-y", cfrOutputPath);
|
|
@@ -18491,7 +18788,7 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
|
|
|
18491
18788
|
);
|
|
18492
18789
|
return;
|
|
18493
18790
|
}
|
|
18494
|
-
const paddedAudioPath =
|
|
18791
|
+
const paddedAudioPath = join40(ctx.workDir, "audio-padded.m4a");
|
|
18495
18792
|
const padTrimResult = await ctx.timed(
|
|
18496
18793
|
"audioMs",
|
|
18497
18794
|
() => padOrTrimAudioToVideoFrameCount({
|
|
@@ -18531,7 +18828,7 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
|
|
|
18531
18828
|
}
|
|
18532
18829
|
}
|
|
18533
18830
|
function concatDemuxerInput(chunkPaths, workDir, fpsArg) {
|
|
18534
|
-
const listPath =
|
|
18831
|
+
const listPath = join40(workDir, "concat-list.txt");
|
|
18535
18832
|
const body = chunkPaths.map((path) => `file '${path.replace(/'/g, "'\\''")}'`).join("\n");
|
|
18536
18833
|
writeFileSync12(listPath, `${body}
|
|
18537
18834
|
`, "utf-8");
|
|
@@ -18569,11 +18866,11 @@ function stitchesSeparateAudio(planDir) {
|
|
|
18569
18866
|
return lockedAudio(planDir).separateAudio === true;
|
|
18570
18867
|
}
|
|
18571
18868
|
function planFormat(planDir) {
|
|
18572
|
-
const plan2 = JSON.parse(readFileSync13(
|
|
18869
|
+
const plan2 = JSON.parse(readFileSync13(join40(planDir, "plan.json"), "utf-8"));
|
|
18573
18870
|
return plan2.dimensions.format;
|
|
18574
18871
|
}
|
|
18575
18872
|
function lockedAudio(planDir) {
|
|
18576
|
-
const encoderJsonPath =
|
|
18873
|
+
const encoderJsonPath = join40(planDir, "meta", "encoder.json");
|
|
18577
18874
|
if (!existsSync26(encoderJsonPath)) return {};
|
|
18578
18875
|
return JSON.parse(readFileSync13(encoderJsonPath, "utf-8"));
|
|
18579
18876
|
}
|
|
@@ -18583,7 +18880,7 @@ function readCfrEncoder(planDir, format) {
|
|
|
18583
18880
|
`[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.`
|
|
18584
18881
|
);
|
|
18585
18882
|
}
|
|
18586
|
-
const encoderJsonPath =
|
|
18883
|
+
const encoderJsonPath = join40(planDir, "meta", "encoder.json");
|
|
18587
18884
|
if (!existsSync26(encoderJsonPath)) {
|
|
18588
18885
|
throw new Error(`[assemble] planDir missing meta/encoder.json: ${encoderJsonPath}`);
|
|
18589
18886
|
}
|
|
@@ -18596,11 +18893,11 @@ function readCfrEncoder(planDir, format) {
|
|
|
18596
18893
|
return encoderJson;
|
|
18597
18894
|
}
|
|
18598
18895
|
function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, startTimeMs) {
|
|
18599
|
-
if (existsSync26(outputPath))
|
|
18896
|
+
if (existsSync26(outputPath)) rmSync16(outputPath, { recursive: true, force: true });
|
|
18600
18897
|
mkdirSync16(outputPath, { recursive: true });
|
|
18601
18898
|
let globalIdx = 0;
|
|
18602
18899
|
for (const chunkDir of chunkPaths) {
|
|
18603
|
-
if (!
|
|
18900
|
+
if (!statSync11(chunkDir).isDirectory()) {
|
|
18604
18901
|
throw new Error(
|
|
18605
18902
|
`[assemble] png-sequence chunk must be a directory: ${chunkDir} (got a file)`
|
|
18606
18903
|
);
|
|
@@ -18610,8 +18907,8 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
18610
18907
|
throw new Error(`[assemble] png-sequence chunk has no frames: ${chunkDir}`);
|
|
18611
18908
|
}
|
|
18612
18909
|
for (const frame of frames) {
|
|
18613
|
-
const dst =
|
|
18614
|
-
cpSync3(
|
|
18910
|
+
const dst = join40(outputPath, formatExportFrameName(globalIdx, "png"));
|
|
18911
|
+
cpSync3(join40(chunkDir, frame), dst);
|
|
18615
18912
|
globalIdx += 1;
|
|
18616
18913
|
}
|
|
18617
18914
|
}
|
|
@@ -18621,13 +18918,13 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
18621
18918
|
);
|
|
18622
18919
|
}
|
|
18623
18920
|
if (audioPath !== null && existsSync26(audioPath)) {
|
|
18624
|
-
const sidecar =
|
|
18921
|
+
const sidecar = join40(outputPath, MIXED_AUDIO_FILENAME);
|
|
18625
18922
|
cpSync3(audioPath, sidecar);
|
|
18626
18923
|
}
|
|
18627
18924
|
let fileSize = 0;
|
|
18628
18925
|
for (const name of readdirSync10(outputPath)) {
|
|
18629
18926
|
try {
|
|
18630
|
-
fileSize +=
|
|
18927
|
+
fileSize += statSync11(join40(outputPath, name)).size;
|
|
18631
18928
|
} catch {
|
|
18632
18929
|
}
|
|
18633
18930
|
}
|
|
@@ -18641,9 +18938,9 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
18641
18938
|
|
|
18642
18939
|
// ../producer/src/services/distributed/renderChunk.ts
|
|
18643
18940
|
import { randomBytes } from "crypto";
|
|
18644
|
-
import { existsSync as existsSync27, mkdirSync as mkdirSync17, readFileSync as readFileSync14, readdirSync as readdirSync11, rmSync as
|
|
18941
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync17, readFileSync as readFileSync14, readdirSync as readdirSync11, rmSync as rmSync17, writeFileSync as writeFileSync13 } from "fs";
|
|
18645
18942
|
import { cpus as cpus3 } from "os";
|
|
18646
|
-
import { join as
|
|
18943
|
+
import { join as join41 } from "path";
|
|
18647
18944
|
var LEGACY_DISTRIBUTED_VP9_CPU_USED = 2;
|
|
18648
18945
|
function validatePlanVideosForChunk(value) {
|
|
18649
18946
|
try {
|
|
@@ -18745,7 +19042,7 @@ function hashChunkOutput(outputPath, kind) {
|
|
|
18745
19042
|
if (kind === "file") return sha256Hex(readFileSync14(outputPath));
|
|
18746
19043
|
const entries = readdirSync11(outputPath).filter((name) => /\.(png|jpg|jpeg)$/i.test(name)).sort();
|
|
18747
19044
|
const lines = entries.map(
|
|
18748
|
-
(name) => `${name}\0${sha256Hex(readFileSync14(
|
|
19045
|
+
(name) => `${name}\0${sha256Hex(readFileSync14(join41(outputPath, name)))}`
|
|
18749
19046
|
);
|
|
18750
19047
|
return sha256Hex(lines.join("\0"));
|
|
18751
19048
|
}
|
|
@@ -18762,9 +19059,9 @@ function resolveLockedVp9CpuUsed(lockedEncoder) {
|
|
|
18762
19059
|
async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
18763
19060
|
const start = Date.now();
|
|
18764
19061
|
const log = defaultLogger;
|
|
18765
|
-
const planJsonPath =
|
|
18766
|
-
const encoderJsonPath =
|
|
18767
|
-
const chunksJsonPath =
|
|
19062
|
+
const planJsonPath = join41(planDir, "plan.json");
|
|
19063
|
+
const encoderJsonPath = join41(planDir, "meta", "encoder.json");
|
|
19064
|
+
const chunksJsonPath = join41(planDir, "meta", "chunks.json");
|
|
18768
19065
|
if (!existsSync27(planJsonPath)) {
|
|
18769
19066
|
throw new RenderChunkValidationError(
|
|
18770
19067
|
MISSING_PLAN_ARTIFACT,
|
|
@@ -18790,7 +19087,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
18790
19087
|
}
|
|
18791
19088
|
const encoder = JSON.parse(readFileSync14(encoderJsonPath, "utf-8"));
|
|
18792
19089
|
const chunks = JSON.parse(readFileSync14(chunksJsonPath, "utf-8"));
|
|
18793
|
-
const videosJsonPath =
|
|
19090
|
+
const videosJsonPath = join41(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
|
|
18794
19091
|
let planVideos = null;
|
|
18795
19092
|
if (existsSync27(videosJsonPath)) {
|
|
18796
19093
|
try {
|
|
@@ -18822,7 +19119,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
18822
19119
|
}
|
|
18823
19120
|
const range = resolveChunkFrameRange(slice, chunkIndex, options?.frameRange);
|
|
18824
19121
|
const framesInChunk = range.endFrame - range.startFrame;
|
|
18825
|
-
const compiledDir =
|
|
19122
|
+
const compiledDir = join41(planDir, "compiled");
|
|
18826
19123
|
if (!existsSync27(compiledDir)) {
|
|
18827
19124
|
throw new RenderChunkValidationError(
|
|
18828
19125
|
MISSING_PLAN_ARTIFACT,
|
|
@@ -18880,7 +19177,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
18880
19177
|
};
|
|
18881
19178
|
const workDir = `${outputChunkPath}.work.${process.pid}.${randomBytes(4).toString("hex")}`;
|
|
18882
19179
|
mkdirSync17(workDir, { recursive: true });
|
|
18883
|
-
const framesDir =
|
|
19180
|
+
const framesDir = join41(workDir, "captured-frames");
|
|
18884
19181
|
mkdirSync17(framesDir, { recursive: true });
|
|
18885
19182
|
const videoFramesDir = `${workDir}.video-frames`;
|
|
18886
19183
|
const chunkFrameNumbers = Array.from({ length: framesInChunk }, (_, i) => range.startFrame + i);
|
|
@@ -18905,7 +19202,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
18905
19202
|
dimensions: plan2.dimensions,
|
|
18906
19203
|
encoder,
|
|
18907
19204
|
videoCount: planVideos?.videos.length ?? 0,
|
|
18908
|
-
html: readFileSync14(
|
|
19205
|
+
html: readFileSync14(join41(compiledDir, "index.html"), "utf-8"),
|
|
18909
19206
|
// The plan ships a deferred source only to chunks that show it; don't wait on the rest.
|
|
18910
19207
|
skipReadinessVideoIds: deferredVideos.filter(
|
|
18911
19208
|
(video) => !shownFrames.get(video.videoId)?.size || remoteVideoIds.has(video.videoId)
|
|
@@ -18914,15 +19211,17 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
18914
19211
|
deferredVideos.filter((video) => remoteVideoIds.has(video.videoId))
|
|
18915
19212
|
)
|
|
18916
19213
|
});
|
|
19214
|
+
const captureFrames = effectiveChunkFrames(framesInChunk, slice.captureCost);
|
|
18917
19215
|
const chunkWorkerCount = resolveChunkCaptureWorkers(
|
|
18918
|
-
|
|
18919
|
-
calculateOptimalWorkers(
|
|
19216
|
+
captureFrames,
|
|
19217
|
+
calculateOptimalWorkers(captureFrames, void 0, cfg),
|
|
18920
19218
|
options?.maxCaptureWorkers
|
|
18921
19219
|
);
|
|
18922
19220
|
let session = null;
|
|
18923
19221
|
let outputKind;
|
|
18924
19222
|
let framesEncoded = 0;
|
|
18925
19223
|
let sessionBootMs = 0;
|
|
19224
|
+
let videoExtractMs = 0;
|
|
18926
19225
|
let captureStageMs = 0;
|
|
18927
19226
|
let encodeStageMs = 0;
|
|
18928
19227
|
let captureMode;
|
|
@@ -18988,6 +19287,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
18988
19287
|
session = null;
|
|
18989
19288
|
}
|
|
18990
19289
|
}
|
|
19290
|
+
const extractStarted = Date.now();
|
|
18991
19291
|
const deferredVideoFrames = planVideos ? extractDeferredVideoFramesForChunk({
|
|
18992
19292
|
planDir,
|
|
18993
19293
|
planVideos,
|
|
@@ -18997,6 +19297,9 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
18997
19297
|
cfg,
|
|
18998
19298
|
remoteSources,
|
|
18999
19299
|
shownBoxes
|
|
19300
|
+
}).then((frames) => {
|
|
19301
|
+
videoExtractMs = Date.now() - extractStarted;
|
|
19302
|
+
return frames;
|
|
19000
19303
|
}) : Promise.resolve([]);
|
|
19001
19304
|
extraction = deferredVideoFrames;
|
|
19002
19305
|
const videoFrameLookup = planVideos && planVideos.extracted.length > 0 ? deferredVideoFrames.then(
|
|
@@ -19030,7 +19333,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
19030
19333
|
if (isPngSequence) {
|
|
19031
19334
|
if (!existsSync27(outputChunkPath)) mkdirSync17(outputChunkPath, { recursive: true });
|
|
19032
19335
|
} else {
|
|
19033
|
-
const outDir =
|
|
19336
|
+
const outDir = join41(outputChunkPath, "..");
|
|
19034
19337
|
if (!existsSync27(outDir)) mkdirSync17(outDir, { recursive: true });
|
|
19035
19338
|
}
|
|
19036
19339
|
const encodeInput = {
|
|
@@ -19134,7 +19437,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
19134
19437
|
return observedChunkCaptureMode(capturePerfs);
|
|
19135
19438
|
},
|
|
19136
19439
|
resetForScreenshotRetry: () => {
|
|
19137
|
-
|
|
19440
|
+
rmSync17(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
19138
19441
|
mkdirSync17(framesDir, { recursive: true });
|
|
19139
19442
|
capturePerfs.length = 0;
|
|
19140
19443
|
captureAttempts.length = 0;
|
|
@@ -19177,8 +19480,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
19177
19480
|
fps: { num: plan2.dimensions.fpsNum, den: plan2.dimensions.fpsDen },
|
|
19178
19481
|
timeoutMs: cfg.ffmpegProcessTimeout
|
|
19179
19482
|
});
|
|
19180
|
-
|
|
19181
|
-
|
|
19483
|
+
rmSync17(videoOnlyPath, { force: true });
|
|
19484
|
+
rmSync17(audioScratchPath, { force: true });
|
|
19182
19485
|
}
|
|
19183
19486
|
encodeStageMs = Date.now() - encodeStarted;
|
|
19184
19487
|
} finally {
|
|
@@ -19214,6 +19517,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
19214
19517
|
sessionBootMs,
|
|
19215
19518
|
captureStageMs,
|
|
19216
19519
|
encodeStageMs,
|
|
19520
|
+
// Wall time of the chunk's own video frame extraction; it overlaps captureStageMs, so do not add them.
|
|
19521
|
+
videoExtractMs,
|
|
19217
19522
|
workers: chunkWorkerCount,
|
|
19218
19523
|
captureMode,
|
|
19219
19524
|
// Device-pixel box each video's frames were extracted to cover; a video not listed kept full size.
|
|
@@ -19226,8 +19531,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
19226
19531
|
writeFileSync13(perfPath, `${JSON.stringify(perfPayload, null, 2)}
|
|
19227
19532
|
`, "utf-8");
|
|
19228
19533
|
try {
|
|
19229
|
-
|
|
19230
|
-
|
|
19534
|
+
rmSync17(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
19535
|
+
rmSync17(videoFramesDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
19231
19536
|
} catch (err) {
|
|
19232
19537
|
log.warn("[renderChunk] failed to remove work dir", {
|
|
19233
19538
|
workDir,
|
|
@@ -19256,18 +19561,18 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
19256
19561
|
|
|
19257
19562
|
// ../producer/src/services/distributed/planV2Execution.ts
|
|
19258
19563
|
async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath, options) {
|
|
19259
|
-
const workRoot = mkdtempSync9(
|
|
19260
|
-
const materializedPlanDir =
|
|
19564
|
+
const workRoot = mkdtempSync9(join42(tmpdir5(), "hf-plan-v2-chunk-"));
|
|
19565
|
+
const materializedPlanDir = join42(workRoot, "plan");
|
|
19261
19566
|
try {
|
|
19262
19567
|
materializePlanV2Target(planV2Dir, { role: "chunk", chunkIndex }, materializedPlanDir);
|
|
19263
19568
|
return await renderChunk(materializedPlanDir, chunkIndex, outputChunkPath, options);
|
|
19264
19569
|
} finally {
|
|
19265
|
-
|
|
19570
|
+
rmSync18(workRoot, { recursive: true, force: true });
|
|
19266
19571
|
}
|
|
19267
19572
|
}
|
|
19268
19573
|
async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
|
|
19269
|
-
const workRoot = mkdtempSync9(
|
|
19270
|
-
const materializedPlanDir =
|
|
19574
|
+
const workRoot = mkdtempSync9(join42(tmpdir5(), "hf-plan-v2-assembler-"));
|
|
19575
|
+
const materializedPlanDir = join42(workRoot, "plan");
|
|
19271
19576
|
try {
|
|
19272
19577
|
const materialized = materializePlanV2Target(
|
|
19273
19578
|
planV2Dir,
|
|
@@ -19282,14 +19587,14 @@ async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
|
|
|
19282
19587
|
options
|
|
19283
19588
|
);
|
|
19284
19589
|
} finally {
|
|
19285
|
-
|
|
19590
|
+
rmSync18(workRoot, { recursive: true, force: true });
|
|
19286
19591
|
}
|
|
19287
19592
|
}
|
|
19288
19593
|
|
|
19289
19594
|
// ../producer/src/services/distributed/projectHash.ts
|
|
19290
|
-
import { closeSync as
|
|
19595
|
+
import { closeSync as closeSync7, openSync as openSync7, readdirSync as readdirSync12, readSync as readSync5, realpathSync as realpathSync2, statSync as statSync12 } from "fs";
|
|
19291
19596
|
import { createHash as createHash7 } from "crypto";
|
|
19292
|
-
import { join as
|
|
19597
|
+
import { join as join43 } from "path";
|
|
19293
19598
|
var READ_CHUNK_BYTES = 256 * 1024;
|
|
19294
19599
|
|
|
19295
19600
|
// ../producer/src/services/distributed/audioSidecar.ts
|