hyperframes 0.8.205 → 0.8.207
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/bin/hyperframes.mjs +1 -0
- package/dist/{add-BA4AU262.js → add-LXFWHBE3.js} +19 -18
- package/dist/{agentPromptGenerator-KYO5MKTW.js → agentPromptGenerator-D2E62ZP5.js} +1 -1
- package/dist/{animatedGifPrep-UNUCFGLQ.js → animatedGifPrep-VBPJZKFT.js} +21 -15
- package/dist/api.js +31 -31
- package/dist/{appHistory-QVCSAOI4.js → appHistory-HIBH6XZW.js} +3 -1
- package/dist/{asset-KCDVTNC3.js → asset-JX4RW3GO.js} +2 -2
- package/dist/{assetCataloger-5FCVQ3N6.js → assetCataloger-JKKOPBCF.js} +15 -14
- package/dist/{audio-KDBPEHRS.js → audio-OXQ3L6DW.js} +24 -24
- package/dist/{auth-IMPBZZXJ.js → auth-JAL7P7ZA.js} +1 -1
- package/dist/{autoUpdate-YE2RKCAG.js → autoUpdate-MRI2AICE.js} +2 -2
- package/dist/{backgroundChecks-OWY2UFSR.js → backgroundChecks-ORR46PBY.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-AN4HWKET.js → batchRender-IFZYPGIW.js} +9 -9
- package/dist/{beats-VTQJ4JH6.js → beats-UDLOEW6U.js} +21 -21
- package/dist/{benchmark-PBEWHJ5K.js → benchmark-VTVDNKSO.js} +14 -14
- package/dist/{browser-E7ANEHNU.js → browser-QJC4BL2Y.js} +6 -6
- package/dist/{bundleWithLocalizedFonts-I3BWMRSP.js → bundleWithLocalizedFonts-Z2JTBNDS.js} +2 -2
- package/dist/{capture-MP7R72WU.js → capture-2P4JERSX.js} +14 -3
- package/dist/{capture-XODFC4S4.js → capture-GLM2ACPM.js} +81 -41
- package/dist/{captureCompositionFrame-2OYGVDI3.js → captureCompositionFrame-A2A5MGQB.js} +19 -19
- package/dist/{captureFile-LYOJOUIE.js → captureFile-RPUEOZO6.js} +1 -1
- package/dist/{catalog-ORVCCEQR.js → catalog-5ZLVUQVJ.js} +25 -24
- package/dist/{catch-up-SYAQOXTT.js → catch-up-FRMVYJHZ.js} +5 -5
- package/dist/{check-6SQR6SSA.js → check-WVY7SM7C.js} +50 -48
- package/dist/checkAudio-PLEQY3SZ.js +201 -0
- package/dist/{checkBrowser-HOTD3CDE.js → checkBrowser-XSZUA2DQ.js} +42 -41
- package/dist/{chunk-JFNB4CMI.js → chunk-526VSRZ4.js} +20 -8
- package/dist/{chunk-DQBY7FRR.js → chunk-543U46OR.js} +4 -1
- package/dist/{chunk-CUGADCIV.js → chunk-5KBMYSF2.js} +54 -15
- package/dist/{chunk-2ST4WAFY.js → chunk-5PCALX6G.js} +13 -1
- package/dist/{chunk-TZ7MTRVJ.js → chunk-5PYRU5DT.js} +13 -13
- package/dist/{chunk-AYH5ANVS.js → chunk-5YHQBCWH.js} +52 -3
- package/dist/{chunk-KBZSMKKD.js → chunk-63DP5CB2.js} +29 -3
- package/dist/{chunk-GLBEBBS2.js → chunk-6IYIS2U7.js} +2 -2
- package/dist/{chunk-GSTFETKE.js → chunk-6KCFVLO6.js} +5 -5
- package/dist/{chunk-EXRHI43B.js → chunk-6KOHY5EP.js} +10 -9
- package/dist/{chunk-CU76YDPX.js → chunk-6Z7XDUUJ.js} +1 -1
- package/dist/{chunk-XNAIYEKD.js → chunk-7PJ3AJB2.js} +1 -1
- package/dist/{chunk-6GAYBX5C.js → chunk-7RWUY3BJ.js} +64 -62
- package/dist/{chunk-3CISA3OS.js → chunk-AF3L5JJX.js} +1 -1
- package/dist/chunk-BDJIQZN2.js +4830 -0
- package/dist/{chunk-75WNFDRU.js → chunk-C53ZNJDZ.js} +4 -4
- package/dist/{chunk-GBQCTZON.js → chunk-CVZO6TFE.js} +13 -43
- package/dist/{chunk-RQDVTUVD.js → chunk-DJQZ7DEH.js} +15 -15
- package/dist/{chunk-KAIQPYCM.js → chunk-DML6BD4K.js} +2 -2
- package/dist/{chunk-BTYT3RT3.js → chunk-EG3B2VWK.js} +2 -2
- package/dist/{chunk-OB7QARSN.js → chunk-EGRIVMCQ.js} +1 -1
- package/dist/{chunk-V4K4BSCM.js → chunk-EHFZEKQM.js} +57 -5
- package/dist/{chunk-H4MSJ2NZ.js → chunk-FEO7YW7V.js} +8 -8
- package/dist/{chunk-FNBEYIZH.js → chunk-FVAI7AHF.js} +13 -12
- package/dist/{chunk-PLGGKTCB.js → chunk-GXUONASF.js} +13 -20
- package/dist/{chunk-L6N2TLXR.js → chunk-H3LQ5X6Q.js} +84 -79
- package/dist/{chunk-MVXOY5RC.js → chunk-HA3V4XAF.js} +6 -6
- package/dist/{chunk-WB55EQNJ.js → chunk-HM7SUIQD.js} +38 -9
- package/dist/{chunk-G445Y3YG.js → chunk-HVOTYAS4.js} +15 -7
- package/dist/{chunk-IKYXXIMP.js → chunk-I2TDHVFV.js} +3 -3
- package/dist/{chunk-3N4T6I3O.js → chunk-I3TYUQLB.js} +1 -1
- package/dist/{chunk-AECL3B23.js → chunk-IBZHSU2J.js} +1 -1
- package/dist/{chunk-2FEOM3ZT.js → chunk-ID766OZB.js} +12 -12
- package/dist/{chunk-4UIEQIF4.js → chunk-IK4JY2LI.js} +2 -2
- package/dist/{chunk-C4LV6L4Q.js → chunk-IW5P4KK7.js} +3 -3
- package/dist/{chunk-N7VQD4WB.js → chunk-IYZT62UR.js} +1 -1
- package/dist/chunk-JKE24AG7.js +62 -0
- package/dist/chunk-JLCAHJUO.js +91 -0
- package/dist/{chunk-EUFBE5BW.js → chunk-JLGVBK5M.js} +1 -1
- package/dist/{chunk-6NC4KBS2.js → chunk-JQ32262N.js} +1 -1
- package/dist/{chunk-J2E3VVOS.js → chunk-KDHHPJOG.js} +4 -4
- package/dist/{chunk-A42PDANH.js → chunk-LCCYYTEK.js} +1 -1
- package/dist/{chunk-T2UR3T4L.js → chunk-LK6KPVX2.js} +263 -74
- package/dist/{chunk-RWOWD3PW.js → chunk-LPI7HX4G.js} +2 -2
- package/dist/{chunk-UR6BAPOD.js → chunk-LXP6XWJL.js} +2 -2
- package/dist/{chunk-4RPCYGZG.js → chunk-MAUGXKSI.js} +4 -4
- package/dist/{chunk-AII6P2TC.js → chunk-MMJAHBH2.js} +1 -1
- package/dist/{chunk-LFGJWOVA.js → chunk-MNNK7RV5.js} +11 -8
- package/dist/{chunk-26OI2B2X.js → chunk-MSHL6CF2.js} +1 -1
- package/dist/{chunk-SVVAUJPL.js → chunk-NHA4NRBE.js} +136 -25
- package/dist/{chunk-5F6B6KMK.js → chunk-NHL5CMO2.js} +18 -3
- package/dist/{chunk-NF6KI46X.js → chunk-NJNC2DQV.js} +31 -28
- package/dist/{chunk-I7IXUCKL.js → chunk-NSC5A4IR.js} +1 -1
- package/dist/{chunk-MRF4AMKD.js → chunk-NWGXTUYS.js} +32 -10
- package/dist/{chunk-57I5KNTL.js → chunk-PL36HK3U.js} +3 -3
- package/dist/{chunk-TOEIJ4WF.js → chunk-PUIG6DHT.js} +5 -5
- package/dist/{chunk-BA7MQJXG.js → chunk-QE4WRS3N.js} +3 -3
- package/dist/{chunk-7V7OUKTU.js → chunk-QTWXVOZI.js} +1 -1
- package/dist/{chunk-V2XXV2EH.js → chunk-QZ2JQ6O4.js} +6 -6
- package/dist/{chunk-BHOGXIBO.js → chunk-RPZNQV6D.js} +58 -826
- package/dist/{chunk-2BGOB2QK.js → chunk-SE2MXV2N.js} +136 -25
- package/dist/{chunk-HADQPG7O.js → chunk-SXOD5J7T.js} +2 -2
- package/dist/{chunk-32R2AFZ3.js → chunk-T4JGFCXU.js} +3 -3
- package/dist/chunk-TQBQYO4L.js +55 -0
- package/dist/{chunk-ZSUWGNIT.js → chunk-TSTONNOD.js} +2 -2
- package/dist/chunk-TSYRN646.js +84 -0
- package/dist/{chunk-BZ727KLT.js → chunk-U32PA6DI.js} +1 -1
- package/dist/{chunk-5PVPGWMH.js → chunk-UAT2UMTP.js} +1 -1
- package/dist/{chunk-TGS33LDU.js → chunk-UKM3JYNB.js} +5 -71
- package/dist/{chunk-UEOGIZ3Q.js → chunk-UUOIH4RW.js} +3 -3
- package/dist/{chunk-MASFRPCB.js → chunk-UYPWH7PH.js} +10 -10
- package/dist/{chunk-LSQM3NBR.js → chunk-VAVDAOUA.js} +1 -1
- package/dist/chunk-VBPNCOD7.js +355 -0
- package/dist/{chunk-HQ3CFNHL.js → chunk-VH4PNYOS.js} +1 -1
- package/dist/{chunk-IXXVS2Z4.js → chunk-VQB7G5BM.js} +1 -1
- package/dist/{chunk-FLREUEHW.js → chunk-W4DMQZL5.js} +1 -1
- package/dist/{chunk-RXATE6FZ.js → chunk-WC4MTXGN.js} +22 -0
- package/dist/{chunk-F2ASNL2K.js → chunk-WL263XM2.js} +1 -1
- package/dist/{chunk-ZB6SCA4J.js → chunk-XAGBSYIQ.js} +9 -2
- package/dist/{chunk-LQUMMPGK.js → chunk-XKW4Z7BU.js} +1 -1
- package/dist/chunk-XMRA7CQG.js +22 -0
- package/dist/{chunk-6YYFNGCS.js → chunk-XULJBZ7K.js} +7 -4
- package/dist/chunk-YJK6HOL5.js +29 -0
- package/dist/{chunk-KVNXEAVT.js → chunk-ZCJ5EGLU.js} +30 -10
- package/dist/{chunk-ERUINDRT.js → chunk-ZF3R2IPC.js} +184 -183
- package/dist/{chunk-AECSY5LT.js → chunk-ZYGIDXAK.js} +569 -378
- package/dist/{clean-BW7NHQS5.js → clean-TL3IPJDN.js} +28 -28
- package/dist/cli.js +55 -55
- package/dist/{cloud-TZVXTWZO.js → cloud-EYMRPJNY.js} +4 -4
- package/dist/{cloudrun-KRIETALO.js → cloudrun-TOJ36NLX.js} +11 -11
- package/dist/commands/layout-audit.browser.js +3 -15
- package/dist/{compare-WYWHJ4CR.js → compare-MP5EOW4D.js} +40 -40
- package/dist/{compiler-ANIPXLJ7.js → compiler-NOPVLJ2S.js} +15 -15
- package/dist/{component-CY7DCX56.js → component-ASACDCZK.js} +3 -3
- package/dist/{compositions-5YEB24E3.js → compositions-WKNZJY34.js} +19 -19
- package/dist/{contactSheet-5APX35L3.js → contactSheet-YOBPATEM.js} +2 -2
- package/dist/{delete-6642PDON.js → delete-DQTFHP3G.js} +2 -2
- package/dist/{deploy-NZP6TZLS.js → deploy-HHCFOUFM.js} +4 -4
- package/dist/{deterministicFonts-HQYCUUAL.js → deterministicFonts-LKAGUNE5.js} +3 -3
- package/dist/{dist-V2BGP46S.js → dist-L4Z4ZEYW.js} +7 -4
- package/dist/{dist-DGFC75NC.js → dist-NQEYA4ZX.js} +44 -36
- package/dist/docs/rendering.md +3 -0
- package/dist/{doctor-ZW4A2FS3.js → doctor-JDM65CP7.js} +20 -20
- package/dist/{events-NJU4VFDA.js → events-MBRNA3UF.js} +3 -3
- package/dist/{events-XRCHY2F6.js → events-RKRHRLJD.js} +2 -2
- package/dist/{feedback-NQLSZMES.js → feedback-LZWIWV5J.js} +17 -17
- package/dist/{ffmpeg-RYDQLG3G.js → ffmpeg-4PZKSIGE.js} +15 -15
- package/dist/{figma-TJAMP2CI.js → figma-QFNYUT3F.js} +3 -3
- package/dist/fontLocalizeCli.js +20 -18
- package/dist/{get-RRZ3O26X.js → get-2B5ENJOH.js} +2 -2
- package/dist/{gpuPolicy-4WLHUUS3.js → gpuPolicy-E5FB2GFR.js} +13 -13
- package/dist/{grade-compare-P7PE3NAA.js → grade-compare-4GUAPJHE.js} +40 -40
- package/dist/{gsapParser-IEUSLYDJ.js → gsapParser-3H7ON3DO.js} +1 -1
- package/dist/{gsapParserAcorn-LZJKCFQI.js → gsapParserAcorn-5YD4N6HQ.js} +2 -2
- package/dist/hangReport.js +47 -0
- package/dist/heifImagePrep-C2RYIEER.js +53 -0
- package/dist/{help-6RELRVIW.js → help-XGDAXV67.js} +1 -1
- package/dist/{history-GIIDYND3.js → history-WNFF6HGU.js} +108 -60
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +75 -68
- package/dist/hyperframes-player.global.js +3 -3
- package/dist/hyperframes-slideshow.global.js +16 -16
- package/dist/{info-LBUA2DXE.js → info-BR2LKGJD.js} +16 -16
- package/dist/{init-QUPXBONY.js → init-P6UWPUY3.js} +59 -58
- package/dist/{inspect-CL42DJZ4.js → inspect-MSRPF7ZO.js} +40 -39
- package/dist/inspection.js +4 -4
- package/dist/{installer-VR7XDLR3.js → installer-MPUQS3ZX.js} +10 -10
- package/dist/{keyframes-LELLROMA.js → keyframes-J6K66QTO.js} +11 -11
- package/dist/{lambda-I6KFXWOO.js → lambda-LJ2OSWFJ.js} +32 -13
- package/dist/{layout-NR6SNRZE.js → layout-CDY65XGA.js} +40 -39
- package/dist/{lint-DYEMSEQR.js → lint-CAUNBGPX.js} +13 -10
- package/dist/{lintProject-EA4NPL2X.js → lintProject-ZTSX3AWT.js} +7 -4
- package/dist/{list-RDURYO5U.js → list-33BYQNRZ.js} +2 -2
- package/dist/{login-VKLET5OL.js → login-5QMRKOHK.js} +4 -4
- package/dist/{manager-IYT3THJN.js → manager-3JOHHPVR.js} +17 -17
- package/dist/{manager-7TSUZKXU.js → manager-RMYSZ3KI.js} +7 -3
- package/dist/{media-treatment-I4AFEQZ3.js → media-treatment-4WP22CFN.js} +23 -23
- package/dist/{models-LLPVGC2E.js → models-HPWCHAZX.js} +28 -28
- package/dist/{motionShot-6A6HH6IK.js → motionShot-I7GDIROQ.js} +23 -23
- package/dist/{normalize-audio-KVQJBYLT.js → normalize-audio-VTMXPSC7.js} +14 -14
- package/dist/{open-J4ZT4X3C.js → open-SAO7OQTT.js} +19 -19
- package/dist/{parakeetRunner-FLUCIDIZ.js → parakeetRunner-ZYPBIA73.js} +25 -25
- package/dist/{pipeline-RRVLGALQ.js → pipeline-VNBMR6QU.js} +16 -16
- package/dist/{play-QGJSXUVM.js → play-7VI6A7KN.js} +42 -32
- package/dist/{preflight-SP2ZERBE.js → preflight-VWV7L45J.js} +17 -17
- package/dist/{present-UR4YBHMX.js → present-CSJGYOFF.js} +37 -27
- package/dist/{preview-6ENCRU4C.js → preview-B246ZTVO.js} +60 -45
- package/dist/{producer-OMHZRY6A.js → producer-WJLFDVQJ.js} +1 -1
- package/dist/{projectConfig-NGS7GJ47.js → projectConfig-OMR46ZWQ.js} +14 -13
- package/dist/{publication-6NYQA22Y.js → publication-AA7NNYET.js} +8 -8
- package/dist/{publish-E6RE5VHB.js → publish-TJ4QVVSP.js} +18 -17
- package/dist/{remove-background-66PQRA7R.js → remove-background-LQ2V7W7N.js} +20 -20
- package/dist/{render-ZLRJUFMX.js → render-AWEEPG3F.js} +39 -37
- package/dist/{render-SBAZWXPO.js → render-E5QJG74D.js} +14 -11
- package/dist/{render-IMSGS6BD.js → render-JLTNZ36U.js} +83 -51
- package/dist/{render-batch-MO7LYZSP.js → render-batch-U4T4VSCM.js} +14 -11
- package/dist/renderSetupWorker.js +11 -8
- package/dist/{resolver-QMBVTAKT.js → resolver-GXCTUKPV.js} +10 -10
- package/dist/{screenshotCapture-I5EDCITF.js → screenshotCapture-X6OKIXCB.js} +1 -1
- package/dist/{sherpa-JZRDL3OE.js → sherpa-4VZWVHWZ.js} +24 -24
- package/dist/skills/hyperframes-cli/references/init-and-scaffold.md +1 -0
- package/dist/skills/hyperframes-cli/references/lambda.md +3 -0
- package/dist/skills/hyperframes-cli/references/preview-render.md +3 -0
- package/dist/{skills-YBTEWFYS.js → skills-WUKR7SUE.js} +8 -8
- package/dist/{skillsUpdateCheck-Z4HTDZJN.js → skillsUpdateCheck-YXRBY3JC.js} +3 -3
- package/dist/{snapshot-5F5UV6H5.js → snapshot-Q7S2FTNG.js} +143 -77
- package/dist/{src-WWXYV2TS.js → src-CLAALR5W.js} +26 -19
- package/dist/{src-UTW3F2PM.js → src-ZOXUSGAP.js} +24 -12
- package/dist/{staticProjectServer-UHZ63C5O.js → staticProjectServer-DQ7PIDPA.js} +26 -26
- package/dist/studio/assets/hyperframes-player-Cm5aBiKq.js +478 -0
- package/dist/studio/assets/{index-dy6GQJn4.js → index-BF9YeBnC.js} +142 -142
- package/dist/studio/assets/{index-C8hp9Y7c.js → index-BrqAmMRt.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-BHZ3PHL2.js → studio-api-NUE227JM.js} +18 -18
- package/dist/{studioSelectionClient-IUUPKUHZ.js → studioSelectionClient-D6VMGTKQ.js} +1 -1
- package/dist/{studioServer-AFUXWRB5.js → studioServer-HVOKP4VI.js} +81 -70
- package/dist/{synthesize-PKTB5ATG.js → synthesize-QZHRXGRY.js} +30 -8
- package/dist/{telemetry-UYKOT4OJ.js → telemetry-2Y5JXLDB.js} +3 -3
- package/dist/{timeline-K5NLEMH4.js → timeline-WOQGXFRV.js} +28 -28
- package/dist/{tokens-FCOSWE2O.js → tokens-T3OHTWUC.js} +2 -2
- package/dist/{transcribe-SIFMTW5W.js → transcribe-4U74P5TG.js} +22 -22
- package/dist/{transcribe-K2QTXDQR.js → transcribe-JZ3BO546.js} +32 -32
- package/dist/{tts-5I2AJNLM.js → tts-AY4JO5NQ.js} +2 -2
- package/dist/{updateCheck-JZ6TBZVE.js → updateCheck-6EUAGAM4.js} +2 -2
- package/dist/{upgrade-TUPAJXQQ.js → upgrade-55K6F4MP.js} +2 -2
- package/dist/upstreamProxy-W5FWAT5Z.js +17 -0
- package/dist/{urlDownloader-L4775QID.js → urlDownloader-47JMOLNN.js} +12 -12
- package/dist/{validate-4HVVMEBV.js → validate-QBJ3SBS4.js} +32 -32
- package/dist/{video-4OGPF3IE.js → video-3ZAUNAR3.js} +17 -15
- package/dist/warmCheck.js +50 -48
- package/package.json +2 -1
- package/dist/chunk-4YYJOFKS.js +0 -28
- package/dist/chunk-ZUQZP6QD.js +0 -3986
- package/dist/studio/assets/hyperframes-player-DzdSmJdB.js +0 -478
|
@@ -4,6 +4,16 @@ import { dirname as __hf_dirname } from "node:path";
|
|
|
4
4
|
var require = __hf_createRequire(import.meta.url);
|
|
5
5
|
var __filename = __hf_fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
Semaphore,
|
|
9
|
+
prepareHeifImageInputs,
|
|
10
|
+
withMediaProbeSlot
|
|
11
|
+
} from "./chunk-VBPNCOD7.js";
|
|
12
|
+
import {
|
|
13
|
+
EncoderInterruptedError,
|
|
14
|
+
encoderFailureError,
|
|
15
|
+
prepareAnimatedGifInputs
|
|
16
|
+
} from "./chunk-XULJBZ7K.js";
|
|
7
17
|
import {
|
|
8
18
|
GENERIC_FAMILIES,
|
|
9
19
|
collectFontFamilyCustomProperties,
|
|
@@ -11,15 +21,10 @@ import {
|
|
|
11
21
|
iterateFontFamilyDeclarations,
|
|
12
22
|
normalizeSystemFontPrimaryFamilies,
|
|
13
23
|
resolveFontFamilyDeclarationFamilies
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import {
|
|
16
|
-
EncoderInterruptedError,
|
|
17
|
-
encoderFailureError,
|
|
18
|
-
prepareAnimatedGifInputs
|
|
19
|
-
} from "./chunk-6YYFNGCS.js";
|
|
24
|
+
} from "./chunk-JLGVBK5M.js";
|
|
20
25
|
import {
|
|
21
26
|
parseEncoderOptions
|
|
22
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-5YHQBCWH.js";
|
|
23
28
|
import {
|
|
24
29
|
RENDER_TEMP_DIR,
|
|
25
30
|
createStudioPositionSeekReapplyScript
|
|
@@ -40,6 +45,7 @@ import {
|
|
|
40
45
|
aacSegmentCount,
|
|
41
46
|
analyzeCompositionHdr,
|
|
42
47
|
analyzeKeyframeIntervals,
|
|
48
|
+
appendRateCapArgs,
|
|
43
49
|
appendRenderProvenanceArgs,
|
|
44
50
|
appendSoftwareEncoderThreadsArg,
|
|
45
51
|
applyConcreteGpuScreenshotClamp,
|
|
@@ -65,6 +71,7 @@ import {
|
|
|
65
71
|
cloneCaptureWarning,
|
|
66
72
|
cloneCaptureWarnings,
|
|
67
73
|
closeCaptureSession,
|
|
74
|
+
collectScratchLeftovers,
|
|
68
75
|
completeDeferredDrawElementInit,
|
|
69
76
|
compositionRequiresWebGpu,
|
|
70
77
|
computeWorkerSizing,
|
|
@@ -119,6 +126,7 @@ import {
|
|
|
119
126
|
isVideoFrameFormat,
|
|
120
127
|
isVideoHiddenBeforeStreamStart,
|
|
121
128
|
isVideoPastTimelineEnd,
|
|
129
|
+
keyframeIntervalToGopSize,
|
|
122
130
|
measureVideoShownBoxes,
|
|
123
131
|
mergeWorkerFrames,
|
|
124
132
|
muxVideoWithAudio,
|
|
@@ -139,6 +147,7 @@ import {
|
|
|
139
147
|
readWebGlVendorInfoFromCanvas,
|
|
140
148
|
recaptureDrawElementFrameForVerify,
|
|
141
149
|
removeDomLayerMask,
|
|
150
|
+
removeScratch,
|
|
142
151
|
renameWithRetry,
|
|
143
152
|
resampleRgb48leObjectFit,
|
|
144
153
|
resolveBrowserGpuMode,
|
|
@@ -162,7 +171,19 @@ import {
|
|
|
162
171
|
verifyDiskDrawElementSamples,
|
|
163
172
|
videoAudioId,
|
|
164
173
|
writeCapturedFrame
|
|
165
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-LK6KPVX2.js";
|
|
175
|
+
import {
|
|
176
|
+
assignBundledRuntimeCompositionIds,
|
|
177
|
+
emitMountedModuleScripts,
|
|
178
|
+
emitRootCompositionVariableStyles,
|
|
179
|
+
ensureExternalLinkTag,
|
|
180
|
+
ensureExternalScriptTag,
|
|
181
|
+
extractStandaloneEntryFromIndex,
|
|
182
|
+
inlineSubCompositions,
|
|
183
|
+
parsesAsScript,
|
|
184
|
+
prepareFlattenedInnerRoot,
|
|
185
|
+
stripSdrPngColourTags
|
|
186
|
+
} from "./chunk-RPZNQV6D.js";
|
|
166
187
|
import {
|
|
167
188
|
DISTRIBUTED_FPS,
|
|
168
189
|
HF_VFX_ATTR,
|
|
@@ -178,28 +199,17 @@ import {
|
|
|
178
199
|
parseVfxChain,
|
|
179
200
|
resolveAuthoredTimingWindow,
|
|
180
201
|
toFps
|
|
181
|
-
} from "./chunk-
|
|
182
|
-
import {
|
|
183
|
-
assignBundledRuntimeCompositionIds,
|
|
184
|
-
buildVariablesByCompScript,
|
|
185
|
-
dedupeFontFaceRules,
|
|
186
|
-
emitMountedModuleScripts,
|
|
187
|
-
emitRootCompositionVariableStyles,
|
|
188
|
-
ensureExternalLinkTag,
|
|
189
|
-
ensureExternalScriptTag,
|
|
190
|
-
extractStandaloneEntryFromIndex,
|
|
191
|
-
inlineSubCompositions,
|
|
192
|
-
parsesAsScript,
|
|
193
|
-
prepareFlattenedInnerRoot
|
|
194
|
-
} from "./chunk-BHOGXIBO.js";
|
|
202
|
+
} from "./chunk-7RWUY3BJ.js";
|
|
195
203
|
import {
|
|
196
204
|
COMPOSITION_SOURCE_URL,
|
|
197
205
|
HF_COLOR_GRADING_ATTR,
|
|
198
206
|
MAX_AUDIO_GAIN,
|
|
199
207
|
MEDIA_RENDER_ID_ATTR,
|
|
200
208
|
assignMediaRenderIds,
|
|
209
|
+
buildVariablesByCompScript,
|
|
201
210
|
clampDurations,
|
|
202
211
|
compileTimingAttrs,
|
|
212
|
+
dedupeFontFaceRules,
|
|
203
213
|
deferScriptsUntilFonts,
|
|
204
214
|
extractResolvedMedia,
|
|
205
215
|
headStyleRuns,
|
|
@@ -224,18 +234,7 @@ import {
|
|
|
224
234
|
sourceTimeAt,
|
|
225
235
|
styleElementsFor,
|
|
226
236
|
timeAtSourceTime
|
|
227
|
-
} from "./chunk-
|
|
228
|
-
import {
|
|
229
|
-
CANVAS_DIMENSIONS,
|
|
230
|
-
HTML_BODY_CSS_HEIGHT_FIRST_RE,
|
|
231
|
-
HTML_BODY_CSS_WIDTH_FIRST_RE,
|
|
232
|
-
VALID_CANVAS_RESOLUTIONS,
|
|
233
|
-
checkOutputResolutionCompatibility,
|
|
234
|
-
extractMediaSrcMutations,
|
|
235
|
-
isAspectAgnosticResolutionAlias,
|
|
236
|
-
normalizeResolutionFlag,
|
|
237
|
-
suggestMatchingPreset
|
|
238
|
-
} from "./chunk-SVVAUJPL.js";
|
|
237
|
+
} from "./chunk-BDJIQZN2.js";
|
|
239
238
|
import {
|
|
240
239
|
TRANSITIONS,
|
|
241
240
|
convertTransfer,
|
|
@@ -251,7 +250,7 @@ import {
|
|
|
251
250
|
import {
|
|
252
251
|
lintHyperframeHtml,
|
|
253
252
|
resolveReferencedStart
|
|
254
|
-
} from "./chunk-
|
|
253
|
+
} from "./chunk-ZCJ5EGLU.js";
|
|
255
254
|
import {
|
|
256
255
|
isUnresolvedAssetPlaceholder,
|
|
257
256
|
readProjectFile,
|
|
@@ -273,7 +272,18 @@ import {
|
|
|
273
272
|
rewriteAssetPaths,
|
|
274
273
|
rewriteCssAssetUrls,
|
|
275
274
|
rewriteInlineStyleAssetUrls
|
|
276
|
-
} from "./chunk-
|
|
275
|
+
} from "./chunk-SE2MXV2N.js";
|
|
276
|
+
import {
|
|
277
|
+
CANVAS_DIMENSIONS,
|
|
278
|
+
HTML_BODY_CSS_HEIGHT_FIRST_RE,
|
|
279
|
+
HTML_BODY_CSS_WIDTH_FIRST_RE,
|
|
280
|
+
VALID_CANVAS_RESOLUTIONS,
|
|
281
|
+
checkOutputResolutionCompatibility,
|
|
282
|
+
extractMediaSrcMutations,
|
|
283
|
+
isAspectAgnosticResolutionAlias,
|
|
284
|
+
normalizeResolutionFlag,
|
|
285
|
+
suggestMatchingPreset
|
|
286
|
+
} from "./chunk-NHA4NRBE.js";
|
|
277
287
|
import {
|
|
278
288
|
parseHTML
|
|
279
289
|
} from "./chunk-GWTIFRF5.js";
|
|
@@ -289,7 +299,7 @@ import {
|
|
|
289
299
|
mkdirSync as mkdirSync8,
|
|
290
300
|
readFileSync as readFileSync7,
|
|
291
301
|
readdirSync as readdirSync5,
|
|
292
|
-
rmSync as
|
|
302
|
+
rmSync as rmSync8,
|
|
293
303
|
statSync as statSync6,
|
|
294
304
|
writeFileSync as writeFileSync5,
|
|
295
305
|
copyFileSync as copyFileSync3,
|
|
@@ -958,6 +968,18 @@ function createFileServer(options) {
|
|
|
958
968
|
html = isIndex ? injectScriptsIntoHtml(html, headScripts, bodyScripts, stripEmbeddedRuntime) : html;
|
|
959
969
|
return c.text(html, 200, { "Content-Type": contentType });
|
|
960
970
|
}
|
|
971
|
+
if (ext === ".png") {
|
|
972
|
+
const untagged = stripSdrPngColourTags(await readFileAsync(fd));
|
|
973
|
+
if (untagged) {
|
|
974
|
+
const headers = {
|
|
975
|
+
"Content-Type": contentType,
|
|
976
|
+
"Content-Length": String(untagged.length)
|
|
977
|
+
};
|
|
978
|
+
return new Response(c.req.method === "HEAD" ? null : new Uint8Array(untagged), {
|
|
979
|
+
headers
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
}
|
|
961
983
|
const totalSize = stat.size;
|
|
962
984
|
const rangeHeader = c.req.header("range");
|
|
963
985
|
const rangeRequest = parseRangeHeader(rangeHeader, totalSize);
|
|
@@ -985,7 +1007,8 @@ function createFileServer(options) {
|
|
|
985
1007
|
const stream = createReadStream(filePath, {
|
|
986
1008
|
fd,
|
|
987
1009
|
autoClose: true,
|
|
988
|
-
|
|
1010
|
+
start: range?.start ?? 0,
|
|
1011
|
+
...range ? { end: range.end } : {}
|
|
989
1012
|
});
|
|
990
1013
|
streamOwnsFd = true;
|
|
991
1014
|
try {
|
|
@@ -1058,7 +1081,7 @@ function resolveHlsSegmentSeconds(config) {
|
|
|
1058
1081
|
return config.hlsSegmentSeconds ?? DEFAULT_HLS_SEGMENT_SECONDS;
|
|
1059
1082
|
}
|
|
1060
1083
|
function resolveHlsGopSize(fps, segmentSeconds) {
|
|
1061
|
-
return
|
|
1084
|
+
return keyframeIntervalToGopSize(fps, segmentSeconds);
|
|
1062
1085
|
}
|
|
1063
1086
|
function resolveHlsEncoderGopLock(outputFormat, fps, segmentSeconds) {
|
|
1064
1087
|
if (outputFormat !== "hls") return { lockGopForChunkConcat: false, gopSize: void 0 };
|
|
@@ -1068,6 +1091,40 @@ function resolveHlsEncoderGopLock(outputFormat, fps, segmentSeconds) {
|
|
|
1068
1091
|
};
|
|
1069
1092
|
}
|
|
1070
1093
|
|
|
1094
|
+
// ../producer/src/services/render/deliveryEncoder.ts
|
|
1095
|
+
function validateDeliveryEncoderConfig(config) {
|
|
1096
|
+
const { keyframeIntervalSeconds, maxBitrate, bufferSize, format } = config;
|
|
1097
|
+
if (keyframeIntervalSeconds === void 0 && maxBitrate === void 0 && bufferSize === void 0)
|
|
1098
|
+
return;
|
|
1099
|
+
if (keyframeIntervalSeconds !== void 0) {
|
|
1100
|
+
if (!Number.isFinite(keyframeIntervalSeconds) || keyframeIntervalSeconds <= 0) {
|
|
1101
|
+
throw new Error(
|
|
1102
|
+
`keyframeIntervalSeconds must be a positive number of seconds; got ${keyframeIntervalSeconds}`
|
|
1103
|
+
);
|
|
1104
|
+
}
|
|
1105
|
+
if (format === "hls") {
|
|
1106
|
+
throw new Error(
|
|
1107
|
+
"keyframeIntervalSeconds does not apply to hls; hlsSegmentSeconds sets its keyframes"
|
|
1108
|
+
);
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
if (format !== void 0 && format !== "mp4") {
|
|
1112
|
+
throw new Error(`keyframeIntervalSeconds and maxBitrate apply to mp4 renders, not ${format}`);
|
|
1113
|
+
}
|
|
1114
|
+
appendRateCapArgs([], { maxBitrate, bufferSize });
|
|
1115
|
+
}
|
|
1116
|
+
function chunkGopFrames(framesInChunk, intervalFrames) {
|
|
1117
|
+
return Math.min(framesInChunk, intervalFrames ?? framesInChunk);
|
|
1118
|
+
}
|
|
1119
|
+
function resolveDeliveryEncoderOptions(config) {
|
|
1120
|
+
const { maxBitrate, bufferSize, keyframeIntervalSeconds } = config;
|
|
1121
|
+
const gop = keyframeIntervalSeconds === void 0 ? resolveHlsEncoderGopLock(config.format ?? "mp4", config.fps, config.hlsSegmentSeconds) : {
|
|
1122
|
+
lockGopForChunkConcat: true,
|
|
1123
|
+
gopSize: keyframeIntervalToGopSize(config.fps, keyframeIntervalSeconds)
|
|
1124
|
+
};
|
|
1125
|
+
return { maxBitrate, bufferSize, ...gop };
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1071
1128
|
// ../producer/src/services/render/shared.ts
|
|
1072
1129
|
import {
|
|
1073
1130
|
copyFileSync,
|
|
@@ -2052,7 +2109,7 @@ function replanSegmentedAfterFailure(plan2, failure) {
|
|
|
2052
2109
|
const keepSegmenting = failure.kind === "draw_element_verification" || failure.kind === "draw_element_capture";
|
|
2053
2110
|
return createCapturePlan({
|
|
2054
2111
|
...plan2,
|
|
2055
|
-
forceScreenshot: keepSegmenting || failure.kind === "capture_failure",
|
|
2112
|
+
forceScreenshot: plan2.forceScreenshot || keepSegmenting || failure.kind === "capture_failure",
|
|
2056
2113
|
useStreamingEncode: true,
|
|
2057
2114
|
useLayeredComposite: false,
|
|
2058
2115
|
useSegmentedCapture: keepSegmenting,
|
|
@@ -4047,7 +4104,6 @@ async function runCaptureStreamingStage(input) {
|
|
|
4047
4104
|
const reorderBuffer = createFrameReorderBuffer(0, totalFrames);
|
|
4048
4105
|
if (workerCount > 1) {
|
|
4049
4106
|
const deParallelStream = forceParallelStream === true || process.env.HF_DE_PARALLEL_STREAM === "true";
|
|
4050
|
-
const tasks = deParallelStream ? distributeFramesInterleaved(totalFrames, workerCount, workDir) : distributeFrames(totalFrames, workerCount, workDir);
|
|
4051
4107
|
const parallelStats = {
|
|
4052
4108
|
verifyChecked: 0,
|
|
4053
4109
|
blankSuspects: 0,
|
|
@@ -4060,143 +4116,158 @@ async function runCaptureStreamingStage(input) {
|
|
|
4060
4116
|
frameTime: (i) => i * job.config.fps.den / job.config.fps.num
|
|
4061
4117
|
});
|
|
4062
4118
|
let parallelGuardRan = false;
|
|
4063
|
-
let
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4119
|
+
let writtenFrames = 0;
|
|
4120
|
+
let resumeFrom = 0;
|
|
4121
|
+
let resumedAfterStall = false;
|
|
4122
|
+
let workerResults;
|
|
4123
|
+
for (; ; ) {
|
|
4124
|
+
const parallelReorder = createFrameReorderBuffer(resumeFrom, totalFrames);
|
|
4125
|
+
const tasks = deParallelStream ? distributeFramesInterleaved(totalFrames - resumeFrom, workerCount, workDir, resumeFrom) : distributeFrames(totalFrames - resumeFrom, workerCount, workDir, resumeFrom);
|
|
4126
|
+
let parallelDrainError = null;
|
|
4127
|
+
const onFrameBuffer = async (frameIndex, buffer, workerSession) => {
|
|
4128
|
+
try {
|
|
4129
|
+
if (deParallelStream && workerSession.captureMode === "drawelement") {
|
|
4130
|
+
parallelGuardRan = true;
|
|
4131
|
+
buffer = await parallelGuard(workerSession, frameIndex, buffer);
|
|
4132
|
+
}
|
|
4133
|
+
await parallelReorder.waitForFrame(frameIndex);
|
|
4134
|
+
ensureFrameWritten(await currentEncoder.writeFrame(buffer), frameIndex, currentEncoder);
|
|
4135
|
+
parallelReorder.advanceTo(frameIndex + 1);
|
|
4136
|
+
writtenFrames = frameIndex + 1;
|
|
4137
|
+
} catch (err) {
|
|
4138
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
4139
|
+
if (!parallelDrainError) {
|
|
4140
|
+
parallelDrainError = e;
|
|
4141
|
+
parallelReorder.abort(e);
|
|
4142
|
+
}
|
|
4143
|
+
throw e;
|
|
4078
4144
|
}
|
|
4079
|
-
|
|
4145
|
+
};
|
|
4146
|
+
const captureLabel = input.parallelCaptureLabel ?? "worker";
|
|
4147
|
+
let watchdogArmed = false;
|
|
4148
|
+
const stallController = new AbortController();
|
|
4149
|
+
const forwardParentAbort = () => stallController.abort();
|
|
4150
|
+
if (abortSignal) {
|
|
4151
|
+
if (abortSignal.aborted) stallController.abort();
|
|
4152
|
+
else abortSignal.addEventListener("abort", forwardParentAbort, { once: true });
|
|
4080
4153
|
}
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4154
|
+
const stallTimeoutMs = resolveCaptureStallTimeoutMs();
|
|
4155
|
+
let lastCapturedFrames = 0;
|
|
4156
|
+
let lastProgressAt = Date.now();
|
|
4157
|
+
const workerPhases = /* @__PURE__ */ new Map();
|
|
4158
|
+
const phaseDetail = (phase) => `phase=${phase.phase} frame=${phase.frameIndex ?? "n/a"} step=${phase.readStep?.() ?? "n/a"} browser=${phase.browserExecutable} version=${phase.browserVersion} CanvasDrawElement=${phase.canvasDrawElement} gpu=${phase.gpuBackend}`;
|
|
4159
|
+
const phaseSummary = () => [...workerPhases.entries()].sort(([left], [right]) => left - right).map(([workerId, detail]) => `worker=${workerId} ${detail}`).join("; ");
|
|
4160
|
+
let stalled = false;
|
|
4161
|
+
const stallTimer = setInterval(
|
|
4162
|
+
() => {
|
|
4163
|
+
if (!watchdogArmed || Date.now() - lastProgressAt <= stallTimeoutMs) return;
|
|
4164
|
+
stalled = true;
|
|
4165
|
+
const stallErr = new ParallelCaptureStallError({
|
|
4166
|
+
variant: "drain",
|
|
4167
|
+
captureLabel,
|
|
4168
|
+
stallTimeoutMs,
|
|
4169
|
+
lastCapturedFrames: resumeFrom + lastCapturedFrames,
|
|
4170
|
+
totalFrames,
|
|
4171
|
+
phaseSummary: phaseSummary()
|
|
4172
|
+
});
|
|
4173
|
+
parallelReorder.abort(stallErr);
|
|
4174
|
+
stallController.abort();
|
|
4175
|
+
},
|
|
4176
|
+
Math.min(stallTimeoutMs, DE_STALL_POLL_MS)
|
|
4177
|
+
);
|
|
4178
|
+
try {
|
|
4179
|
+
workerResults = await executeParallelCapture(
|
|
4180
|
+
fileServer.url,
|
|
4181
|
+
workDir,
|
|
4182
|
+
tasks,
|
|
4183
|
+
buildCaptureOptions(),
|
|
4184
|
+
createRenderVideoFrameInjector,
|
|
4185
|
+
stallController.signal,
|
|
4186
|
+
(progress) => {
|
|
4187
|
+
if (progress.latestWorkerPhase) {
|
|
4188
|
+
const phase = progress.latestWorkerPhase;
|
|
4189
|
+
workerPhases.set(phase.workerId, phaseDetail(phase));
|
|
4190
|
+
if (phase.phase === "frame_capture" && !watchdogArmed) {
|
|
4191
|
+
watchdogArmed = true;
|
|
4192
|
+
lastProgressAt = Date.now();
|
|
4193
|
+
}
|
|
4194
|
+
log.info("[Render] Parallel capture worker phase", {
|
|
4195
|
+
workerId: phase.workerId,
|
|
4196
|
+
phase: phase.phase,
|
|
4197
|
+
frameIndex: phase.frameIndex,
|
|
4198
|
+
browserExecutable: phase.browserExecutable,
|
|
4199
|
+
browserVersion: phase.browserVersion,
|
|
4200
|
+
canvasDrawElement: phase.canvasDrawElement,
|
|
4201
|
+
gpuBackend: phase.gpuBackend
|
|
4202
|
+
});
|
|
4203
|
+
if (progress.capturedFrames === 0) reportWorkerStartup(job, progress, onProgress);
|
|
4204
|
+
return;
|
|
4205
|
+
}
|
|
4206
|
+
if (progress.capturedFrames > lastCapturedFrames) {
|
|
4207
|
+
lastCapturedFrames = progress.capturedFrames;
|
|
4129
4208
|
lastProgressAt = Date.now();
|
|
4209
|
+
watchdogArmed = true;
|
|
4210
|
+
}
|
|
4211
|
+
const doneFrames = resumeFrom + progress.capturedFrames;
|
|
4212
|
+
job.framesRendered = doneFrames;
|
|
4213
|
+
const frameProgress = doneFrames / totalFrames;
|
|
4214
|
+
reportFrameProgress(
|
|
4215
|
+
job,
|
|
4216
|
+
`Streaming frame ${doneFrames}/${totalFrames} (${workerCount} workers)`,
|
|
4217
|
+
Math.round(25 + frameProgress * 55),
|
|
4218
|
+
onProgress,
|
|
4219
|
+
doneFrames,
|
|
4220
|
+
totalFrames
|
|
4221
|
+
);
|
|
4222
|
+
},
|
|
4223
|
+
onFrameBuffer,
|
|
4224
|
+
// Interleaved DE workers each get their own browser process: co-tenant pages starve
|
|
4225
|
+
// each other's paint events.
|
|
4226
|
+
deParallelStream ? { ...captureCfg, enableBrowserPool: false } : captureCfg,
|
|
4227
|
+
{
|
|
4228
|
+
// A worker died: release parked peers with its original failure, not the stall the
|
|
4229
|
+
// watchdog raises later.
|
|
4230
|
+
onWorkerOperation: (phase) => workerPhases.set(phase.workerId, phaseDetail(phase)),
|
|
4231
|
+
onWorkerFailure: (failure) => {
|
|
4232
|
+
if (parallelDrainError) return;
|
|
4233
|
+
parallelDrainError = failure;
|
|
4234
|
+
parallelReorder.abort(failure);
|
|
4130
4235
|
}
|
|
4131
|
-
log.info("[Render] Parallel capture worker phase", {
|
|
4132
|
-
workerId: phase.workerId,
|
|
4133
|
-
phase: phase.phase,
|
|
4134
|
-
frameIndex: phase.frameIndex,
|
|
4135
|
-
browserExecutable: phase.browserExecutable,
|
|
4136
|
-
browserVersion: phase.browserVersion,
|
|
4137
|
-
canvasDrawElement: phase.canvasDrawElement,
|
|
4138
|
-
gpuBackend: phase.gpuBackend
|
|
4139
|
-
});
|
|
4140
|
-
if (progress.capturedFrames === 0) reportWorkerStartup(job, progress, onProgress);
|
|
4141
|
-
return;
|
|
4142
|
-
}
|
|
4143
|
-
if (progress.capturedFrames > lastCapturedFrames) {
|
|
4144
|
-
lastCapturedFrames = progress.capturedFrames;
|
|
4145
|
-
lastProgressAt = Date.now();
|
|
4146
|
-
watchdogArmed = true;
|
|
4147
4236
|
}
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4237
|
+
);
|
|
4238
|
+
} catch (err) {
|
|
4239
|
+
if (stalled && abortSignal?.aborted !== true && captureLabel === "BeginFrame" && !resumedAfterStall && writtenFrames > resumeFrom) {
|
|
4240
|
+
resumedAfterStall = true;
|
|
4241
|
+
log.warn(
|
|
4242
|
+
"[Render] Parallel BeginFrame capture stalled; resuming from the first unwritten frame",
|
|
4243
|
+
{
|
|
4244
|
+
resumeFrom: writtenFrames,
|
|
4245
|
+
totalFrames,
|
|
4246
|
+
workerPhases: phaseSummary()
|
|
4247
|
+
}
|
|
4157
4248
|
);
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
// Interleaved DE workers each need their own browser PROCESS:
|
|
4161
|
-
// pages co-tenant in one browser share one compositor, whose
|
|
4162
|
-
// internal frame scheduling deprioritizes non-active pages — their
|
|
4163
|
-
// canvas `paint` events starve and the drawElement paint-wait slows
|
|
4164
|
-
// ~3x (measured: 86s vs 30s on a 3,245-frame rAF comp). This is
|
|
4165
|
-
// Chromium's internal frame-production scheduling on ALL platforms,
|
|
4166
|
-
// NOT the Linux-only HeadlessExperimental.beginFrame capture mode.
|
|
4167
|
-
deParallelStream ? { ...captureCfg, enableBrowserPool: false } : captureCfg,
|
|
4168
|
-
{
|
|
4169
|
-
// A worker died (Target closed, Page crashed, launch failure).
|
|
4170
|
-
// Its frames are gone and peers are parked in waitForFrame on the
|
|
4171
|
-
// first of them; release them with the ORIGINAL failure so the
|
|
4172
|
-
// orchestrator sees a transient browser error it knows how to
|
|
4173
|
-
// retry, not the stall the watchdog would have raised a minute
|
|
4174
|
-
// later. First failure wins, same as the drain guard above.
|
|
4175
|
-
onWorkerFailure: (failure) => {
|
|
4176
|
-
if (parallelDrainError) return;
|
|
4177
|
-
parallelDrainError = failure;
|
|
4178
|
-
reorderBuffer.abort(failure);
|
|
4179
|
-
}
|
|
4249
|
+
resumeFrom = writtenFrames;
|
|
4250
|
+
continue;
|
|
4180
4251
|
}
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4252
|
+
if (parallelDrainError) throw poolFailure(parallelDrainError, probeSession);
|
|
4253
|
+
if (stalled && abortSignal?.aborted !== true) {
|
|
4254
|
+
throw new ParallelCaptureStallError({
|
|
4255
|
+
variant: "pool",
|
|
4256
|
+
captureLabel,
|
|
4257
|
+
stallTimeoutMs,
|
|
4258
|
+
lastCapturedFrames: resumeFrom + lastCapturedFrames,
|
|
4259
|
+
totalFrames,
|
|
4260
|
+
phaseSummary: phaseSummary()
|
|
4261
|
+
});
|
|
4262
|
+
}
|
|
4263
|
+
throw poolFailure(err, probeSession);
|
|
4264
|
+
} finally {
|
|
4265
|
+
clearInterval(stallTimer);
|
|
4266
|
+
abortSignal?.removeEventListener("abort", forwardParentAbort);
|
|
4193
4267
|
}
|
|
4194
|
-
throw poolFailure(
|
|
4195
|
-
|
|
4196
|
-
clearInterval(stallTimer);
|
|
4197
|
-
abortSignal?.removeEventListener("abort", forwardParentAbort);
|
|
4268
|
+
if (parallelDrainError) throw poolFailure(parallelDrainError, probeSession);
|
|
4269
|
+
break;
|
|
4198
4270
|
}
|
|
4199
|
-
if (parallelDrainError) throw poolFailure(parallelDrainError, probeSession);
|
|
4200
4271
|
pushWorkerDedupPerfs(workerResults, dedupPerfs);
|
|
4201
4272
|
const workerPageErrors = [];
|
|
4202
4273
|
pushWorkerPageErrors(workerResults, workerPageErrors);
|
|
@@ -4357,7 +4428,7 @@ function segmentEncoderOptions(base, segment) {
|
|
|
4357
4428
|
return {
|
|
4358
4429
|
...base,
|
|
4359
4430
|
lockGopForChunkConcat: true,
|
|
4360
|
-
gopSize: segment.endFrame - segment.startFrame
|
|
4431
|
+
gopSize: Math.min(base.gopSize ?? Infinity, segment.endFrame - segment.startFrame)
|
|
4361
4432
|
};
|
|
4362
4433
|
}
|
|
4363
4434
|
var SegmentEncoderSpawnError = class extends Error {
|
|
@@ -4451,6 +4522,12 @@ function defaultSessionFactory(input) {
|
|
|
4451
4522
|
let probeSession = input.probeSession;
|
|
4452
4523
|
return {
|
|
4453
4524
|
create: async () => {
|
|
4525
|
+
const probeCannotCaptureEveryFrame = Boolean(probeSession?.deRiskFrames?.size);
|
|
4526
|
+
if (probeSession && probeCannotCaptureEveryFrame) {
|
|
4527
|
+
await closeCaptureSession(probeSession).catch(() => {
|
|
4528
|
+
});
|
|
4529
|
+
probeSession = null;
|
|
4530
|
+
}
|
|
4454
4531
|
const session = probeSession ?? await openSegmentedSession(input);
|
|
4455
4532
|
if (probeSession) {
|
|
4456
4533
|
openSegmentedSessionReuse(input, probeSession);
|
|
@@ -4780,8 +4857,10 @@ function computeSegmentPlanHash(input) {
|
|
|
4780
4857
|
input.motionBlur,
|
|
4781
4858
|
input.pageMotionBlur ?? "",
|
|
4782
4859
|
input.captureQuality === void 0 ? "" : String(input.captureQuality)
|
|
4783
|
-
]
|
|
4784
|
-
|
|
4860
|
+
];
|
|
4861
|
+
const delivery = [input.maxBitrate, input.bufferSize, input.gopSize].map((v) => v ?? "");
|
|
4862
|
+
if (delivery.some((v) => v !== "")) ordered.push(...delivery.map(String));
|
|
4863
|
+
return createHash2("sha256").update(ordered.join(" ")).digest("hex").slice(0, 16);
|
|
4785
4864
|
}
|
|
4786
4865
|
function segmentDirFor(projectRendersDir, planHash) {
|
|
4787
4866
|
return join11(projectRendersDir, ".hf-segments", planHash);
|
|
@@ -5818,55 +5897,6 @@ function getPositionEditsRenderScript() {
|
|
|
5818
5897
|
|
|
5819
5898
|
// ../producer/src/services/assetMediaType.ts
|
|
5820
5899
|
import { existsSync as existsSync8 } from "fs";
|
|
5821
|
-
|
|
5822
|
-
// ../producer/src/utils/semaphore.ts
|
|
5823
|
-
var Semaphore = class {
|
|
5824
|
-
constructor(maxConcurrent) {
|
|
5825
|
-
this.maxConcurrent = maxConcurrent;
|
|
5826
|
-
}
|
|
5827
|
-
maxConcurrent;
|
|
5828
|
-
queue = [];
|
|
5829
|
-
active = 0;
|
|
5830
|
-
async acquire() {
|
|
5831
|
-
if (this.active < this.maxConcurrent) {
|
|
5832
|
-
this.active++;
|
|
5833
|
-
return () => this.release();
|
|
5834
|
-
}
|
|
5835
|
-
return new Promise((resolve11) => {
|
|
5836
|
-
this.queue.push(() => {
|
|
5837
|
-
this.active++;
|
|
5838
|
-
resolve11(() => this.release());
|
|
5839
|
-
});
|
|
5840
|
-
});
|
|
5841
|
-
}
|
|
5842
|
-
release() {
|
|
5843
|
-
this.active--;
|
|
5844
|
-
const next = this.queue.shift();
|
|
5845
|
-
if (next) next();
|
|
5846
|
-
}
|
|
5847
|
-
/** Current number of active slots. */
|
|
5848
|
-
get activeCount() {
|
|
5849
|
-
return this.active;
|
|
5850
|
-
}
|
|
5851
|
-
/** Number of waiters in the queue. */
|
|
5852
|
-
get waitingCount() {
|
|
5853
|
-
return this.queue.length;
|
|
5854
|
-
}
|
|
5855
|
-
};
|
|
5856
|
-
|
|
5857
|
-
// ../producer/src/utils/mediaProbeConcurrency.ts
|
|
5858
|
-
var MEDIA_PROBE_CONCURRENCY = 4;
|
|
5859
|
-
var sharedMediaProbeSemaphore = new Semaphore(MEDIA_PROBE_CONCURRENCY);
|
|
5860
|
-
async function withMediaProbeSlot(operation) {
|
|
5861
|
-
const release = await sharedMediaProbeSemaphore.acquire();
|
|
5862
|
-
try {
|
|
5863
|
-
return await operation();
|
|
5864
|
-
} finally {
|
|
5865
|
-
release();
|
|
5866
|
-
}
|
|
5867
|
-
}
|
|
5868
|
-
|
|
5869
|
-
// ../producer/src/services/assetMediaType.ts
|
|
5870
5900
|
var ASSET_MEDIA_TYPE_MISMATCH = "ASSET_MEDIA_TYPE_MISMATCH";
|
|
5871
5901
|
var AssetMediaTypeMismatchError = class extends Error {
|
|
5872
5902
|
code = ASSET_MEDIA_TYPE_MISMATCH;
|
|
@@ -6170,7 +6200,7 @@ function detectShaderTransitionUsage(html) {
|
|
|
6170
6200
|
}
|
|
6171
6201
|
return false;
|
|
6172
6202
|
}
|
|
6173
|
-
async function resolveMediaDuration(src, mediaStart, playbackRate, baseDir, downloadDir, tagName, elementIdentity, log, urlByAbsentLocalPath) {
|
|
6203
|
+
async function resolveMediaDuration(src, mediaStart, playbackRate, baseDir, downloadDir, tagName, elementIdentity, log, urlByAbsentLocalPath, probes) {
|
|
6174
6204
|
let filePath = src;
|
|
6175
6205
|
if (isHttpUrl(src)) {
|
|
6176
6206
|
if (!existsSync9(downloadDir)) mkdirSync5(downloadDir, { recursive: true });
|
|
@@ -6197,45 +6227,52 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, baseDir, down
|
|
|
6197
6227
|
if (error instanceof Error && error.stack) wrapped.stack = error.stack;
|
|
6198
6228
|
return wrapped;
|
|
6199
6229
|
};
|
|
6200
|
-
|
|
6201
|
-
let profile;
|
|
6230
|
+
const probe = () => withMediaProbeSlot(async () => {
|
|
6202
6231
|
try {
|
|
6203
6232
|
await assertMediaPayload(filePath, elementIdentity);
|
|
6204
|
-
profile = await probeMediaProfile(filePath);
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
if (error instanceof NotMediaPayloadError) {
|
|
6208
|
-
log?.warn(
|
|
6209
|
-
`[compile] Audio "${elementIdentity}" (${src}) is a text document, not a media file, so the element is dropped from the render. Point it at a rendered media file.`
|
|
6210
|
-
);
|
|
6211
|
-
}
|
|
6212
|
-
return { duration: null, resolvedPath: filePath };
|
|
6213
|
-
}
|
|
6214
|
-
throw withSrcContext(error);
|
|
6215
|
-
}
|
|
6216
|
-
assertAssetMediaTypeProfile(tagName === "video" ? "video" : "audio", profile, elementIdentity);
|
|
6217
|
-
let metadata;
|
|
6218
|
-
if (tagName === "video") {
|
|
6219
|
-
try {
|
|
6220
|
-
metadata = await extractMediaMetadata(filePath);
|
|
6221
|
-
} catch (error) {
|
|
6222
|
-
throw withSrcContext(error);
|
|
6233
|
+
const profile = await probeMediaProfile(filePath);
|
|
6234
|
+
if (tagName === "video") {
|
|
6235
|
+
return { profile, fileDuration: (await extractMediaMetadata(filePath)).durationSeconds };
|
|
6223
6236
|
}
|
|
6224
|
-
} else {
|
|
6225
6237
|
try {
|
|
6226
|
-
|
|
6238
|
+
return { profile, fileDuration: (await extractAudioMetadata(filePath)).durationSeconds };
|
|
6227
6239
|
} catch {
|
|
6228
|
-
return {
|
|
6240
|
+
return { profile, fileDuration: null };
|
|
6229
6241
|
}
|
|
6242
|
+
} catch (error) {
|
|
6243
|
+
return { error };
|
|
6230
6244
|
}
|
|
6231
|
-
const fileDuration = metadata.durationSeconds;
|
|
6232
|
-
const duration = resolveNaturalMediaTimelineDurationFromValues(
|
|
6233
|
-
fileDuration,
|
|
6234
|
-
mediaStart,
|
|
6235
|
-
playbackRate
|
|
6236
|
-
);
|
|
6237
|
-
return { duration, resolvedPath: filePath };
|
|
6238
6245
|
});
|
|
6246
|
+
const key = `${tagName}\0${filePath}`;
|
|
6247
|
+
let probed = probes?.get(key);
|
|
6248
|
+
if (!probed) {
|
|
6249
|
+
probed = probe();
|
|
6250
|
+
probes?.set(key, probed);
|
|
6251
|
+
}
|
|
6252
|
+
const outcome = await probed;
|
|
6253
|
+
if ("error" in outcome) {
|
|
6254
|
+
if (tagName !== "video") {
|
|
6255
|
+
if (outcome.error instanceof NotMediaPayloadError) {
|
|
6256
|
+
log?.warn(
|
|
6257
|
+
`[compile] Audio "${elementIdentity}" (${src}) is a text document, not a media file, so the element is dropped from the render. Point it at a rendered media file.`
|
|
6258
|
+
);
|
|
6259
|
+
}
|
|
6260
|
+
return { duration: null, resolvedPath: filePath };
|
|
6261
|
+
}
|
|
6262
|
+
throw withSrcContext(outcome.error);
|
|
6263
|
+
}
|
|
6264
|
+
assertAssetMediaTypeProfile(
|
|
6265
|
+
tagName === "video" ? "video" : "audio",
|
|
6266
|
+
outcome.profile,
|
|
6267
|
+
elementIdentity
|
|
6268
|
+
);
|
|
6269
|
+
if (outcome.fileDuration === null) return { duration: null, resolvedPath: filePath };
|
|
6270
|
+
const duration = resolveNaturalMediaTimelineDurationFromValues(
|
|
6271
|
+
outcome.fileDuration,
|
|
6272
|
+
mediaStart,
|
|
6273
|
+
playbackRate
|
|
6274
|
+
);
|
|
6275
|
+
return { duration, resolvedPath: filePath };
|
|
6239
6276
|
}
|
|
6240
6277
|
function markInferredVariableMediaDurations(html, unresolvedMedia) {
|
|
6241
6278
|
const unresolvedIds = new Set(unresolvedMedia.map((element) => element.id));
|
|
@@ -6249,7 +6286,7 @@ function markInferredVariableMediaDurations(html, unresolvedMedia) {
|
|
|
6249
6286
|
}
|
|
6250
6287
|
return changed ? document2.toString() : html;
|
|
6251
6288
|
}
|
|
6252
|
-
async function compileHtmlFile(html, baseDir, downloadDir, log, urlByAbsentLocalPath) {
|
|
6289
|
+
async function compileHtmlFile(html, baseDir, downloadDir, log, urlByAbsentLocalPath, probes) {
|
|
6253
6290
|
const { html: staticCompiled, unresolved } = compileTimingAttrs(html);
|
|
6254
6291
|
const mediaUnresolved = unresolved.filter(
|
|
6255
6292
|
(el) => (el.tagName === "video" || el.tagName === "audio") && el.src
|
|
@@ -6266,7 +6303,8 @@ async function compileHtmlFile(html, baseDir, downloadDir, log, urlByAbsentLocal
|
|
|
6266
6303
|
el.tagName,
|
|
6267
6304
|
el.id,
|
|
6268
6305
|
log,
|
|
6269
|
-
urlByAbsentLocalPath
|
|
6306
|
+
urlByAbsentLocalPath,
|
|
6307
|
+
probes
|
|
6270
6308
|
).then(({ duration }) => ({ id: el.id, duration }))
|
|
6271
6309
|
)
|
|
6272
6310
|
);
|
|
@@ -6287,7 +6325,9 @@ async function compileHtmlFile(html, baseDir, downloadDir, log, urlByAbsentLocal
|
|
|
6287
6325
|
downloadDir,
|
|
6288
6326
|
el.tagName,
|
|
6289
6327
|
el.id,
|
|
6290
|
-
log
|
|
6328
|
+
log,
|
|
6329
|
+
void 0,
|
|
6330
|
+
probes
|
|
6291
6331
|
);
|
|
6292
6332
|
return { id: el.id, tagName: el.tagName, duration: el.duration, maxDuration, src: el.src };
|
|
6293
6333
|
})
|
|
@@ -6309,7 +6349,7 @@ async function compileHtmlFile(html, baseDir, downloadDir, log, urlByAbsentLocal
|
|
|
6309
6349
|
compiledHtml = compiledHtml.replace(/(<audio\b[^>]*)\s+crossorigin(?:=["'][^"']*["'])?/gi, "$1");
|
|
6310
6350
|
return { html: compiledHtml, unresolvedCompositions };
|
|
6311
6351
|
}
|
|
6312
|
-
async function parseSubCompositions(html, projectDir, downloadDir, visited = /* @__PURE__ */ new Set(), urlByAbsentLocalPath) {
|
|
6352
|
+
async function parseSubCompositions(html, projectDir, downloadDir, visited = /* @__PURE__ */ new Set(), urlByAbsentLocalPath, probes) {
|
|
6313
6353
|
const subCompositions = /* @__PURE__ */ new Map();
|
|
6314
6354
|
const { document: document2 } = parseHTML(html);
|
|
6315
6355
|
const compEls = document2.querySelectorAll("[data-composition-src]");
|
|
@@ -6337,14 +6377,16 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
|
|
|
6337
6377
|
dirname5(item.filePath),
|
|
6338
6378
|
downloadDir,
|
|
6339
6379
|
void 0,
|
|
6340
|
-
urlByAbsentLocalPath
|
|
6380
|
+
urlByAbsentLocalPath,
|
|
6381
|
+
probes
|
|
6341
6382
|
);
|
|
6342
6383
|
const nested = await parseSubCompositions(
|
|
6343
6384
|
compiledSub,
|
|
6344
6385
|
projectDir,
|
|
6345
6386
|
downloadDir,
|
|
6346
6387
|
item.nestedVisited,
|
|
6347
|
-
urlByAbsentLocalPath
|
|
6388
|
+
urlByAbsentLocalPath,
|
|
6389
|
+
probes
|
|
6348
6390
|
);
|
|
6349
6391
|
return {
|
|
6350
6392
|
srcPath: item.srcPath,
|
|
@@ -7001,7 +7043,7 @@ async function readLocalFont(absPath) {
|
|
|
7001
7043
|
return { kind: "inline", buffer: Buffer.concat(chunks, totalBytes) };
|
|
7002
7044
|
}
|
|
7003
7045
|
async function embedLocalFontFaces(html, projectDir) {
|
|
7004
|
-
const { fontToDataUri: toDataUri } = await import("./deterministicFonts-
|
|
7046
|
+
const { fontToDataUri: toDataUri } = await import("./deterministicFonts-LKAGUNE5.js");
|
|
7005
7047
|
const styleBlockRe = /<style\b[^>]*>([\s\S]*?)<\/style>/gi;
|
|
7006
7048
|
const fontFaceRe = /@font-face\s*\{([^}]*)\}/gi;
|
|
7007
7049
|
let result = html;
|
|
@@ -7114,19 +7156,22 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
7114
7156
|
);
|
|
7115
7157
|
const rawHtml = rewriteUnresolvableGsapToCdn(entryHtml, projectDir);
|
|
7116
7158
|
assertSubCompositionsUsable(rawHtml, projectDir);
|
|
7159
|
+
const probes = /* @__PURE__ */ new Map();
|
|
7117
7160
|
const { html: compiledHtml, unresolvedCompositions } = await compileHtmlFile(
|
|
7118
7161
|
rawHtml,
|
|
7119
7162
|
projectDir,
|
|
7120
7163
|
downloadDir,
|
|
7121
7164
|
options.log,
|
|
7122
|
-
options.urlByAbsentLocalPath
|
|
7165
|
+
options.urlByAbsentLocalPath,
|
|
7166
|
+
probes
|
|
7123
7167
|
);
|
|
7124
7168
|
const { subCompositions } = await parseSubCompositions(
|
|
7125
7169
|
compiledHtml,
|
|
7126
7170
|
projectDir,
|
|
7127
7171
|
downloadDir,
|
|
7128
7172
|
void 0,
|
|
7129
|
-
options.urlByAbsentLocalPath
|
|
7173
|
+
options.urlByAbsentLocalPath,
|
|
7174
|
+
probes
|
|
7130
7175
|
);
|
|
7131
7176
|
const fullHtml = ensureFullDocument(compiledHtml);
|
|
7132
7177
|
const inlinedHtml = inlineSubCompositions2(
|
|
@@ -7178,12 +7223,26 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
7178
7223
|
const { html: htmlWithLocalImages, remoteMediaAssets: remoteImageAssets } = await localizeRemoteImageSources(htmlWithLocalMedia, downloadDir);
|
|
7179
7224
|
const { html: htmlWithLocalBg, remoteMediaAssets: remoteBgAssets } = await localizeRemoteBackgroundImages(htmlWithLocalImages, downloadDir);
|
|
7180
7225
|
const { html: htmlWithLocalizedFonts, remoteMediaAssets: remoteFontAssets } = await localizeRemoteFontFaces(htmlWithLocalBg, downloadDir);
|
|
7226
|
+
const {
|
|
7227
|
+
html: htmlWithJpegs,
|
|
7228
|
+
preparedAssets: preparedHeifAssets,
|
|
7229
|
+
preparedImages: preparedHeifImages
|
|
7230
|
+
} = await prepareHeifImageInputs(htmlWithLocalizedFonts, {
|
|
7231
|
+
projectDir,
|
|
7232
|
+
downloadDir,
|
|
7233
|
+
cacheDir: options.animatedGifCacheDir,
|
|
7234
|
+
sourceAssets: remoteImageAssets,
|
|
7235
|
+
timeoutMs: options.ffmpegProcessTimeout
|
|
7236
|
+
});
|
|
7237
|
+
if (preparedHeifImages.length > 0) {
|
|
7238
|
+
defaultLogger.info(`[Compiler] Converted ${preparedHeifImages.length} HEIC image(s) to JPEG`);
|
|
7239
|
+
}
|
|
7181
7240
|
const gifSourceAssets = new Map(remoteImageAssets);
|
|
7182
7241
|
const {
|
|
7183
7242
|
html: htmlWithPreparedGifs,
|
|
7184
7243
|
preparedAssets: preparedGifAssets,
|
|
7185
7244
|
preparedGifs
|
|
7186
|
-
} = await prepareAnimatedGifInputs(
|
|
7245
|
+
} = await prepareAnimatedGifInputs(htmlWithJpegs, {
|
|
7187
7246
|
projectDir,
|
|
7188
7247
|
downloadDir,
|
|
7189
7248
|
cacheDir: options.animatedGifCacheDir,
|
|
@@ -7210,11 +7269,17 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
7210
7269
|
for (const [relPath, absPath] of preparedGifAssets) {
|
|
7211
7270
|
externalAssets.set(relPath, absPath);
|
|
7212
7271
|
}
|
|
7272
|
+
for (const [relPath, absPath] of preparedHeifAssets) {
|
|
7273
|
+
externalAssets.set(relPath, absPath);
|
|
7274
|
+
}
|
|
7213
7275
|
const { videos, audios, images, droppedMediaIds } = collectRenderMedia(html);
|
|
7214
7276
|
const masterFxChain = parseMasterFxChain(html);
|
|
7277
|
+
const advised = /* @__PURE__ */ new Set();
|
|
7215
7278
|
for (const video of videos) {
|
|
7216
7279
|
if (isHttpUrl(video.src)) continue;
|
|
7217
7280
|
const videoPath = resolve5(projectDir, video.src);
|
|
7281
|
+
if (advised.has(videoPath)) continue;
|
|
7282
|
+
advised.add(videoPath);
|
|
7218
7283
|
const reencode = `ffmpeg -i "${video.src}" -c:v libx264 -r 30 -g 30 -keyint_min 30 -movflags +faststart -c:a copy output.mp4`;
|
|
7219
7284
|
(async () => {
|
|
7220
7285
|
const metadata = await withMediaProbeSlot(() => extractMediaMetadata(videoPath));
|
|
@@ -7787,8 +7852,15 @@ function hasAutoStartVideos(html) {
|
|
|
7787
7852
|
const { document: document2 } = parseHTML(html);
|
|
7788
7853
|
return document2.querySelector("video[data-hf-auto-start]") !== null;
|
|
7789
7854
|
}
|
|
7855
|
+
function variableHasValue(element, variableId, variables) {
|
|
7856
|
+
if (variables && Object.hasOwn(variables, variableId)) return true;
|
|
7857
|
+
for (let scope = element.parentElement; scope; scope = scope.parentElement) {
|
|
7858
|
+
if (Object.hasOwn(parseHostVariableValues(scope), variableId)) return true;
|
|
7859
|
+
if (Object.hasOwn(readDeclaredDefaults(scope), variableId)) return true;
|
|
7860
|
+
}
|
|
7861
|
+
return Object.hasOwn(readDeclaredDefaults(element.ownerDocument.documentElement), variableId);
|
|
7862
|
+
}
|
|
7790
7863
|
function hasVariableBoundMedia(html, variables) {
|
|
7791
|
-
if (!variables || Object.keys(variables).length === 0) return false;
|
|
7792
7864
|
const { document: document2 } = parseHTML(html);
|
|
7793
7865
|
return Array.from(
|
|
7794
7866
|
document2.querySelectorAll(
|
|
@@ -7796,7 +7868,7 @@ function hasVariableBoundMedia(html, variables) {
|
|
|
7796
7868
|
)
|
|
7797
7869
|
).some((element) => {
|
|
7798
7870
|
const variableId = element.getAttribute("data-var-src")?.trim();
|
|
7799
|
-
return Boolean(variableId &&
|
|
7871
|
+
return Boolean(variableId && variableHasValue(element, variableId, variables));
|
|
7800
7872
|
});
|
|
7801
7873
|
}
|
|
7802
7874
|
function authoredMediaStarts(html) {
|
|
@@ -8795,11 +8867,10 @@ function appendAutoDetectedVideoAudio(composition, extracted) {
|
|
|
8795
8867
|
|
|
8796
8868
|
// ../producer/src/services/render/stages/audioStage.ts
|
|
8797
8869
|
import { join as join18 } from "path";
|
|
8798
|
-
import { rmSync as rmSync8 } from "fs";
|
|
8799
8870
|
|
|
8800
8871
|
// ../producer/src/services/render/audioPadTrim.ts
|
|
8801
8872
|
import { spawn } from "child_process";
|
|
8802
|
-
import { mkdtempSync as mkdtempSync3
|
|
8873
|
+
import { mkdtempSync as mkdtempSync3 } from "fs";
|
|
8803
8874
|
import { dirname as dirname6, join as join17 } from "path";
|
|
8804
8875
|
|
|
8805
8876
|
// ../producer/src/services/render/audioTruePeak.ts
|
|
@@ -8985,7 +9056,7 @@ async function padOrTrimAudioToVideoFrameCount(input) {
|
|
|
8985
9056
|
error: `audioPadTrim: failed to materialize ${plan2.operation}: ${err instanceof Error ? err.message : String(err)}`
|
|
8986
9057
|
};
|
|
8987
9058
|
} finally {
|
|
8988
|
-
for (const path of plan2.cleanupPaths)
|
|
9059
|
+
for (const path of plan2.cleanupPaths) removeScratch(path);
|
|
8989
9060
|
}
|
|
8990
9061
|
let loweredDb = 0;
|
|
8991
9062
|
if (probeTruePeak) {
|
|
@@ -9048,7 +9119,7 @@ async function enforceAacTruePeak(input) {
|
|
|
9048
9119
|
}
|
|
9049
9120
|
if (truePeakDbfs <= AAC_DELIVERY_TRUE_PEAK_DBFS) {
|
|
9050
9121
|
if (measuredPath !== correctedPath) return { success: true };
|
|
9051
|
-
renameWithRetry(correctedPath, input.audioPath);
|
|
9122
|
+
renameWithRetry(correctedPath, input.audioPath, { copyFallback: true });
|
|
9052
9123
|
return { success: true, loweredDb: Number((-attenuationDb).toFixed(2)) };
|
|
9053
9124
|
}
|
|
9054
9125
|
if (pass === MAX_TRUE_PEAK_CORRECTION_PASSES) break;
|
|
@@ -9089,7 +9160,7 @@ async function enforceAacTruePeak(input) {
|
|
|
9089
9160
|
)}`
|
|
9090
9161
|
};
|
|
9091
9162
|
} finally {
|
|
9092
|
-
if (scratchDir)
|
|
9163
|
+
if (scratchDir) removeScratch(scratchDir);
|
|
9093
9164
|
}
|
|
9094
9165
|
}
|
|
9095
9166
|
function failResult(outputPath, target, source, error) {
|
|
@@ -9234,7 +9305,15 @@ function assertAudioNotInterrupted(failures) {
|
|
|
9234
9305
|
])
|
|
9235
9306
|
});
|
|
9236
9307
|
}
|
|
9237
|
-
|
|
9308
|
+
function runAudioStage(input) {
|
|
9309
|
+
return collectScratchLeftovers(
|
|
9310
|
+
() => runAudioStageScoped(input),
|
|
9311
|
+
(left) => {
|
|
9312
|
+
if (left.length > 0) input.log?.warn("[audio] scratch left behind", { count: left.length });
|
|
9313
|
+
}
|
|
9314
|
+
);
|
|
9315
|
+
}
|
|
9316
|
+
async function runAudioStageScoped(input) {
|
|
9238
9317
|
const stageStart = Date.now();
|
|
9239
9318
|
const pcmSourcePath = join18(input.workDir, "audio-source.wav");
|
|
9240
9319
|
const duration = input.totalFrames * input.fps.den / input.fps.num;
|
|
@@ -9256,7 +9335,7 @@ async function runAudioStage(input) {
|
|
|
9256
9335
|
}
|
|
9257
9336
|
return { ...result, audioLoweredDb, audioProcessMs: Date.now() - stageStart };
|
|
9258
9337
|
} finally {
|
|
9259
|
-
|
|
9338
|
+
removeScratch(pcmSourcePath);
|
|
9260
9339
|
}
|
|
9261
9340
|
}
|
|
9262
9341
|
async function mixAudioForDelivery(input, duration, pcmSourcePath) {
|
|
@@ -10373,6 +10452,7 @@ async function runCaptureHdrStage(input) {
|
|
|
10373
10452
|
preset,
|
|
10374
10453
|
effectiveQuality,
|
|
10375
10454
|
effectiveBitrate,
|
|
10455
|
+
deliveryEncoder,
|
|
10376
10456
|
fileServer,
|
|
10377
10457
|
buildCaptureOptions,
|
|
10378
10458
|
createRenderVideoFrameInjector,
|
|
@@ -10462,6 +10542,7 @@ async function runCaptureHdrStage(input) {
|
|
|
10462
10542
|
preset: preset.preset,
|
|
10463
10543
|
quality: effectiveQuality,
|
|
10464
10544
|
bitrate: effectiveBitrate,
|
|
10545
|
+
...deliveryEncoder,
|
|
10465
10546
|
pixelFormat: preset.pixelFormat,
|
|
10466
10547
|
hdr: preset.hdr,
|
|
10467
10548
|
rawInputFormat: "rgb48le"
|
|
@@ -10665,7 +10746,7 @@ import {
|
|
|
10665
10746
|
mkdirSync as mkdirSync7,
|
|
10666
10747
|
readdirSync as readdirSync4,
|
|
10667
10748
|
readFileSync as readFileSync6,
|
|
10668
|
-
rmSync as
|
|
10749
|
+
rmSync as rmSync7,
|
|
10669
10750
|
statSync as statSync5,
|
|
10670
10751
|
writeFileSync as writeFileSync4
|
|
10671
10752
|
} from "fs";
|
|
@@ -10789,7 +10870,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
|
|
|
10789
10870
|
fileSize
|
|
10790
10871
|
};
|
|
10791
10872
|
} finally {
|
|
10792
|
-
|
|
10873
|
+
rmSync7(input.palettePath, { force: true });
|
|
10793
10874
|
}
|
|
10794
10875
|
}
|
|
10795
10876
|
function startEncodeProgress(job, stage, onProgress) {
|
|
@@ -10813,6 +10894,8 @@ function videoEncoderOptions(input, engineCfg) {
|
|
|
10813
10894
|
preset: preset.preset,
|
|
10814
10895
|
quality: input.effectiveQuality,
|
|
10815
10896
|
bitrate: input.effectiveBitrate,
|
|
10897
|
+
maxBitrate: input.maxBitrate,
|
|
10898
|
+
bufferSize: input.bufferSize,
|
|
10816
10899
|
pixelFormat: preset.pixelFormat,
|
|
10817
10900
|
vp9CpuUsed: engineCfg.vp9CpuUsed,
|
|
10818
10901
|
useGpu: job.config.useGpu,
|
|
@@ -12086,6 +12169,7 @@ function resolveRenderDebugDir() {
|
|
|
12086
12169
|
}
|
|
12087
12170
|
async function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
|
|
12088
12171
|
validateHlsRenderConfig(job.config);
|
|
12172
|
+
validateDeliveryEncoderConfig(job.config);
|
|
12089
12173
|
const debugDir = resolveRenderDebugDir();
|
|
12090
12174
|
const outputDir = dirname9(outputPath);
|
|
12091
12175
|
if (!existsSync15(outputDir)) mkdirSync8(outputDir, { recursive: true });
|
|
@@ -12106,7 +12190,7 @@ async function executeRenderJob(job, projectDir, outputPath, progressSink, abort
|
|
|
12106
12190
|
log.info("KEEP_TEMP=1, leaving workDir on disk for inspection", { workDir });
|
|
12107
12191
|
return;
|
|
12108
12192
|
}
|
|
12109
|
-
|
|
12193
|
+
rmSync8(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
12110
12194
|
});
|
|
12111
12195
|
try {
|
|
12112
12196
|
await executeRenderPipeline({
|
|
@@ -12164,11 +12248,14 @@ async function executeRenderPipeline(input) {
|
|
|
12164
12248
|
const isGif = outputFormat === "gif";
|
|
12165
12249
|
const isHls = outputFormat === "hls";
|
|
12166
12250
|
const hlsSegmentSeconds = isHls ? resolveHlsSegmentSeconds(job.config) : void 0;
|
|
12167
|
-
const
|
|
12168
|
-
outputFormat,
|
|
12169
|
-
job.config.fps,
|
|
12170
|
-
job.config.hlsSegmentSeconds
|
|
12171
|
-
|
|
12251
|
+
const deliveryEncoder = resolveDeliveryEncoderOptions({
|
|
12252
|
+
format: outputFormat,
|
|
12253
|
+
fps: job.config.fps,
|
|
12254
|
+
hlsSegmentSeconds: job.config.hlsSegmentSeconds,
|
|
12255
|
+
keyframeIntervalSeconds: job.config.keyframeIntervalSeconds,
|
|
12256
|
+
maxBitrate: job.config.maxBitrate,
|
|
12257
|
+
bufferSize: job.config.bufferSize
|
|
12258
|
+
});
|
|
12172
12259
|
const artifactTransaction = new ArtifactTransaction(
|
|
12173
12260
|
outputPath,
|
|
12174
12261
|
isPngSequence || isHls ? "directory" : "file",
|
|
@@ -13251,6 +13338,7 @@ async function executeRenderPipeline(input) {
|
|
|
13251
13338
|
preset,
|
|
13252
13339
|
effectiveQuality,
|
|
13253
13340
|
effectiveBitrate,
|
|
13341
|
+
deliveryEncoder,
|
|
13254
13342
|
fileServer: activeFileServer,
|
|
13255
13343
|
buildCaptureOptions,
|
|
13256
13344
|
createRenderVideoFrameInjector,
|
|
@@ -13275,9 +13363,7 @@ async function executeRenderPipeline(input) {
|
|
|
13275
13363
|
} else {
|
|
13276
13364
|
let streamingHandled = false;
|
|
13277
13365
|
if (capturePlan.kind === "sdr_segmented") {
|
|
13278
|
-
const segmentedPlan = capturePlan;
|
|
13279
13366
|
const captureFrameStart = Date.now();
|
|
13280
|
-
resetCaptureAttemptProgress(job);
|
|
13281
13367
|
const segmentFrames = resolveSegmentFrames(process.env);
|
|
13282
13368
|
const segmentImageFormat = captureOptions.format || "jpeg";
|
|
13283
13369
|
const segmentPlanHash = computeSegmentPlanHash({
|
|
@@ -13292,6 +13378,9 @@ async function executeRenderPipeline(input) {
|
|
|
13292
13378
|
preset: preset.preset,
|
|
13293
13379
|
quality: effectiveQuality,
|
|
13294
13380
|
bitrate: effectiveBitrate,
|
|
13381
|
+
maxBitrate: deliveryEncoder.maxBitrate,
|
|
13382
|
+
bufferSize: deliveryEncoder.bufferSize,
|
|
13383
|
+
gopSize: deliveryEncoder.gopSize,
|
|
13295
13384
|
pixelFormat: preset.pixelFormat,
|
|
13296
13385
|
imageFormat: segmentImageFormat,
|
|
13297
13386
|
useGpu: job.config.useGpu === true,
|
|
@@ -13317,71 +13406,129 @@ async function executeRenderPipeline(input) {
|
|
|
13317
13406
|
});
|
|
13318
13407
|
}
|
|
13319
13408
|
if (completedSegments.size === 0) {
|
|
13320
|
-
|
|
13409
|
+
rmSync8(segmentDir, { recursive: true, force: true });
|
|
13321
13410
|
}
|
|
13322
13411
|
} else {
|
|
13323
|
-
|
|
13412
|
+
rmSync8(segmentDir, { recursive: true, force: true });
|
|
13324
13413
|
}
|
|
13325
|
-
const
|
|
13414
|
+
const emptySegmentManifest = () => ({
|
|
13326
13415
|
version: 1,
|
|
13327
13416
|
planHash: segmentPlanHash,
|
|
13328
13417
|
totalFrames,
|
|
13329
13418
|
segmentFrames,
|
|
13330
13419
|
completed: []
|
|
13420
|
+
});
|
|
13421
|
+
let segmentManifest = readSegmentManifest(segmentDir) ?? emptySegmentManifest();
|
|
13422
|
+
const invokeSegmented = () => {
|
|
13423
|
+
if (capturePlan.kind !== "sdr_segmented") {
|
|
13424
|
+
throw new Error(`Cannot invoke segmented stage with ${capturePlan.kind} plan`);
|
|
13425
|
+
}
|
|
13426
|
+
const segmentedPlan = capturePlan;
|
|
13427
|
+
resetCaptureAttemptProgress(job);
|
|
13428
|
+
return observeRenderStage(
|
|
13429
|
+
observability,
|
|
13430
|
+
"capture_segmented",
|
|
13431
|
+
captureStageObservationData(),
|
|
13432
|
+
() => runCaptureSegmentedStage({
|
|
13433
|
+
fileServer: activeFileServer,
|
|
13434
|
+
workDir,
|
|
13435
|
+
framesDir,
|
|
13436
|
+
videoOnlyPath,
|
|
13437
|
+
job,
|
|
13438
|
+
totalFrames,
|
|
13439
|
+
cfg,
|
|
13440
|
+
plan: segmentedPlan,
|
|
13441
|
+
log,
|
|
13442
|
+
probeSession,
|
|
13443
|
+
outputFormat,
|
|
13444
|
+
streamingEncoderOptions: {
|
|
13445
|
+
fps: job.config.fps,
|
|
13446
|
+
width: captureCompositionWidth ?? width,
|
|
13447
|
+
height: captureCompositionHeight ?? height,
|
|
13448
|
+
codec: preset.codec,
|
|
13449
|
+
preset: preset.preset,
|
|
13450
|
+
quality: effectiveQuality,
|
|
13451
|
+
bitrate: effectiveBitrate,
|
|
13452
|
+
pixelFormat: preset.pixelFormat,
|
|
13453
|
+
vp9CpuUsed: cfg.vp9CpuUsed,
|
|
13454
|
+
useGpu: job.config.useGpu,
|
|
13455
|
+
imageFormat: segmentImageFormat,
|
|
13456
|
+
hdr: preset.hdr,
|
|
13457
|
+
// Each segment sets its own GOP (at most the interval); hls never reaches this route.
|
|
13458
|
+
...deliveryEncoder
|
|
13459
|
+
},
|
|
13460
|
+
buildCaptureOptions,
|
|
13461
|
+
createRenderVideoFrameInjector,
|
|
13462
|
+
abortSignal: executionSignal,
|
|
13463
|
+
assertNotAborted,
|
|
13464
|
+
onProgress,
|
|
13465
|
+
dedupPerfs,
|
|
13466
|
+
segmentFrames,
|
|
13467
|
+
segmentDir,
|
|
13468
|
+
workerCount: segmentedPlan.workerCount,
|
|
13469
|
+
browserRecycleEverySegments: resolveSegmentBrowserRecycle(process.env),
|
|
13470
|
+
completedSegments,
|
|
13471
|
+
onSegmentComplete: (entry) => {
|
|
13472
|
+
segmentManifest.completed = [
|
|
13473
|
+
...segmentManifest.completed.filter((e) => e.index !== entry.index),
|
|
13474
|
+
{ ...entry, completedAt: (/* @__PURE__ */ new Date()).toISOString() }
|
|
13475
|
+
];
|
|
13476
|
+
writeSegmentManifest(segmentDir, segmentManifest);
|
|
13477
|
+
},
|
|
13478
|
+
updateCaptureObservability
|
|
13479
|
+
})
|
|
13480
|
+
);
|
|
13331
13481
|
};
|
|
13332
|
-
|
|
13333
|
-
|
|
13334
|
-
|
|
13335
|
-
|
|
13336
|
-
|
|
13337
|
-
|
|
13338
|
-
|
|
13339
|
-
|
|
13340
|
-
|
|
13341
|
-
|
|
13342
|
-
|
|
13343
|
-
|
|
13344
|
-
|
|
13345
|
-
|
|
13346
|
-
|
|
13347
|
-
|
|
13348
|
-
|
|
13349
|
-
|
|
13350
|
-
|
|
13351
|
-
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
|
|
13355
|
-
|
|
13356
|
-
|
|
13357
|
-
|
|
13358
|
-
|
|
13359
|
-
|
|
13360
|
-
|
|
13361
|
-
|
|
13362
|
-
|
|
13363
|
-
|
|
13364
|
-
|
|
13365
|
-
|
|
13366
|
-
|
|
13367
|
-
|
|
13368
|
-
|
|
13369
|
-
|
|
13370
|
-
|
|
13371
|
-
|
|
13372
|
-
|
|
13373
|
-
|
|
13374
|
-
|
|
13375
|
-
|
|
13376
|
-
|
|
13377
|
-
|
|
13378
|
-
|
|
13379
|
-
|
|
13380
|
-
|
|
13381
|
-
|
|
13382
|
-
updateCaptureObservability
|
|
13383
|
-
})
|
|
13384
|
-
);
|
|
13482
|
+
let segmentedRes;
|
|
13483
|
+
try {
|
|
13484
|
+
segmentedRes = await invokeSegmented();
|
|
13485
|
+
} catch (err) {
|
|
13486
|
+
const isVerifyError = isDrawElementVerificationError(err);
|
|
13487
|
+
const isDeStall = isDeRendererStallError(err);
|
|
13488
|
+
if (!isVerifyError && !isDrawElementCaptureError(err) && !isDeStall || err instanceof RenderCancelledError || executionSignal?.aborted === true) {
|
|
13489
|
+
throw err;
|
|
13490
|
+
}
|
|
13491
|
+
deSelfVerifyFallback = isVerifyError;
|
|
13492
|
+
const t = deVerifyFallbackTelemetry(err);
|
|
13493
|
+
deFallbackReason = isVerifyError ? t.reason : isDeStall ? "de_renderer_stall" : "capture_error";
|
|
13494
|
+
deFallbackFailedDb = t.failedDb;
|
|
13495
|
+
deFallbackFrameIndex = t.frameIndex;
|
|
13496
|
+
deFallbackThresholdDb = t.thresholdDb;
|
|
13497
|
+
log.warn(
|
|
13498
|
+
"[Render] drawElement capture failed on the segmented path; re-rendering via screenshot",
|
|
13499
|
+
{
|
|
13500
|
+
error: err instanceof Error ? err.message : String(err)
|
|
13501
|
+
}
|
|
13502
|
+
);
|
|
13503
|
+
observability.checkpoint(
|
|
13504
|
+
"capture_segmented",
|
|
13505
|
+
"drawElement capture failed; retrying with a fresh screenshot session"
|
|
13506
|
+
);
|
|
13507
|
+
if (probeSession) {
|
|
13508
|
+
lastBrowserConsole = probeSession.browserConsoleBuffer;
|
|
13509
|
+
const orphaned = probeSession;
|
|
13510
|
+
probeSession = null;
|
|
13511
|
+
await closeOrphanedProbeForRetry(orphaned, closeCaptureSession, log, "segmented");
|
|
13512
|
+
}
|
|
13513
|
+
rmSync8(segmentDir, { recursive: true, force: true });
|
|
13514
|
+
completedSegments = /* @__PURE__ */ new Set();
|
|
13515
|
+
segmentManifest = emptySegmentManifest();
|
|
13516
|
+
dedupPerfs.length = 0;
|
|
13517
|
+
capturePlan = replanAfterFailure(capturePlan, {
|
|
13518
|
+
kind: isVerifyError ? "draw_element_verification" : "draw_element_capture"
|
|
13519
|
+
});
|
|
13520
|
+
syncCapturePlan();
|
|
13521
|
+
updateCaptureObservability({
|
|
13522
|
+
forceScreenshot: capturePlan.forceScreenshot,
|
|
13523
|
+
deSelfVerifyFallback,
|
|
13524
|
+
deFallbackReason,
|
|
13525
|
+
deFallbackFailedDb,
|
|
13526
|
+
deFallbackFrameIndex,
|
|
13527
|
+
deFallbackThresholdDb
|
|
13528
|
+
});
|
|
13529
|
+
segmentedRes = await invokeSegmented();
|
|
13530
|
+
observability.clearFailure("capture_segmented");
|
|
13531
|
+
}
|
|
13385
13532
|
if (segmentedRes.success) {
|
|
13386
13533
|
streamingHandled = true;
|
|
13387
13534
|
workerCount = segmentedRes.workerCount;
|
|
@@ -13401,7 +13548,7 @@ async function executeRenderPipeline(input) {
|
|
|
13401
13548
|
);
|
|
13402
13549
|
updateCaptureObservability({ segmentRetries: segmentedRes.segmentRetries });
|
|
13403
13550
|
if (job.config.keepSegments !== true) {
|
|
13404
|
-
|
|
13551
|
+
rmSync8(segmentDir, { recursive: true, force: true });
|
|
13405
13552
|
}
|
|
13406
13553
|
} else {
|
|
13407
13554
|
capturePlan = replanAfterFailure(capturePlan, { kind: "streaming_unavailable" });
|
|
@@ -13454,7 +13601,7 @@ async function executeRenderPipeline(input) {
|
|
|
13454
13601
|
// assemble stage's `-c copy` segmentation cuts exactly on
|
|
13455
13602
|
// the segment boundary. Every other format leaves the
|
|
13456
13603
|
// encoder's open-GOP output untouched.
|
|
13457
|
-
...
|
|
13604
|
+
...deliveryEncoder
|
|
13458
13605
|
},
|
|
13459
13606
|
buildCaptureOptions,
|
|
13460
13607
|
createRenderVideoFrameInjector,
|
|
@@ -13617,7 +13764,7 @@ async function executeRenderPipeline(input) {
|
|
|
13617
13764
|
engineConfig: cfg,
|
|
13618
13765
|
// Same value the streaming encoder above spreads — the disk and
|
|
13619
13766
|
// chunked-concat encoders need an identical GOP lock for HLS.
|
|
13620
|
-
...
|
|
13767
|
+
...deliveryEncoder,
|
|
13621
13768
|
abortSignal: executionSignal,
|
|
13622
13769
|
assertNotAborted,
|
|
13623
13770
|
onProgress
|
|
@@ -13673,7 +13820,7 @@ async function executeRenderPipeline(input) {
|
|
|
13673
13820
|
"capture_disk",
|
|
13674
13821
|
"drawElement capture failed; retrying with a fresh screenshot session"
|
|
13675
13822
|
);
|
|
13676
|
-
|
|
13823
|
+
rmSync8(framesDir, { recursive: true, force: true });
|
|
13677
13824
|
mkdirSync8(framesDir, { recursive: true });
|
|
13678
13825
|
resetCaptureAttemptProgress(job);
|
|
13679
13826
|
dedupPerfs.length = 0;
|
|
@@ -13970,7 +14117,7 @@ import {
|
|
|
13970
14117
|
existsSync as existsSync20,
|
|
13971
14118
|
linkSync,
|
|
13972
14119
|
mkdirSync as mkdirSync12,
|
|
13973
|
-
rmSync as
|
|
14120
|
+
rmSync as rmSync10,
|
|
13974
14121
|
writeFileSync as writeFileSync8
|
|
13975
14122
|
} from "fs";
|
|
13976
14123
|
import { extname as extname6, isAbsolute as isAbsolute2, join as join33, relative as relative5, sep as sep2 } from "path";
|
|
@@ -14975,7 +15122,7 @@ import { writeFileSync as writeFileSync7, writeSync } from "fs";
|
|
|
14975
15122
|
import { join as join31 } from "path";
|
|
14976
15123
|
|
|
14977
15124
|
// ../producer/src/services/distributed/mp4Stitch.ts
|
|
14978
|
-
import { createReadStream as createReadStream4, createWriteStream, mkdirSync as mkdirSync10, mkdtempSync as mkdtempSync4, rmSync as
|
|
15125
|
+
import { createReadStream as createReadStream4, createWriteStream, mkdirSync as mkdirSync10, mkdtempSync as mkdtempSync4, rmSync as rmSync9 } from "fs";
|
|
14979
15126
|
import { open } from "fs/promises";
|
|
14980
15127
|
import { dirname as dirname11, join as join30 } from "path";
|
|
14981
15128
|
import { finished, pipeline } from "stream/promises";
|
|
@@ -15352,7 +15499,7 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
|
|
|
15352
15499
|
renameWithRetry(join30(workDir, "out.mp4"), outputPath);
|
|
15353
15500
|
} finally {
|
|
15354
15501
|
out.destroy();
|
|
15355
|
-
|
|
15502
|
+
rmSync9(workDir, { recursive: true, force: true });
|
|
15356
15503
|
}
|
|
15357
15504
|
}
|
|
15358
15505
|
|
|
@@ -15860,7 +16007,7 @@ var FREEZE_OWNED_PLAN_FILES = [
|
|
|
15860
16007
|
];
|
|
15861
16008
|
function removeFreezeOwnedPlanFiles(planDir) {
|
|
15862
16009
|
for (const relativePath of FREEZE_OWNED_PLAN_FILES) {
|
|
15863
|
-
|
|
16010
|
+
rmSync10(join33(planDir, relativePath), { force: true });
|
|
15864
16011
|
}
|
|
15865
16012
|
}
|
|
15866
16013
|
function buildChunkSlices(totalFrames, chunkCount, effectiveChunkSize) {
|
|
@@ -15920,6 +16067,9 @@ function buildLockedRenderConfig(input) {
|
|
|
15920
16067
|
preset,
|
|
15921
16068
|
crf: config.crf,
|
|
15922
16069
|
bitrate: config.bitrate,
|
|
16070
|
+
maxBitrate: config.maxBitrate,
|
|
16071
|
+
bufferSize: config.bufferSize,
|
|
16072
|
+
keyframeIntervalFrames: config.keyframeIntervalSeconds === void 0 ? void 0 : keyframeIntervalToGopSize({ num: config.fps, den: 1 }, config.keyframeIntervalSeconds),
|
|
15923
16073
|
...locksVp9CpuUsed,
|
|
15924
16074
|
// GOP === chunkSize so every chunk's first frame is an IDR keyframe and
|
|
15925
16075
|
// ffmpeg concat-copy round-trips losslessly.
|
|
@@ -16071,7 +16221,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
16071
16221
|
throw new Error(`[plan] entry file not found: ${htmlPath}`);
|
|
16072
16222
|
}
|
|
16073
16223
|
const workDir = join33(planDir, ".plan-work");
|
|
16074
|
-
|
|
16224
|
+
rmSync10(workDir, { recursive: true, force: true });
|
|
16075
16225
|
mkdirSync12(workDir, { recursive: true });
|
|
16076
16226
|
const compiledDir = join33(workDir, "compiled");
|
|
16077
16227
|
mkdirSync12(compiledDir, { recursive: true });
|
|
@@ -16169,7 +16319,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
16169
16319
|
if (probeResult.fileServer) closeFileServerSafely(probeResult.fileServer, "plan", log);
|
|
16170
16320
|
if (probeResult.probeSession) {
|
|
16171
16321
|
try {
|
|
16172
|
-
const { closeCaptureSession: closeCaptureSession2 } = await import("./src-
|
|
16322
|
+
const { closeCaptureSession: closeCaptureSession2 } = await import("./src-ZOXUSGAP.js");
|
|
16173
16323
|
await closeCaptureSession2(probeResult.probeSession);
|
|
16174
16324
|
} catch (err) {
|
|
16175
16325
|
log.warn("[plan] probe session close failed", {
|
|
@@ -16278,15 +16428,15 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
16278
16428
|
logPlanStage(log, "extract", stageStarted);
|
|
16279
16429
|
const stagedVideoFrames = join33(compiledDir, "__hyperframes_video_frames");
|
|
16280
16430
|
const videoFramesDst = join33(planDir, "video-frames");
|
|
16281
|
-
if (existsSync20(videoFramesDst))
|
|
16431
|
+
if (existsSync20(videoFramesDst)) rmSync10(videoFramesDst, { recursive: true, force: true });
|
|
16282
16432
|
const videoSourcesDir = join33(planDir, "video-sources");
|
|
16283
|
-
|
|
16433
|
+
rmSync10(videoSourcesDir, { recursive: true, force: true });
|
|
16284
16434
|
if (existsSync20(stagedVideoFrames)) {
|
|
16285
16435
|
renameWithRetry(stagedVideoFrames, videoFramesDst);
|
|
16286
16436
|
} else {
|
|
16287
16437
|
mkdirSync12(videoFramesDst, { recursive: true });
|
|
16288
16438
|
}
|
|
16289
|
-
if (existsSync20(finalCompiledDir))
|
|
16439
|
+
if (existsSync20(finalCompiledDir)) rmSync10(finalCompiledDir, { recursive: true, force: true });
|
|
16290
16440
|
renameWithRetry(compiledDir, finalCompiledDir);
|
|
16291
16441
|
const shipVideoSource = createVideoSourceShipper({
|
|
16292
16442
|
planDir,
|
|
@@ -16454,7 +16604,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
16454
16604
|
format: config.format
|
|
16455
16605
|
};
|
|
16456
16606
|
try {
|
|
16457
|
-
|
|
16607
|
+
rmSync10(workDir, { recursive: true, force: true });
|
|
16458
16608
|
} catch (err) {
|
|
16459
16609
|
log.warn("[plan] failed to remove temp work dir", {
|
|
16460
16610
|
workDir,
|
|
@@ -16605,6 +16755,20 @@ function validateDistributedRenderConfig(config) {
|
|
|
16605
16755
|
`must look like "10M" or "5000k"; got ${JSON.stringify(config.bitrate)}`
|
|
16606
16756
|
);
|
|
16607
16757
|
}
|
|
16758
|
+
try {
|
|
16759
|
+
validateDeliveryEncoderConfig({
|
|
16760
|
+
format: config.format,
|
|
16761
|
+
fps: { num: config.fps, den: 1 },
|
|
16762
|
+
keyframeIntervalSeconds: config.keyframeIntervalSeconds,
|
|
16763
|
+
maxBitrate: config.maxBitrate,
|
|
16764
|
+
bufferSize: config.bufferSize
|
|
16765
|
+
});
|
|
16766
|
+
} catch (error) {
|
|
16767
|
+
throw new InvalidConfigError(
|
|
16768
|
+
"config.maxBitrate",
|
|
16769
|
+
error instanceof Error ? error.message : String(error)
|
|
16770
|
+
);
|
|
16771
|
+
}
|
|
16608
16772
|
if (config.chunkSize !== void 0) {
|
|
16609
16773
|
if (!Number.isInteger(config.chunkSize) || config.chunkSize < 1) {
|
|
16610
16774
|
throw new InvalidConfigError(
|
|
@@ -16784,6 +16948,12 @@ function assertOptionalInteger(options, field, min = 0) {
|
|
|
16784
16948
|
throw new Error(`Render request ${field} must be an integer >= ${min}`);
|
|
16785
16949
|
}
|
|
16786
16950
|
}
|
|
16951
|
+
function assertOptionalPositiveNumber(options, field) {
|
|
16952
|
+
const value = options[field];
|
|
16953
|
+
if (value !== void 0 && !(typeof value === "number" && value > 0)) {
|
|
16954
|
+
throw new Error(`Render request ${field} must be a positive number`);
|
|
16955
|
+
}
|
|
16956
|
+
}
|
|
16787
16957
|
function assertOptionalString(options, field) {
|
|
16788
16958
|
if (options[field] !== void 0 && typeof options[field] !== "string") {
|
|
16789
16959
|
throw new Error(`Render request ${field} must be a string`);
|
|
@@ -16831,10 +17001,11 @@ function assertRequestOptionScalars(options) {
|
|
|
16831
17001
|
assertOptionalInteger(options, "workers", 1);
|
|
16832
17002
|
assertOptionalInteger(options, "maxRenderMs");
|
|
16833
17003
|
assertOptionalInteger(options, "crf");
|
|
17004
|
+
assertOptionalPositiveNumber(options, "keyframeIntervalSeconds");
|
|
16834
17005
|
for (const field of ["useGpu", "debug", "outputResolutionAspectAgnostic"]) {
|
|
16835
17006
|
assertOptionalBoolean(options, field);
|
|
16836
17007
|
}
|
|
16837
|
-
for (const field of ["entryFile", "videoBitrate"]) {
|
|
17008
|
+
for (const field of ["entryFile", "videoBitrate", "maxBitrate", "bufferSize"]) {
|
|
16838
17009
|
assertOptionalString(options, field);
|
|
16839
17010
|
}
|
|
16840
17011
|
assertOptionalEnum(options, "strictness", ["strict", "best-effort"]);
|
|
@@ -16937,6 +17108,9 @@ function distributedConfigFromRequest(request, runtime = {}) {
|
|
|
16937
17108
|
crf: options.crf,
|
|
16938
17109
|
pageMotionBlur: options.pageMotionBlur,
|
|
16939
17110
|
bitrate: options.videoBitrate,
|
|
17111
|
+
keyframeIntervalSeconds: options.keyframeIntervalSeconds,
|
|
17112
|
+
maxBitrate: options.maxBitrate,
|
|
17113
|
+
bufferSize: options.bufferSize,
|
|
16940
17114
|
videoFrameFormat: options.videoFrameFormat,
|
|
16941
17115
|
outputResolution: options.outputResolution,
|
|
16942
17116
|
outputResolutionAspectAgnostic: options.outputResolutionAspectAgnostic,
|
|
@@ -16984,6 +17158,9 @@ function renderRequestFromDistributedConfig(input) {
|
|
|
16984
17158
|
...optionalProperty("crf", config.crf),
|
|
16985
17159
|
...optionalProperty("pageMotionBlur", config.pageMotionBlur),
|
|
16986
17160
|
...optionalProperty("videoBitrate", config.bitrate),
|
|
17161
|
+
...optionalProperty("keyframeIntervalSeconds", config.keyframeIntervalSeconds),
|
|
17162
|
+
...optionalProperty("maxBitrate", config.maxBitrate),
|
|
17163
|
+
...optionalProperty("bufferSize", config.bufferSize),
|
|
16987
17164
|
...optionalProperty("videoFrameFormat", config.videoFrameFormat),
|
|
16988
17165
|
...optionalProperty("outputResolution", config.outputResolution),
|
|
16989
17166
|
...optionalProperty("outputResolutionAspectAgnostic", config.outputResolutionAspectAgnostic),
|
|
@@ -17007,7 +17184,7 @@ import {
|
|
|
17007
17184
|
statSync as statSync8,
|
|
17008
17185
|
mkdtempSync as mkdtempSync5,
|
|
17009
17186
|
writeFileSync as writeFileSync9,
|
|
17010
|
-
rmSync as
|
|
17187
|
+
rmSync as rmSync11,
|
|
17011
17188
|
createReadStream as createReadStream5
|
|
17012
17189
|
} from "fs";
|
|
17013
17190
|
import { resolve as resolve9, dirname as dirname13, join as join36 } from "path";
|
|
@@ -17229,6 +17406,8 @@ var DEFAULT_SERVER_FPS = { num: 30, den: 1 };
|
|
|
17229
17406
|
var SSE_KEEPALIVE_MS = 3e4;
|
|
17230
17407
|
var SAFE_RENDER_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
17231
17408
|
"ASSET_MEDIA_TYPE_MISMATCH",
|
|
17409
|
+
"HEIF_IMAGE_CONVERSION_FAILED",
|
|
17410
|
+
"HEIF_TOOL_UNAVAILABLE",
|
|
17232
17411
|
"NOT_MEDIA_PAYLOAD",
|
|
17233
17412
|
"INVALID_VIDEO_METADATA",
|
|
17234
17413
|
"VIDEO_SOURCE_UNRENDERABLE",
|
|
@@ -17303,7 +17482,7 @@ function parseRenderOptions(body) {
|
|
|
17303
17482
|
const format = parseServerFormat(body.format);
|
|
17304
17483
|
const outputDynamicRange = parseServerOutputDynamicRange(body.outputDynamicRange) ?? fromRenderHdrMode(parseLegacyServerHdrMode(body.hdrMode));
|
|
17305
17484
|
const encoder = parseEncoderOptions(body, format ?? "mp4");
|
|
17306
|
-
const { crf, videoBitrate, videoFrameFormat } = encoder.ok ? encoder.options : {};
|
|
17485
|
+
const { crf, videoBitrate, videoFrameFormat, keyframeIntervalSeconds, maxBitrate, bufferSize } = encoder.ok ? encoder.options : {};
|
|
17307
17486
|
const { variables, outputResolution, outputResolutionAspectAgnostic } = parseRenderOverrides(body);
|
|
17308
17487
|
return {
|
|
17309
17488
|
outputPath,
|
|
@@ -17313,6 +17492,9 @@ function parseRenderOptions(body) {
|
|
|
17313
17492
|
maxRenderMs,
|
|
17314
17493
|
crf,
|
|
17315
17494
|
videoBitrate,
|
|
17495
|
+
keyframeIntervalSeconds,
|
|
17496
|
+
maxBitrate,
|
|
17497
|
+
bufferSize,
|
|
17316
17498
|
useGpu,
|
|
17317
17499
|
debug,
|
|
17318
17500
|
strictness,
|
|
@@ -17347,6 +17529,9 @@ function buildRenderJobConfig(input, outputPath, log) {
|
|
|
17347
17529
|
maxRenderMs: input.maxRenderMs,
|
|
17348
17530
|
crf: input.crf,
|
|
17349
17531
|
videoBitrate: input.videoBitrate,
|
|
17532
|
+
keyframeIntervalSeconds: input.keyframeIntervalSeconds,
|
|
17533
|
+
maxBitrate: input.maxBitrate,
|
|
17534
|
+
bufferSize: input.bufferSize,
|
|
17350
17535
|
useGpu: input.useGpu,
|
|
17351
17536
|
debug: input.debug,
|
|
17352
17537
|
strictness: input.strictness,
|
|
@@ -17493,7 +17678,7 @@ function createArtifactStore(ttlMs) {
|
|
|
17493
17678
|
function cleanupTempDir(dir, log) {
|
|
17494
17679
|
if (!dir) return;
|
|
17495
17680
|
try {
|
|
17496
|
-
|
|
17681
|
+
rmSync11(dir, { recursive: true, force: true });
|
|
17497
17682
|
} catch (error) {
|
|
17498
17683
|
log.warn("Failed to cleanup temp project dir", {
|
|
17499
17684
|
cleanupProjectDir: dir,
|
|
@@ -17851,7 +18036,7 @@ function startServer(options = {}) {
|
|
|
17851
18036
|
});
|
|
17852
18037
|
async function shutdown(signal) {
|
|
17853
18038
|
log.info(`Received ${signal}, shutting down`);
|
|
17854
|
-
const { drainBrowserPool } = await import("./src-
|
|
18039
|
+
const { drainBrowserPool } = await import("./src-ZOXUSGAP.js");
|
|
17855
18040
|
await drainBrowserPool().catch(() => {
|
|
17856
18041
|
});
|
|
17857
18042
|
const handle = await Promise.race([
|
|
@@ -17895,7 +18080,7 @@ import {
|
|
|
17895
18080
|
mkdtempSync as mkdtempSync7,
|
|
17896
18081
|
readFileSync as readFileSync12,
|
|
17897
18082
|
readdirSync as readdirSync9,
|
|
17898
|
-
rmSync as
|
|
18083
|
+
rmSync as rmSync13,
|
|
17899
18084
|
statSync as statSync10,
|
|
17900
18085
|
writeFileSync as writeFileSync11
|
|
17901
18086
|
} from "fs";
|
|
@@ -17909,7 +18094,7 @@ import {
|
|
|
17909
18094
|
linkSync as linkSync2,
|
|
17910
18095
|
mkdirSync as mkdirSync14,
|
|
17911
18096
|
mkdtempSync as mkdtempSync6,
|
|
17912
|
-
rmSync as
|
|
18097
|
+
rmSync as rmSync12,
|
|
17913
18098
|
statSync as statSync9,
|
|
17914
18099
|
writeFileSync as writeFileSync10
|
|
17915
18100
|
} from "fs";
|
|
@@ -18003,7 +18188,7 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
18003
18188
|
}
|
|
18004
18189
|
renameWithRetry(temporaryPath, destinationPath);
|
|
18005
18190
|
} finally {
|
|
18006
|
-
|
|
18191
|
+
rmSync12(stagingDir, { recursive: true, force: true });
|
|
18007
18192
|
}
|
|
18008
18193
|
}
|
|
18009
18194
|
async commitManifest(manifestBytes) {
|
|
@@ -18020,7 +18205,7 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
18020
18205
|
}
|
|
18021
18206
|
async abort() {
|
|
18022
18207
|
if (!this.#committed) {
|
|
18023
|
-
|
|
18208
|
+
rmSync12(this.temporaryDir, { recursive: true, force: true });
|
|
18024
18209
|
}
|
|
18025
18210
|
}
|
|
18026
18211
|
};
|
|
@@ -18289,7 +18474,7 @@ function writeBlob(sourcePath, destinationPath) {
|
|
|
18289
18474
|
copyFileSync6(sourcePath, temporaryPath);
|
|
18290
18475
|
renameWithRetry(temporaryPath, destinationPath);
|
|
18291
18476
|
} finally {
|
|
18292
|
-
|
|
18477
|
+
rmSync13(temporaryDir, { recursive: true, force: true });
|
|
18293
18478
|
}
|
|
18294
18479
|
}
|
|
18295
18480
|
function publishBlobFor(absolutePath, digests) {
|
|
@@ -18422,7 +18607,7 @@ function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
|
|
|
18422
18607
|
renameWithRetry(tempDir, planV2Dir);
|
|
18423
18608
|
return resultFromManifest(planV2Dir, publication.manifest);
|
|
18424
18609
|
} catch (error) {
|
|
18425
|
-
|
|
18610
|
+
rmSync13(tempDir, { recursive: true, force: true });
|
|
18426
18611
|
throw error;
|
|
18427
18612
|
}
|
|
18428
18613
|
}
|
|
@@ -18489,7 +18674,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
|
|
|
18489
18674
|
}
|
|
18490
18675
|
throw error;
|
|
18491
18676
|
} finally {
|
|
18492
|
-
|
|
18677
|
+
rmSync13(stagingRoot, { recursive: true, force: true });
|
|
18493
18678
|
}
|
|
18494
18679
|
}
|
|
18495
18680
|
async function planV2(projectDir, config, planV2Dir) {
|
|
@@ -18706,7 +18891,7 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
|
|
|
18706
18891
|
);
|
|
18707
18892
|
renameWithRetry(tempDir, destinationDir);
|
|
18708
18893
|
} catch (error) {
|
|
18709
|
-
|
|
18894
|
+
rmSync13(tempDir, { recursive: true, force: true });
|
|
18710
18895
|
throw error;
|
|
18711
18896
|
}
|
|
18712
18897
|
return {
|
|
@@ -18770,7 +18955,7 @@ function readValidatedPlanV2Materialization(planDir, expectedTarget) {
|
|
|
18770
18955
|
}
|
|
18771
18956
|
|
|
18772
18957
|
// ../producer/src/services/distributed/planV2Execution.ts
|
|
18773
|
-
import { mkdtempSync as mkdtempSync9, rmSync as
|
|
18958
|
+
import { mkdtempSync as mkdtempSync9, rmSync as rmSync16 } from "fs";
|
|
18774
18959
|
import { tmpdir as tmpdir5 } from "os";
|
|
18775
18960
|
import { join as join42 } from "path";
|
|
18776
18961
|
|
|
@@ -18782,7 +18967,7 @@ import {
|
|
|
18782
18967
|
mkdtempSync as mkdtempSync8,
|
|
18783
18968
|
readFileSync as readFileSync13,
|
|
18784
18969
|
readdirSync as readdirSync10,
|
|
18785
|
-
rmSync as
|
|
18970
|
+
rmSync as rmSync14,
|
|
18786
18971
|
statSync as statSync11,
|
|
18787
18972
|
writeFileSync as writeFileSync12
|
|
18788
18973
|
} from "fs";
|
|
@@ -18849,7 +19034,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
18849
19034
|
});
|
|
18850
19035
|
} finally {
|
|
18851
19036
|
try {
|
|
18852
|
-
|
|
19037
|
+
rmSync14(workDir, { recursive: true, force: true });
|
|
18853
19038
|
} catch (err) {
|
|
18854
19039
|
log.warn("[assemble] failed to remove work dir", {
|
|
18855
19040
|
workDir,
|
|
@@ -18911,6 +19096,9 @@ function cfrEncodeArgs(inputArgs, encoder, fpsArg) {
|
|
|
18911
19096
|
"-r",
|
|
18912
19097
|
fpsArg
|
|
18913
19098
|
];
|
|
19099
|
+
if (encoder.keyframeIntervalFrames !== void 0)
|
|
19100
|
+
args.push("-g", String(encoder.keyframeIntervalFrames));
|
|
19101
|
+
appendRateCapArgs(args, encoder);
|
|
18914
19102
|
appendSoftwareEncoderThreadsArg(args, "libx264");
|
|
18915
19103
|
return args;
|
|
18916
19104
|
}
|
|
@@ -19047,7 +19235,7 @@ function readCfrEncoder(planDir, format) {
|
|
|
19047
19235
|
return encoderJson;
|
|
19048
19236
|
}
|
|
19049
19237
|
function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, startTimeMs) {
|
|
19050
|
-
if (existsSync26(outputPath))
|
|
19238
|
+
if (existsSync26(outputPath)) rmSync14(outputPath, { recursive: true, force: true });
|
|
19051
19239
|
mkdirSync16(outputPath, { recursive: true });
|
|
19052
19240
|
let globalIdx = 0;
|
|
19053
19241
|
for (const chunkDir of chunkPaths) {
|
|
@@ -19092,7 +19280,7 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
19092
19280
|
|
|
19093
19281
|
// ../producer/src/services/distributed/renderChunk.ts
|
|
19094
19282
|
import { randomBytes } from "crypto";
|
|
19095
|
-
import { existsSync as existsSync27, mkdirSync as mkdirSync17, readFileSync as readFileSync14, readdirSync as readdirSync11, rmSync as
|
|
19283
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync17, readFileSync as readFileSync14, readdirSync as readdirSync11, rmSync as rmSync15, writeFileSync as writeFileSync13 } from "fs";
|
|
19096
19284
|
import { cpus as cpus3 } from "os";
|
|
19097
19285
|
import { join as join41 } from "path";
|
|
19098
19286
|
var LEGACY_DISTRIBUTED_VP9_CPU_USED = 2;
|
|
@@ -19530,7 +19718,9 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
19530
19718
|
// first frame is an IDR keyframe and concat-copy at assemble time
|
|
19531
19719
|
// round-trips losslessly.
|
|
19532
19720
|
lockGopForChunkConcat: !isPngSequence,
|
|
19533
|
-
gopSize: framesInChunk
|
|
19721
|
+
gopSize: chunkGopFrames(framesInChunk, encoder.keyframeIntervalFrames),
|
|
19722
|
+
maxBitrate: encoder.maxBitrate,
|
|
19723
|
+
bufferSize: encoder.bufferSize
|
|
19534
19724
|
};
|
|
19535
19725
|
const captureStarted = Date.now();
|
|
19536
19726
|
captureMode = await runCaptureWithScreenshotFallback({
|
|
@@ -19602,7 +19792,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
19602
19792
|
return observedChunkCaptureMode(capturePerfs);
|
|
19603
19793
|
},
|
|
19604
19794
|
resetForScreenshotRetry: () => {
|
|
19605
|
-
|
|
19795
|
+
rmSync15(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
19606
19796
|
mkdirSync17(framesDir, { recursive: true });
|
|
19607
19797
|
capturePerfs.length = 0;
|
|
19608
19798
|
captureAttempts.length = 0;
|
|
@@ -19645,8 +19835,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
19645
19835
|
fps: { num: plan2.dimensions.fpsNum, den: plan2.dimensions.fpsDen },
|
|
19646
19836
|
timeoutMs: cfg.ffmpegProcessTimeout
|
|
19647
19837
|
});
|
|
19648
|
-
|
|
19649
|
-
|
|
19838
|
+
rmSync15(videoOnlyPath, { force: true });
|
|
19839
|
+
rmSync15(audioScratchPath, { force: true });
|
|
19650
19840
|
}
|
|
19651
19841
|
encodeStageMs = Date.now() - encodeStarted;
|
|
19652
19842
|
} finally {
|
|
@@ -19696,8 +19886,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
19696
19886
|
writeFileSync13(perfPath, `${JSON.stringify(perfPayload, null, 2)}
|
|
19697
19887
|
`, "utf-8");
|
|
19698
19888
|
try {
|
|
19699
|
-
|
|
19700
|
-
|
|
19889
|
+
rmSync15(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
19890
|
+
rmSync15(videoFramesDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
19701
19891
|
} catch (err) {
|
|
19702
19892
|
log.warn("[renderChunk] failed to remove work dir", {
|
|
19703
19893
|
workDir,
|
|
@@ -19732,7 +19922,7 @@ async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath, options) {
|
|
|
19732
19922
|
materializePlanV2Target(planV2Dir, { role: "chunk", chunkIndex }, materializedPlanDir);
|
|
19733
19923
|
return await renderChunk(materializedPlanDir, chunkIndex, outputChunkPath, options);
|
|
19734
19924
|
} finally {
|
|
19735
|
-
|
|
19925
|
+
rmSync16(workRoot, { recursive: true, force: true });
|
|
19736
19926
|
}
|
|
19737
19927
|
}
|
|
19738
19928
|
async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
|
|
@@ -19752,7 +19942,7 @@ async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
|
|
|
19752
19942
|
options
|
|
19753
19943
|
);
|
|
19754
19944
|
} finally {
|
|
19755
|
-
|
|
19945
|
+
rmSync16(workRoot, { recursive: true, force: true });
|
|
19756
19946
|
}
|
|
19757
19947
|
}
|
|
19758
19948
|
|
|
@@ -19780,6 +19970,7 @@ export {
|
|
|
19780
19970
|
createOwnedRenderDir,
|
|
19781
19971
|
listAbandonedRenderDirs,
|
|
19782
19972
|
collectRenderMedia,
|
|
19973
|
+
mediaProfileMatchesElementType,
|
|
19783
19974
|
localizeRemoteMediaSources,
|
|
19784
19975
|
localizeRemoteImageSources,
|
|
19785
19976
|
localizeRemoteFontFaces,
|