hyperframes 0.8.207 → 0.8.209
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-LXFWHBE3.js → add-VZKUIZEH.js} +17 -15
- package/dist/{agentPromptGenerator-D2E62ZP5.js → agentPromptGenerator-4NJ252MR.js} +6 -2
- package/dist/{animatedGifPrep-VBPJZKFT.js → animatedGifPrep-PN4G4YPJ.js} +10 -7
- package/dist/api.js +24 -20
- package/dist/{appHistory-HIBH6XZW.js → appHistory-OHYU5ZBQ.js} +3 -2
- package/dist/{asset-JX4RW3GO.js → asset-I4PHGE57.js} +2 -2
- package/dist/{assetCataloger-JKKOPBCF.js → assetCataloger-LRAUXQ46.js} +12 -8
- package/dist/{audio-OXQ3L6DW.js → audio-T7SAVYED.js} +424 -133
- package/dist/{auth-JAL7P7ZA.js → auth-GP6HTQT3.js} +4 -4
- package/dist/{autoUpdate-MRI2AICE.js → autoUpdate-Z6GFPZAG.js} +4 -4
- package/dist/{backgroundChecks-ORR46PBY.js → backgroundChecks-ZJ7JV52S.js} +5 -5
- package/dist/backgroundChecksWorker.js +5 -5
- package/dist/{batchRender-IFZYPGIW.js → batchRender-J3ETE23Y.js} +5 -4
- package/dist/{beats-UDLOEW6U.js → beats-WF4FJCM5.js} +25 -15
- package/dist/{benchmark-VTVDNKSO.js → benchmark-B7UPP4PQ.js} +10 -10
- package/dist/{browser-QJC4BL2Y.js → browser-SIUYD43U.js} +8 -8
- package/dist/{bundleWithLocalizedFonts-Z2JTBNDS.js → bundleWithLocalizedFonts-RRGFY3XV.js} +3 -3
- package/dist/{capture-2P4JERSX.js → capture-J3GLHUKI.js} +52 -17
- package/dist/{capture-GLM2ACPM.js → capture-VYS4PCCJ.js} +66 -39
- package/dist/{captureCompositionFrame-A2A5MGQB.js → captureCompositionFrame-SVLMPQYC.js} +16 -14
- package/dist/{captureFile-RPUEOZO6.js → captureFile-VIVGKFY4.js} +2 -1
- package/dist/{catalog-5ZLVUQVJ.js → catalog-DVBNR422.js} +17 -15
- package/dist/{catch-up-FRMVYJHZ.js → catch-up-OBPMV7KG.js} +9 -8
- package/dist/{check-WVY7SM7C.js → check-MEALXNZK.js} +47 -44
- package/dist/{checkAudio-PLEQY3SZ.js → checkAudio-RZ7WQYVN.js} +23 -13
- package/dist/{checkBrowser-XSZUA2DQ.js → checkBrowser-2LEQ2LSX.js} +39 -36
- package/dist/{chunk-526VSRZ4.js → chunk-3A4SB326.js} +6 -6
- package/dist/{chunk-GXUONASF.js → chunk-3PTZ2TD4.js} +25 -2
- package/dist/{chunk-JQ32262N.js → chunk-3PUXUIWB.js} +1 -1
- package/dist/chunk-3RATCY3W.js +205 -0
- package/dist/{chunk-MAUGXKSI.js → chunk-4BXEPVSA.js} +113 -20
- package/dist/{chunk-C6KE4AFW.js → chunk-56ANHX5U.js} +1 -1
- package/dist/{chunk-VBPNCOD7.js → chunk-5T4DP25D.js} +5 -3
- package/dist/{chunk-IBZHSU2J.js → chunk-66PNSZ7K.js} +1 -1
- package/dist/{chunk-WL263XM2.js → chunk-6PWQH77E.js} +1 -1
- package/dist/chunk-7VZEOCUY.js +98 -0
- package/dist/{chunk-VAVDAOUA.js → chunk-A7GDBL6D.js} +1 -1
- package/dist/{chunk-UAT2UMTP.js → chunk-AQTODJWP.js} +1 -1
- package/dist/{chunk-5KBMYSF2.js → chunk-BYPDKF36.js} +7 -2
- package/dist/{chunk-EG3B2VWK.js → chunk-CA3PXWN4.js} +16 -21
- package/dist/{chunk-FEO7YW7V.js → chunk-CBM4ZUVN.js} +6 -6
- package/dist/{chunk-6KCFVLO6.js → chunk-CIDCNE2D.js} +21 -5
- package/dist/{chunk-C53ZNJDZ.js → chunk-D2CE2J2A.js} +1 -1
- package/dist/chunk-D3MUHMFG.js +16 -0
- package/dist/{chunk-5PYRU5DT.js → chunk-D6T5BNSK.js} +18 -17
- package/dist/{chunk-PUIG6DHT.js → chunk-DR47DSOY.js} +7 -7
- package/dist/chunk-DROFHVQD.js +240 -0
- package/dist/{chunk-YJK6HOL5.js → chunk-DVIX7UPH.js} +2 -2
- package/dist/{chunk-QTWXVOZI.js → chunk-EA5FUMJN.js} +2 -2
- package/dist/{chunk-NWGXTUYS.js → chunk-EQBDKYXR.js} +3 -30
- package/dist/{chunk-4UMPIPCQ.js → chunk-ERUQ3S6D.js} +2 -2
- package/dist/{chunk-T2EUWCJE.js → chunk-EU7MVORF.js} +13 -1
- package/dist/{chunk-IW5P4KK7.js → chunk-EVYDKSML.js} +3 -3
- package/dist/{chunk-FVAI7AHF.js → chunk-F4O4G4ZW.js} +5 -5
- package/dist/{chunk-6KOHY5EP.js → chunk-FB5BXGGF.js} +17 -11
- package/dist/{chunk-HTIUNMTP.js → chunk-GDZA4ALG.js} +8 -2
- package/dist/{chunk-DJQZ7DEH.js → chunk-GQZHLF5P.js} +15 -15
- package/dist/{chunk-ZYGIDXAK.js → chunk-H7B526GH.js} +114 -65
- package/dist/{chunk-P2I4RLJE.js → chunk-HTZJNQYI.js} +1 -1
- package/dist/{chunk-I2TDHVFV.js → chunk-I3ICHLHV.js} +2 -2
- package/dist/{chunk-CVZO6TFE.js → chunk-IJPFVMIE.js} +11 -11
- package/dist/{chunk-LK6KPVX2.js → chunk-IQNS7O4W.js} +403 -290
- package/dist/{chunk-XDMZY3H7.js → chunk-J7A73K2B.js} +43 -35
- package/dist/{chunk-RPZNQV6D.js → chunk-JC6BAQOG.js} +4 -10
- package/dist/{chunk-HA3V4XAF.js → chunk-JJRMN2RV.js} +63 -200
- package/dist/{chunk-XMRA7CQG.js → chunk-KCLBO65Y.js} +1 -1
- package/dist/{chunk-QE4WRS3N.js → chunk-KGBFHYHX.js} +4 -4
- package/dist/{chunk-HM7SUIQD.js → chunk-KTWGVEN6.js} +3 -3
- package/dist/{chunk-7PJ3AJB2.js → chunk-L5XVBFUM.js} +1 -1
- package/dist/{chunk-NSC5A4IR.js → chunk-L7MGVFR4.js} +7 -2
- package/dist/{chunk-I3TYUQLB.js → chunk-LJ7H2A2C.js} +1 -1
- package/dist/{chunk-VH4PNYOS.js → chunk-LV4NWCJS.js} +2 -2
- package/dist/{chunk-ELP5QZWL.js → chunk-M4QZFUMW.js} +1 -1
- package/dist/{chunk-7RWUY3BJ.js → chunk-MI4V4HPE.js} +1 -1
- package/dist/{chunk-SXOD5J7T.js → chunk-MKALOCDV.js} +1 -1
- package/dist/{chunk-UKM3JYNB.js → chunk-MVNTJGDX.js} +3 -3
- package/dist/{chunk-PSX5SF2N.js → chunk-NEASABW6.js} +1 -1
- package/dist/{chunk-H3LQ5X6Q.js → chunk-NJZRXELC.js} +68 -34
- package/dist/{chunk-EOVYQ3IG.js → chunk-NQ2INEHX.js} +17 -17
- package/dist/{chunk-LCCYYTEK.js → chunk-NXNDHV26.js} +1 -1
- package/dist/{chunk-JKE24AG7.js → chunk-OK3QLJSF.js} +1 -1
- package/dist/{chunk-63DP5CB2.js → chunk-OML6HQQN.js} +4 -4
- package/dist/{chunk-UUOIH4RW.js → chunk-P2FSCR5B.js} +2 -2
- package/dist/{chunk-ZCJ5EGLU.js → chunk-P327BIJR.js} +66 -1
- package/dist/{chunk-HVOTYAS4.js → chunk-P3OKYRGA.js} +3 -3
- package/dist/{chunk-U32PA6DI.js → chunk-PYVYF64E.js} +1 -1
- package/dist/{chunk-EHFZEKQM.js → chunk-Q43YUROE.js} +1 -1
- package/dist/{chunk-CZUAX3BV.js → chunk-QIDN4ML5.js} +1 -1
- package/dist/{chunk-NHL5CMO2.js → chunk-QIKZ2HZJ.js} +3 -3
- package/dist/{chunk-IK4JY2LI.js → chunk-R52YM6ZK.js} +2 -2
- package/dist/{chunk-DML6BD4K.js → chunk-RAONLDN5.js} +2 -2
- package/dist/{chunk-MSHL6CF2.js → chunk-RJO4X3AA.js} +1 -1
- package/dist/{chunk-6IYIS2U7.js → chunk-RVG2JNDU.js} +2 -2
- package/dist/{chunk-UYPWH7PH.js → chunk-SE6S4SGZ.js} +13 -15
- package/dist/{chunk-NJNC2DQV.js → chunk-SNLXWCET.js} +105 -46
- package/dist/{chunk-TSTONNOD.js → chunk-SOXQXX2M.js} +2 -2
- package/dist/{chunk-EGRIVMCQ.js → chunk-SPMKVI6H.js} +2 -2
- package/dist/{chunk-PL36HK3U.js → chunk-SWHCYFEF.js} +27 -5
- package/dist/{chunk-ID766OZB.js → chunk-TF7YE7J5.js} +3 -3
- package/dist/{chunk-XAGBSYIQ.js → chunk-TSM67ADU.js} +1 -1
- package/dist/{chunk-KDHHPJOG.js → chunk-U5IZUWBW.js} +4 -4
- package/dist/{chunk-T4JGFCXU.js → chunk-V4VXWOIF.js} +4 -4
- package/dist/{chunk-6N65ZMC5.js → chunk-VYRJAQGC.js} +1 -1
- package/dist/{chunk-LXP6XWJL.js → chunk-W32DVMX3.js} +2 -2
- package/dist/{chunk-LPI7HX4G.js → chunk-WLVHSGVL.js} +2 -2
- package/dist/chunk-XCIHCPJK.js +106 -0
- package/dist/chunk-XFMO3BEN.js +71 -0
- package/dist/{chunk-XKW4Z7BU.js → chunk-Y2EVJBR6.js} +1 -1
- package/dist/{chunk-QZ2JQ6O4.js → chunk-YCGLT5B4.js} +3 -3
- package/dist/{chunk-5PCALX6G.js → chunk-YIFEK3UD.js} +1 -1
- package/dist/{chunk-ZF3R2IPC.js → chunk-YRO3PXWU.js} +2 -85
- package/dist/chunk-Z5J67X44.js +40 -0
- package/dist/{chunk-XULJBZ7K.js → chunk-Z67J3TTU.js} +5 -3
- package/dist/{chunk-7JAD4MEW.js → chunk-ZA5TNF4R.js} +1 -0
- package/dist/{chunk-6Z7XDUUJ.js → chunk-ZMIRSWN6.js} +1 -1
- package/dist/{chunk-IYZT62UR.js → chunk-ZPILPVYU.js} +2 -2
- package/dist/chunk-ZXTSUXSL.js +4870 -0
- package/dist/{clean-TL3IPJDN.js → clean-VWCYLOVI.js} +26 -22
- package/dist/cli.js +58 -58
- package/dist/{cloud-EYMRPJNY.js → cloud-HU3RXCVE.js} +4 -4
- package/dist/{cloudrun-TOJ36NLX.js → cloudrun-OST6QBYD.js} +6 -5
- package/dist/commands/layout-audit.browser.js +1 -0
- package/dist/{compare-MP5EOW4D.js → compare-U2MJWZAH.js} +38 -35
- package/dist/{compiler-NOPVLJ2S.js → compiler-DSP4MVEC.js} +5 -3
- package/dist/{component-ASACDCZK.js → component-EC5XU6KR.js} +3 -3
- package/dist/{compositions-WKNZJY34.js → compositions-AKYCTF4G.js} +16 -13
- package/dist/{contactSheet-YOBPATEM.js → contactSheet-RYAE7Y5D.js} +3 -2
- package/dist/{delete-DQTFHP3G.js → delete-Z5MOEZM2.js} +10 -9
- package/dist/{deploy-HHCFOUFM.js → deploy-Y4LFVYXT.js} +6 -6
- package/dist/{dist-L4Z4ZEYW.js → dist-73YTUT3W.js} +1 -1
- package/dist/{dist-NQEYA4ZX.js → dist-JJL4QUDL.js} +2 -2
- package/dist/docker/Dockerfile.render +1 -1
- package/dist/{doctor-JDM65CP7.js → doctor-7234U557.js} +18 -15
- package/dist/{events-RKRHRLJD.js → events-RUIZNTG3.js} +4 -4
- package/dist/{events-MBRNA3UF.js → events-SII53QYO.js} +5 -5
- package/dist/{feedback-LZWIWV5J.js → feedback-6CCDDQ36.js} +12 -12
- package/dist/{ffmpeg-4PZKSIGE.js → ffmpeg-C4VWK4M2.js} +12 -9
- package/dist/{figma-QFNYUT3F.js → figma-GAN63U5U.js} +3 -3
- package/dist/fontLocalizeCli.js +13 -10
- package/dist/{get-2B5ENJOH.js → get-RZGUHZB4.js} +10 -9
- package/dist/{gpuPolicy-E5FB2GFR.js → gpuPolicy-BGJRCLP4.js} +10 -7
- package/dist/{grade-compare-4GUAPJHE.js → grade-compare-XOBN52WV.js} +38 -35
- package/dist/{heifImagePrep-C2RYIEER.js → heifImagePrep-DCHSYGW7.js} +11 -8
- package/dist/{help-XGDAXV67.js → help-O2IV6PUC.js} +1 -1
- package/dist/{history-WNFF6HGU.js → history-GPTEM4UX.js} +11 -10
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +67 -67
- package/dist/hyperframes-player.global.js +3 -3
- package/dist/{info-BR2LKGJD.js → info-7Y3JPN7C.js} +9 -9
- package/dist/{init-P6UWPUY3.js → init-L6W5WG5K.js} +40 -34
- package/dist/{inspect-MSRPF7ZO.js → inspect-MQZANGQY.js} +37 -34
- package/dist/{installer-MPUQS3ZX.js → installer-DCIMLYB6.js} +4 -4
- package/dist/{keyframes-J6K66QTO.js → keyframes-WNJIKL4G.js} +8 -8
- package/dist/{lambda-LJ2OSWFJ.js → lambda-FEA4SSFK.js} +16 -13
- package/dist/{layout-CDY65XGA.js → layout-AUQAYDJU.js} +37 -34
- package/dist/{lint-CAUNBGPX.js → lint-A33IHYID.js} +9 -9
- package/dist/{lintProject-ZTSX3AWT.js → lintProject-KCN7MRBN.js} +1 -1
- package/dist/{list-33BYQNRZ.js → list-56JHCET6.js} +10 -9
- package/dist/localPage-V3HBGM3Z.js +27 -0
- package/dist/{login-5QMRKOHK.js → login-HUOM4GNP.js} +7 -7
- package/dist/{logout-JYFWWUGK.js → logout-3IID4KXD.js} +3 -3
- package/dist/{manager-3JOHHPVR.js → manager-SDRJOMPR.js} +13 -10
- package/dist/{manager-RMYSZ3KI.js → manager-Z7W4GQGF.js} +4 -4
- package/dist/{media-treatment-4WP22CFN.js → media-treatment-5TGZOD67.js} +27 -22
- package/dist/{models-HPWCHAZX.js → models-ABDX6TXI.js} +17 -14
- package/dist/{motionShot-I7GDIROQ.js → motionShot-AV2WRH2C.js} +20 -18
- package/dist/{normalize-audio-VTMXPSC7.js → normalize-audio-M7T25DST.js} +12 -9
- package/dist/{open-SAO7OQTT.js → open-IRNZY5XN.js} +17 -16
- package/dist/{parakeetRunner-ZYPBIA73.js → parakeetRunner-2EJUIMOJ.js} +21 -17
- package/dist/{pipeline-VNBMR6QU.js → pipeline-QGKOJKXS.js} +13 -10
- package/dist/{play-7VI6A7KN.js → play-2SQLHM5B.js} +26 -23
- package/dist/{policies-GHVXA5PE.js → policies-PKLD4UW5.js} +1 -1
- package/dist/{preflight-VWV7L45J.js → preflight-ZHXMG2SM.js} +14 -11
- package/dist/{present-CSJGYOFF.js → present-RERVL6R7.js} +21 -18
- package/dist/{preview-B246ZTVO.js → preview-S6RQOMHE.js} +28 -25
- package/dist/{producer-WJLFDVQJ.js → producer-DBRGH2FI.js} +1 -1
- package/dist/{projectConfig-OMR46ZWQ.js → projectConfig-TUMDULTL.js} +9 -8
- package/dist/{publication-AA7NNYET.js → publication-7VGXIFVZ.js} +2 -2
- package/dist/{publish-TJ4QVVSP.js → publish-KJB2AGHL.js} +18 -15
- package/dist/{refresh-USSFPJAU.js → refresh-3IRHJEQA.js} +3 -3
- package/dist/{remove-background-LQ2V7W7N.js → remove-background-EFWXPLS4.js} +14 -11
- package/dist/{render-AWEEPG3F.js → render-5O5ARP6C.js} +65 -62
- package/dist/{render-JLTNZ36U.js → render-7S6UBLOE.js} +50 -48
- package/dist/{render-E5QJG74D.js → render-HV6AA22W.js} +6 -5
- package/dist/{render-batch-U4T4VSCM.js → render-batch-7UEOULJJ.js} +7 -6
- package/dist/renderSetupWorker.js +6 -6
- package/dist/{resolver-GXCTUKPV.js → resolver-HFTEER5V.js} +4 -4
- package/dist/{screenshotCapture-X6OKIXCB.js → screenshotCapture-HOW4VSV6.js} +3 -2
- package/dist/{sherpa-4VZWVHWZ.js → sherpa-HSSM76FL.js} +20 -16
- package/dist/skills/hyperframes/SKILL.md +1 -1
- package/dist/skills/hyperframes/references/format.md +1 -0
- package/dist/skills/hyperframes-cli/references/beats.md +2 -0
- package/dist/skills/media-use/references/grading.md +2 -0
- package/dist/skills/media-use/references/local.md +1 -0
- package/dist/{skills-WUKR7SUE.js → skills-RQO5K6WL.js} +7 -7
- package/dist/{skillsUpdateCheck-YXRBY3JC.js → skillsUpdateCheck-S5WL2YLZ.js} +5 -5
- package/dist/{snapshot-Q7S2FTNG.js → snapshot-4RGI235E.js} +119 -66
- package/dist/{src-ZOXUSGAP.js → src-ALOV4D57.js} +26 -10
- package/dist/{src-CLAALR5W.js → src-D75YYW2M.js} +12 -9
- package/dist/{staticProjectServer-DQ7PIDPA.js → staticProjectServer-DIHWPJ6B.js} +21 -18
- package/dist/{status-LR7VXITS.js → status-DTP6ZYDU.js} +3 -3
- package/dist/studio/assets/{hyperframes-player-Cm5aBiKq.js → hyperframes-player-CMH8OeX2.js} +3 -3
- package/dist/studio/assets/{index-BF9YeBnC.js → index-DQam8zzE.js} +71 -71
- package/dist/studio/assets/{index-BrqAmMRt.js → index-DjHzuJGR.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-NUE227JM.js → studio-api-A2VSWTVF.js} +13 -10
- package/dist/{studioServer-HVOKP4VI.js → studioServer-PECYWZHS.js} +60 -57
- package/dist/{synthesize-QZHRXGRY.js → synthesize-RVE7IUOJ.js} +3 -2
- package/dist/{telemetry-IHU4HL3R.js → telemetry-6BPSGY5W.js} +2 -2
- package/dist/{telemetry-2Y5JXLDB.js → telemetry-YDGXGOLH.js} +5 -5
- package/dist/{timeline-WOQGXFRV.js → timeline-5WUEEKZ3.js} +27 -23
- package/dist/{tokens-T3OHTWUC.js → tokens-XVFZPIUZ.js} +2 -2
- package/dist/{transcribe-JZ3BO546.js → transcribe-QWDUIJWK.js} +26 -22
- package/dist/{transcribe-4U74P5TG.js → transcribe-TTJ6CDQT.js} +17 -13
- package/dist/{tts-AY4JO5NQ.js → tts-AGMCPQXE.js} +1 -1
- package/dist/{updateCheck-6EUAGAM4.js → updateCheck-P7STSJ6Q.js} +4 -4
- package/dist/{upgrade-55K6F4MP.js → upgrade-NEIZ3KVL.js} +4 -4
- package/dist/{urlDownloader-47JMOLNN.js → urlDownloader-ZZFNGZNG.js} +9 -6
- package/dist/{validate-QBJ3SBS4.js → validate-T2SLBOXG.js} +30 -27
- package/dist/{video-3ZAUNAR3.js → video-7OHSBSRT.js} +12 -8
- package/dist/warmCheck.js +47 -44
- package/package.json +1 -1
- package/dist/chunk-BDJIQZN2.js +0 -4830
- package/dist/chunk-DKPNNYBZ.js +0 -44
- package/dist/{destroy-SSPAKADI.js → destroy-CGAZIL2C.js} +4 -4
|
@@ -4,11 +4,22 @@ 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
|
+
removeTreeBestEffort
|
|
9
|
+
} from "./chunk-Z5J67X44.js";
|
|
7
10
|
import {
|
|
8
11
|
alphaDecoderFor,
|
|
9
12
|
pixelFormatHasAlpha,
|
|
10
13
|
videoStreamHasAlpha
|
|
11
14
|
} from "./chunk-5S7W3TUO.js";
|
|
15
|
+
import {
|
|
16
|
+
decodableAudioStream
|
|
17
|
+
} from "./chunk-D3MUHMFG.js";
|
|
18
|
+
import {
|
|
19
|
+
removeScratch,
|
|
20
|
+
renameWithRetry,
|
|
21
|
+
renameWithRetryAsync
|
|
22
|
+
} from "./chunk-XCIHCPJK.js";
|
|
12
23
|
import {
|
|
13
24
|
DISTRIBUTED_FPS,
|
|
14
25
|
MEDIA_VISUAL_STYLE_PROPERTIES,
|
|
@@ -29,7 +40,7 @@ import {
|
|
|
29
40
|
renderFrameIdForRenderId,
|
|
30
41
|
resolveAuthoredTimingWindow,
|
|
31
42
|
toFps
|
|
32
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-MI4V4HPE.js";
|
|
33
44
|
import {
|
|
34
45
|
AUDIO_GROUP_RENDER_ID_ATTR,
|
|
35
46
|
AUTHORED_SOURCE_BEGIN,
|
|
@@ -72,7 +83,7 @@ import {
|
|
|
72
83
|
sourceTimeAt,
|
|
73
84
|
timeAtSourceTime,
|
|
74
85
|
volumeSegmentSampleCount
|
|
75
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-ZXTSUXSL.js";
|
|
76
87
|
import {
|
|
77
88
|
redactTelemetryString,
|
|
78
89
|
redactUrlQueryStrings
|
|
@@ -87,10 +98,10 @@ import {
|
|
|
87
98
|
exceedsChromeCeiling,
|
|
88
99
|
isManagedChromeDir,
|
|
89
100
|
pickSharedShell
|
|
90
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-ERUQ3S6D.js";
|
|
91
102
|
import {
|
|
92
103
|
resolveReferencedStart
|
|
93
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-P327BIJR.js";
|
|
94
105
|
import {
|
|
95
106
|
FFMPEG_PATH_ENV,
|
|
96
107
|
FFPROBE_PATH_ENV,
|
|
@@ -590,6 +601,115 @@ var SDR_RGB_TO_BT709_FILTER = "scale=out_color_matrix=bt709:out_range=tv:flags=n
|
|
|
590
601
|
var SDR_RGB_TO_TAGGED_BT709_FILTER = `${SDR_RGB_TO_BT709_FILTER},setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709:range=tv`;
|
|
591
602
|
var SDR_CAPTURE_TO_BT709_FILTER = `scale=in_color_matrix=bt601:in_range=pc:flags=neighbor+accurate_rnd,format=gbrp,${SDR_RGB_TO_TAGGED_BT709_FILTER}`;
|
|
592
603
|
|
|
604
|
+
// ../engine/src/services/chromeStartup.ts
|
|
605
|
+
import { spawn } from "child_process";
|
|
606
|
+
import { mkdtempSync } from "fs";
|
|
607
|
+
import { tmpdir as tmpdir2 } from "os";
|
|
608
|
+
import { join as join2 } from "path";
|
|
609
|
+
var STDERR_TAIL_LINES = 8;
|
|
610
|
+
var PROBE_TIMEOUT_MS = 8e3;
|
|
611
|
+
var WINDOWS_EXITS = [
|
|
612
|
+
[3221225781, "0xC0000135: a required runtime or DLL is missing (Visual C++ runtime)."],
|
|
613
|
+
[3221225495, "0xC0000017: Windows had no memory to start it (out of memory)."],
|
|
614
|
+
[3221225794, "0xC0000142: a DLL failed to initialise, often security software blocking it."],
|
|
615
|
+
[3221225506, "0xC0000022: access denied, often antivirus or a policy blocking the executable."],
|
|
616
|
+
[3221225595, "0xC000007B: the executable and a DLL do not match (32-bit and 64-bit)."]
|
|
617
|
+
];
|
|
618
|
+
function nameChromeExit(code, platform = process.platform) {
|
|
619
|
+
if (platform !== "win32" || code === null) return void 0;
|
|
620
|
+
const unsigned = code >>> 0;
|
|
621
|
+
return WINDOWS_EXITS.find(([known]) => known === unsigned)?.[1];
|
|
622
|
+
}
|
|
623
|
+
function startupArgs(args, profile) {
|
|
624
|
+
const kept = args.filter(
|
|
625
|
+
(arg) => arg.startsWith("--") && !arg.startsWith("--remote-debugging") && !arg.startsWith("--user-data-dir")
|
|
626
|
+
);
|
|
627
|
+
return [...kept, `--user-data-dir=${profile}`, "--remote-debugging-port=0", "about:blank"];
|
|
628
|
+
}
|
|
629
|
+
function tail(stderr) {
|
|
630
|
+
return stderr.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).slice(-STDERR_TAIL_LINES).join("\n");
|
|
631
|
+
}
|
|
632
|
+
async function diagnoseChromeStartup(executablePath, args, options = {}) {
|
|
633
|
+
const profile = mkdtempSync(join2(tmpdir2(), "hf-chrome-probe-"));
|
|
634
|
+
const timeoutMs = options.timeoutMs ?? PROBE_TIMEOUT_MS;
|
|
635
|
+
try {
|
|
636
|
+
return await new Promise((resolve2) => {
|
|
637
|
+
let stderr = "";
|
|
638
|
+
const child = spawn(executablePath, startupArgs(args, profile), {
|
|
639
|
+
stdio: ["ignore", "ignore", "pipe"],
|
|
640
|
+
windowsHide: true
|
|
641
|
+
});
|
|
642
|
+
const timer = setTimeout(() => {
|
|
643
|
+
child.kill();
|
|
644
|
+
resolve2(`Chrome started and kept running for ${timeoutMs} ms when launched on its own.`);
|
|
645
|
+
}, timeoutMs);
|
|
646
|
+
options.signal?.addEventListener(
|
|
647
|
+
"abort",
|
|
648
|
+
() => {
|
|
649
|
+
clearTimeout(timer);
|
|
650
|
+
child.kill();
|
|
651
|
+
resolve2("The startup check was cancelled.");
|
|
652
|
+
},
|
|
653
|
+
{ once: true }
|
|
654
|
+
);
|
|
655
|
+
child.stderr.on("data", (chunk) => {
|
|
656
|
+
stderr = (stderr + chunk.toString()).slice(-4e3);
|
|
657
|
+
});
|
|
658
|
+
child.once("error", (error) => {
|
|
659
|
+
clearTimeout(timer);
|
|
660
|
+
resolve2(`Chrome could not be started: ${error.message}`);
|
|
661
|
+
});
|
|
662
|
+
child.once("exit", (code, signal) => {
|
|
663
|
+
clearTimeout(timer);
|
|
664
|
+
const how = signal ? `was stopped by ${signal}` : `exited with code ${code}`;
|
|
665
|
+
const named = nameChromeExit(code, options.platform);
|
|
666
|
+
const lines = tail(stderr);
|
|
667
|
+
resolve2(
|
|
668
|
+
[`Chrome ${how} when launched on its own.`, named, lines && `stderr:
|
|
669
|
+
${lines}`].filter(Boolean).join("\n")
|
|
670
|
+
);
|
|
671
|
+
});
|
|
672
|
+
});
|
|
673
|
+
} finally {
|
|
674
|
+
removeTreeBestEffort(profile);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
async function explainChromeLaunchFailure(error, executablePath, args, signal) {
|
|
678
|
+
if (!executablePath || !(error instanceof Error)) return error;
|
|
679
|
+
const diagnosis = await diagnoseChromeStartup(executablePath, args ?? [], { signal });
|
|
680
|
+
return new Error(`${error.message}
|
|
681
|
+
${diagnosis}`, { cause: error });
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// ../engine/src/services/sandboxLaunch.ts
|
|
685
|
+
var MACH_SERVICE_DENIED = /bootstrap_check_in\b[^\n]*Permission denied/;
|
|
686
|
+
var SINGLE_PROCESS = "--single-process";
|
|
687
|
+
var CPU_COMPOSITING = "--disable-gpu-compositing";
|
|
688
|
+
function machServiceDenied(errorMessage) {
|
|
689
|
+
return MACH_SERVICE_DENIED.test(errorMessage);
|
|
690
|
+
}
|
|
691
|
+
function pipeLaunchClosedOnMac(error, platform = process.platform) {
|
|
692
|
+
return platform === "darwin" && error instanceof Error && error.name === "TargetCloseError";
|
|
693
|
+
}
|
|
694
|
+
function inAgentSandbox(env = process.env, platform = process.platform) {
|
|
695
|
+
return platform === "darwin" && env.CODEX_SANDBOX === "seatbelt";
|
|
696
|
+
}
|
|
697
|
+
function oneProcessOverPipe(options) {
|
|
698
|
+
const args = options.args ?? [];
|
|
699
|
+
const missing = [SINGLE_PROCESS, CPU_COMPOSITING].filter((flag) => !args.includes(flag));
|
|
700
|
+
return { ...options, pipe: true, args: [...args, ...missing] };
|
|
701
|
+
}
|
|
702
|
+
function isOneProcessOverPipe(options) {
|
|
703
|
+
return options.pipe === true && (options.args ?? []).includes(SINGLE_PROCESS);
|
|
704
|
+
}
|
|
705
|
+
function sandboxDeniedRemediation(errorMessage) {
|
|
706
|
+
if (!machServiceDenied(errorMessage)) return void 0;
|
|
707
|
+
return [
|
|
708
|
+
"The browser can't start inside this sandbox: macOS refused Chrome's mach service (bootstrap_check_in: Permission denied).",
|
|
709
|
+
"Rerun this command with escalation, outside the sandbox."
|
|
710
|
+
].join("\n");
|
|
711
|
+
}
|
|
712
|
+
|
|
593
713
|
// ../parsers/dist/htmlAttributeSpans.js
|
|
594
714
|
function readAttributeValue(html, at) {
|
|
595
715
|
while (/[\t\n\f\r ]/.test(html.charAt(at))) at++;
|
|
@@ -677,7 +797,7 @@ function scanHtmlOpeningTags(html) {
|
|
|
677
797
|
// ../engine/src/services/browserManager.ts
|
|
678
798
|
import { execSync } from "child_process";
|
|
679
799
|
import { existsSync, readdirSync, statSync } from "fs";
|
|
680
|
-
import { join as
|
|
800
|
+
import { join as join3 } from "path";
|
|
681
801
|
import { homedir } from "os";
|
|
682
802
|
|
|
683
803
|
// ../engine/src/services/browserLeasePool.ts
|
|
@@ -999,7 +1119,7 @@ function findCachedHeadlessShell(baseDir) {
|
|
|
999
1119
|
const versions = readdirSync(baseDir).sort(compareBrowserVersionsDescending);
|
|
1000
1120
|
for (const version of versions) {
|
|
1001
1121
|
if (exceedsChromeCeiling(version, ceiling)) continue;
|
|
1002
|
-
const binary =
|
|
1122
|
+
const binary = join3(baseDir, version, ...executable);
|
|
1003
1123
|
if (isNonEmptyFile(binary)) return binary;
|
|
1004
1124
|
}
|
|
1005
1125
|
} catch {
|
|
@@ -1011,7 +1131,7 @@ function findSharedHeadlessShell(baseDir) {
|
|
|
1011
1131
|
if (!executable || !existsSync(baseDir)) return void 0;
|
|
1012
1132
|
try {
|
|
1013
1133
|
return pickSharedShell(readdirSync(baseDir), (version) => {
|
|
1014
|
-
const binary =
|
|
1134
|
+
const binary = join3(baseDir, version, ...executable);
|
|
1015
1135
|
return isNonEmptyFile(binary) ? binary : void 0;
|
|
1016
1136
|
});
|
|
1017
1137
|
} catch {
|
|
@@ -1023,7 +1143,7 @@ function findManagedHeadlessShell(baseDir) {
|
|
|
1023
1143
|
if (!executable || !existsSync(baseDir)) return void 0;
|
|
1024
1144
|
try {
|
|
1025
1145
|
const version = readdirSync(baseDir).find(isManagedChromeDir);
|
|
1026
|
-
const binary = version &&
|
|
1146
|
+
const binary = version && join3(baseDir, version, ...executable);
|
|
1027
1147
|
return binary && isNonEmptyFile(binary) ? binary : void 0;
|
|
1028
1148
|
} catch {
|
|
1029
1149
|
return void 0;
|
|
@@ -1042,12 +1162,12 @@ function resolveHeadlessShellPath(config) {
|
|
|
1042
1162
|
}
|
|
1043
1163
|
return fromEnv.path;
|
|
1044
1164
|
}
|
|
1045
|
-
const ours =
|
|
1046
|
-
const shared =
|
|
1165
|
+
const ours = join3(homedir(), ".cache", "hyperframes", "chrome", "chrome-headless-shell");
|
|
1166
|
+
const shared = join3(homedir(), ".cache", "puppeteer", "chrome-headless-shell");
|
|
1047
1167
|
return findManagedHeadlessShell(ours) ?? findSharedHeadlessShell(shared) ?? findCachedHeadlessShell(ours);
|
|
1048
1168
|
}
|
|
1049
1169
|
function resolveFullChromePath() {
|
|
1050
|
-
const baseDir =
|
|
1170
|
+
const baseDir = join3(homedir(), ".cache", "puppeteer", "chrome");
|
|
1051
1171
|
let versions;
|
|
1052
1172
|
try {
|
|
1053
1173
|
versions = readdirSync(baseDir).sort(compareBrowserVersionsDescending);
|
|
@@ -1056,7 +1176,7 @@ function resolveFullChromePath() {
|
|
|
1056
1176
|
}
|
|
1057
1177
|
for (const version of versions) {
|
|
1058
1178
|
const candidates = [
|
|
1059
|
-
|
|
1179
|
+
join3(
|
|
1060
1180
|
baseDir,
|
|
1061
1181
|
version,
|
|
1062
1182
|
"chrome-mac-arm64",
|
|
@@ -1065,7 +1185,7 @@ function resolveFullChromePath() {
|
|
|
1065
1185
|
"MacOS",
|
|
1066
1186
|
"Google Chrome for Testing"
|
|
1067
1187
|
),
|
|
1068
|
-
|
|
1188
|
+
join3(
|
|
1069
1189
|
baseDir,
|
|
1070
1190
|
version,
|
|
1071
1191
|
"chrome-mac-x64",
|
|
@@ -1074,8 +1194,8 @@ function resolveFullChromePath() {
|
|
|
1074
1194
|
"MacOS",
|
|
1075
1195
|
"Google Chrome for Testing"
|
|
1076
1196
|
),
|
|
1077
|
-
|
|
1078
|
-
|
|
1197
|
+
join3(baseDir, version, "chrome-linux64", "chrome"),
|
|
1198
|
+
join3(baseDir, version, "chrome-win64", "chrome.exe")
|
|
1079
1199
|
];
|
|
1080
1200
|
for (const binary of candidates) {
|
|
1081
1201
|
if (existsSync(binary)) return binary;
|
|
@@ -1297,7 +1417,8 @@ async function probeWebGlMode(ppt, options, env, label = "") {
|
|
|
1297
1417
|
return resolved === "hardware" ? { mode: "hardware" } : { mode: "software", cause: "no-gpu" };
|
|
1298
1418
|
} catch (err) {
|
|
1299
1419
|
logResolvedBrowserGpuMode("software", label + formatProbeFailure(err));
|
|
1300
|
-
|
|
1420
|
+
const aborted = err instanceof Error && err.name === "AbortError";
|
|
1421
|
+
return { mode: "software", cause: "probe-error", ...aborted && { aborted } };
|
|
1301
1422
|
}
|
|
1302
1423
|
}
|
|
1303
1424
|
function envWithoutWaylandDisplay() {
|
|
@@ -1328,11 +1449,20 @@ function wslAccess(options) {
|
|
|
1328
1449
|
const lines = describeWslGpuAccess(options.wslHost);
|
|
1329
1450
|
return lines ? { wslAccess: lines } : {};
|
|
1330
1451
|
}
|
|
1452
|
+
async function sharedGpuProbe(options) {
|
|
1453
|
+
const shared = _autoBrowserGpuModeCache ??= probeAutoBrowserGpuMode(options);
|
|
1454
|
+
const outcome = await shared;
|
|
1455
|
+
if (!outcome.aborted) return outcome;
|
|
1456
|
+
if (_autoBrowserGpuModeCache === shared) _autoBrowserGpuModeCache = void 0;
|
|
1457
|
+
const own = await probeAutoBrowserGpuMode(options);
|
|
1458
|
+
if (!own.aborted) _autoBrowserGpuModeCache ??= Promise.resolve(own);
|
|
1459
|
+
return own;
|
|
1460
|
+
}
|
|
1331
1461
|
function resolveBrowserGpuMode(mode, options = {}) {
|
|
1332
1462
|
if (mode === "software") return Promise.resolve(mode);
|
|
1333
|
-
|
|
1463
|
+
const probe = sharedGpuProbe(options);
|
|
1334
1464
|
if (mode === "auto") {
|
|
1335
|
-
return
|
|
1465
|
+
return probe.then((probed) => {
|
|
1336
1466
|
if (probed.mode === "software" && probed.wslAccess && !_wslSoftwareNoteLogged) {
|
|
1337
1467
|
_wslSoftwareNoteLogged = true;
|
|
1338
1468
|
console.error(buildWslSoftwareNote(probed));
|
|
@@ -1340,7 +1470,7 @@ function resolveBrowserGpuMode(mode, options = {}) {
|
|
|
1340
1470
|
return probed.mode;
|
|
1341
1471
|
});
|
|
1342
1472
|
}
|
|
1343
|
-
return
|
|
1473
|
+
return probe.then((probed) => {
|
|
1344
1474
|
if (probed.mode === "software" && !_unverifiedHardwareGpuWarned) {
|
|
1345
1475
|
_unverifiedHardwareGpuWarned = true;
|
|
1346
1476
|
console.warn(buildUnverifiedHardwareGpuWarning(options.platform ?? process.platform, probed));
|
|
@@ -1393,12 +1523,23 @@ async function acquireBrowser(chromeArgs, config) {
|
|
|
1393
1523
|
const enablePool = config?.enableBrowserPool ?? DEFAULT_CONFIG.enableBrowserPool;
|
|
1394
1524
|
return browserLeasePool.acquire(createBrowserLaunchFingerprint(chromeArgs, config), enablePool);
|
|
1395
1525
|
}
|
|
1526
|
+
async function launchInsideSandbox(ppt, options) {
|
|
1527
|
+
const sandboxed = inAgentSandbox();
|
|
1528
|
+
try {
|
|
1529
|
+
return await ppt.launch(sandboxed ? oneProcessOverPipe(options) : options);
|
|
1530
|
+
} catch (error) {
|
|
1531
|
+
const message = error instanceof Error ? error.message : "";
|
|
1532
|
+
const refused = machServiceDenied(message) || pipeLaunchClosedOnMac(error);
|
|
1533
|
+
if (process.platform !== "darwin" || sandboxed || !refused) throw error;
|
|
1534
|
+
return ppt.launch(oneProcessOverPipe(options));
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1396
1537
|
async function launchBrowser(fingerprint) {
|
|
1397
1538
|
const ppt = await getPuppeteer();
|
|
1398
1539
|
const env = launchEnv(fingerprint);
|
|
1399
1540
|
let captureMode = fingerprint.requestedCaptureMode;
|
|
1400
1541
|
let browser;
|
|
1401
|
-
const launch = (args) => ppt
|
|
1542
|
+
const launch = (args) => launchInsideSandbox(ppt, {
|
|
1402
1543
|
...ownedLaunchOptions(),
|
|
1403
1544
|
headless: true,
|
|
1404
1545
|
args: withHyperframesBrowserMarker(args),
|
|
@@ -1407,6 +1548,14 @@ async function launchBrowser(fingerprint) {
|
|
|
1407
1548
|
env,
|
|
1408
1549
|
timeout: fingerprint.browserTimeoutMs,
|
|
1409
1550
|
protocolTimeout: fingerprint.protocolTimeoutMs
|
|
1551
|
+
}).catch(async (error) => {
|
|
1552
|
+
const remediation = process.platform === "darwin" && sandboxDeniedRemediation(error instanceof Error ? error.message : "");
|
|
1553
|
+
if (remediation) throw new Error(remediation, { cause: error });
|
|
1554
|
+
const defaults = await ppt.defaultArgs({
|
|
1555
|
+
headless: true,
|
|
1556
|
+
args: withHyperframesBrowserMarker(args)
|
|
1557
|
+
});
|
|
1558
|
+
throw await explainChromeLaunchFailure(error, fingerprint.executablePath, defaults);
|
|
1410
1559
|
});
|
|
1411
1560
|
const probe = (target, timeoutMs) => probeBeginFrameSupport(target, timeoutMs).catch((error) => ({
|
|
1412
1561
|
supported: true,
|
|
@@ -1752,7 +1901,7 @@ identically under Docker. Consider:
|
|
|
1752
1901
|
|
|
1753
1902
|
// ../engine/src/services/frameCapture.ts
|
|
1754
1903
|
import { existsSync as existsSync3, mkdirSync, writeFileSync } from "fs";
|
|
1755
|
-
import { join as
|
|
1904
|
+
import { join as join4 } from "path";
|
|
1756
1905
|
|
|
1757
1906
|
// ../engine/src/services/renderFrameVideoHold.ts
|
|
1758
1907
|
function holdRenderFrameVideos(ids, renderIdAttr) {
|
|
@@ -6816,9 +6965,9 @@ async function initializeSession(session) {
|
|
|
6816
6965
|
}
|
|
6817
6966
|
async function captureFrameErrorDiagnostics(session, frameIndex, time, error) {
|
|
6818
6967
|
try {
|
|
6819
|
-
const diagnosticsDir =
|
|
6968
|
+
const diagnosticsDir = join4(session.outputDir, "diagnostics");
|
|
6820
6969
|
if (!existsSync3(diagnosticsDir)) mkdirSync(diagnosticsDir, { recursive: true });
|
|
6821
|
-
const base =
|
|
6970
|
+
const base = join4(diagnosticsDir, `frame-error-${frameIndex}`);
|
|
6822
6971
|
const pageScreenshotCanResolve = session.launchCaptureMode !== "beginframe";
|
|
6823
6972
|
if (pageScreenshotCanResolve) {
|
|
6824
6973
|
await session.page.screenshot({ path: `${base}.png`, type: "png", fullPage: true });
|
|
@@ -7814,7 +7963,7 @@ function frameFileExtension(format) {
|
|
|
7814
7963
|
}
|
|
7815
7964
|
function writeCapturedFrame(session, fileIndex, buffer) {
|
|
7816
7965
|
const ext = frameFileExtension(session.options.format);
|
|
7817
|
-
const framePath =
|
|
7966
|
+
const framePath = join4(session.outputDir, `frame_${String(fileIndex).padStart(6, "0")}.${ext}`);
|
|
7818
7967
|
writeFileSync(framePath, buffer);
|
|
7819
7968
|
return framePath;
|
|
7820
7969
|
}
|
|
@@ -8209,10 +8358,10 @@ function getCapturePerfSummary(session) {
|
|
|
8209
8358
|
|
|
8210
8359
|
// ../engine/src/services/extractedFrameIndex.ts
|
|
8211
8360
|
import { readdirSync as readdirSync2 } from "fs";
|
|
8212
|
-
import { join as
|
|
8361
|
+
import { join as join5 } from "path";
|
|
8213
8362
|
var FRAME_FILENAME_PREFIX = "frame_";
|
|
8214
8363
|
function frameSequencePath(dir, framePattern) {
|
|
8215
|
-
return
|
|
8364
|
+
return join5(dir.replaceAll("%", "%%"), framePattern);
|
|
8216
8365
|
}
|
|
8217
8366
|
var ExtractedFrameSequenceError = class extends Error {
|
|
8218
8367
|
constructor(message) {
|
|
@@ -8242,7 +8391,7 @@ function framePathsFromDirectory(outputDir, format, allowGaps = false) {
|
|
|
8242
8391
|
`Duplicate extracted frame index ${index}: ${indexed.get(index)} and ${file}`
|
|
8243
8392
|
);
|
|
8244
8393
|
}
|
|
8245
|
-
indexed.set(index,
|
|
8394
|
+
indexed.set(index, join5(outputDir, file));
|
|
8246
8395
|
}
|
|
8247
8396
|
if (allowGaps) return new Map([...indexed].sort(([a], [b]) => a - b));
|
|
8248
8397
|
const ordered = /* @__PURE__ */ new Map();
|
|
@@ -8265,7 +8414,7 @@ import {
|
|
|
8265
8414
|
existsSync as existsSync5,
|
|
8266
8415
|
ftruncateSync,
|
|
8267
8416
|
mkdirSync as mkdirSync2,
|
|
8268
|
-
mkdtempSync as
|
|
8417
|
+
mkdtempSync as mkdtempSync3,
|
|
8269
8418
|
openSync,
|
|
8270
8419
|
readFileSync as readFileSync3,
|
|
8271
8420
|
readdirSync as readdirSync3,
|
|
@@ -8273,10 +8422,10 @@ import {
|
|
|
8273
8422
|
writeFileSync as writeFileSync2,
|
|
8274
8423
|
writeSync
|
|
8275
8424
|
} from "fs";
|
|
8276
|
-
import { join as
|
|
8425
|
+
import { join as join8, dirname as dirname2, extname, resolve } from "path";
|
|
8277
8426
|
|
|
8278
8427
|
// ../engine/src/utils/gpuEncoder.ts
|
|
8279
|
-
import { spawn } from "child_process";
|
|
8428
|
+
import { spawn as spawn2 } from "child_process";
|
|
8280
8429
|
|
|
8281
8430
|
// ../engine/src/utils/managedChildProcess.ts
|
|
8282
8431
|
import { StringDecoder } from "string_decoder";
|
|
@@ -8504,7 +8653,7 @@ async function selectUsableGpuEncoder(candidates, isUsable) {
|
|
|
8504
8653
|
return null;
|
|
8505
8654
|
}
|
|
8506
8655
|
async function detectGpuEncoder() {
|
|
8507
|
-
const ffmpeg =
|
|
8656
|
+
const ffmpeg = spawn2(getFfmpegBinary(), ["-encoders"], {
|
|
8508
8657
|
stdio: ["pipe", "pipe", "pipe"],
|
|
8509
8658
|
// See runFfmpeg.ts: keeps a console window off the user's desktop on Windows.
|
|
8510
8659
|
windowsHide: true
|
|
@@ -8590,7 +8739,7 @@ function getProbeArgs(encoder) {
|
|
|
8590
8739
|
return args;
|
|
8591
8740
|
}
|
|
8592
8741
|
async function canUseGpuEncoder(encoder) {
|
|
8593
|
-
const ffmpeg =
|
|
8742
|
+
const ffmpeg = spawn2(getFfmpegBinary(), getProbeArgs(encoder), {
|
|
8594
8743
|
stdio: ["ignore", "ignore", "pipe"],
|
|
8595
8744
|
windowsHide: true
|
|
8596
8745
|
});
|
|
@@ -8724,7 +8873,7 @@ function withEvenDimensionPad(vfChain, pixelFormat, width, height) {
|
|
|
8724
8873
|
}
|
|
8725
8874
|
|
|
8726
8875
|
// ../engine/src/utils/runFfmpeg.ts
|
|
8727
|
-
import { spawn as
|
|
8876
|
+
import { spawn as spawn3 } from "child_process";
|
|
8728
8877
|
var FFMPEG_SIGTERM_EXIT_LINE = /^Exiting normally, received signal 15\.?\r?$/m;
|
|
8729
8878
|
function isExternalFfmpegInterruption(result) {
|
|
8730
8879
|
if (result.terminationReason !== "exit" || result.exitCode === 0) return false;
|
|
@@ -8764,19 +8913,19 @@ function formatWindowsFfmpegExit(exitCode) {
|
|
|
8764
8913
|
return void 0;
|
|
8765
8914
|
}
|
|
8766
8915
|
function formatFfmpegError(exitCode, stderr, tailLines = DEFAULT_STDERR_TAIL_LINES) {
|
|
8767
|
-
const
|
|
8916
|
+
const tail2 = (stderr ?? "").split(/\r?\n/).filter((line) => line.length > 0).slice(-tailLines).join("\n");
|
|
8768
8917
|
if (exitCode === null) {
|
|
8769
|
-
return
|
|
8918
|
+
return tail2 ? `[FFmpeg] ${tail2}` : "[FFmpeg] process error";
|
|
8770
8919
|
}
|
|
8771
8920
|
const windowsMessage = formatWindowsFfmpegExit(exitCode);
|
|
8772
8921
|
if (windowsMessage) {
|
|
8773
|
-
return
|
|
8922
|
+
return tail2 ? `${windowsMessage}
|
|
8774
8923
|
ffmpeg stderr (tail):
|
|
8775
|
-
${
|
|
8924
|
+
${tail2}` : windowsMessage;
|
|
8776
8925
|
}
|
|
8777
|
-
return
|
|
8926
|
+
return tail2 ? `FFmpeg exited with code ${exitCode}
|
|
8778
8927
|
ffmpeg stderr (tail):
|
|
8779
|
-
${
|
|
8928
|
+
${tail2}` : `FFmpeg exited with code ${exitCode}`;
|
|
8780
8929
|
}
|
|
8781
8930
|
function describeFfmpegFailure(result, timeoutMs) {
|
|
8782
8931
|
const error = formatFfmpegError(result.exitCode, result.stderr);
|
|
@@ -8788,7 +8937,7 @@ function describeFfmpegFailure(result, timeoutMs) {
|
|
|
8788
8937
|
return signalOrRequestedStop ? `FFmpeg ended without an exit code (${signalOrRequestedStop}). ${error}` : error;
|
|
8789
8938
|
}
|
|
8790
8939
|
function spawnFfmpeg(args) {
|
|
8791
|
-
const ffmpeg =
|
|
8940
|
+
const ffmpeg = spawn3(getFfmpegBinary(), args, { windowsHide: true });
|
|
8792
8941
|
trackChildProcess(ffmpeg);
|
|
8793
8942
|
return ffmpeg;
|
|
8794
8943
|
}
|
|
@@ -8840,11 +8989,11 @@ async function runFfmpeg(args, opts) {
|
|
|
8840
8989
|
}
|
|
8841
8990
|
|
|
8842
8991
|
// ../engine/src/utils/ffprobe.ts
|
|
8843
|
-
import { spawn as
|
|
8844
|
-
import { createReadStream, mkdtempSync, readFileSync, rmSync, statSync as statSync2 } from "fs";
|
|
8992
|
+
import { spawn as spawn4 } from "child_process";
|
|
8993
|
+
import { createReadStream, mkdtempSync as mkdtempSync2, readFileSync, rmSync, statSync as statSync2 } from "fs";
|
|
8845
8994
|
import { StringDecoder as StringDecoder2 } from "string_decoder";
|
|
8846
|
-
import { tmpdir as
|
|
8847
|
-
import { basename, join as
|
|
8995
|
+
import { tmpdir as tmpdir3 } from "os";
|
|
8996
|
+
import { basename, join as join6 } from "path";
|
|
8848
8997
|
|
|
8849
8998
|
// ../engine/src/utils/urlInput.ts
|
|
8850
8999
|
import { existsSync as existsSync4 } from "fs";
|
|
@@ -8918,7 +9067,7 @@ async function runFfprobe(filePath, argsWithoutInput, signal, stdoutOptions) {
|
|
|
8918
9067
|
"--",
|
|
8919
9068
|
filePath
|
|
8920
9069
|
];
|
|
8921
|
-
const proc =
|
|
9070
|
+
const proc = spawn4(command, args, {
|
|
8922
9071
|
// Nothing is ever written to the child's stdin; leaving it as a pipe is
|
|
8923
9072
|
// what lets a stdin-reading invocation block indefinitely.
|
|
8924
9073
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -9112,7 +9261,7 @@ function ffprobeMajor() {
|
|
|
9112
9261
|
runtimeFfprobeMajor ??= new Promise((resolve2) => {
|
|
9113
9262
|
let out = "";
|
|
9114
9263
|
const binary = getFfprobeBinary();
|
|
9115
|
-
const proc =
|
|
9264
|
+
const proc = spawn4(binary, ["-version"], { stdio: ["ignore", "pipe", "ignore"] });
|
|
9116
9265
|
proc.stdout.on("data", (chunk) => out += String(chunk));
|
|
9117
9266
|
proc.on("error", () => resolve2(void 0));
|
|
9118
9267
|
proc.on("close", () => resolve2(Number(/version n?(\d+)/.exec(out)?.[1]) || void 0));
|
|
@@ -9237,7 +9386,7 @@ async function probeMediaProfile(filePath, options) {
|
|
|
9237
9386
|
}
|
|
9238
9387
|
return {
|
|
9239
9388
|
hasVideoStream: videoStreams.length > 0,
|
|
9240
|
-
hasAudioStream: output.streams
|
|
9389
|
+
hasAudioStream: decodableAudioStream(output.streams) !== null,
|
|
9241
9390
|
visualKind: isStillImage ? "still" : hasMovingVideoStream ? "moving" : "none"
|
|
9242
9391
|
};
|
|
9243
9392
|
} catch (error) {
|
|
@@ -9323,8 +9472,8 @@ function parseFrameRate(frameRateStr) {
|
|
|
9323
9472
|
async function probeDecodedAlphaPlane(filePath, decoder) {
|
|
9324
9473
|
let probeDir;
|
|
9325
9474
|
try {
|
|
9326
|
-
probeDir =
|
|
9327
|
-
const framePath =
|
|
9475
|
+
probeDir = mkdtempSync2(join6(tmpdir3(), "hf-decoded-alpha-"));
|
|
9476
|
+
const framePath = join6(probeDir, "frame.nut");
|
|
9328
9477
|
const decoded = await runFfmpeg(
|
|
9329
9478
|
[
|
|
9330
9479
|
"-v",
|
|
@@ -9443,7 +9592,7 @@ async function extractMediaMetadata(filePath) {
|
|
|
9443
9592
|
height: videoStream.height || stillImage()?.height || 0,
|
|
9444
9593
|
fps,
|
|
9445
9594
|
videoCodec: videoStream.codec_name || "unknown",
|
|
9446
|
-
hasAudio: output?.streams
|
|
9595
|
+
hasAudio: decodableAudioStream(output?.streams ?? []) !== null,
|
|
9447
9596
|
isVFR,
|
|
9448
9597
|
hasAlpha,
|
|
9449
9598
|
...alphaPlaneDecoded === void 0 ? {} : { alphaPlaneDecoded },
|
|
@@ -9571,8 +9720,10 @@ async function extractAudioMetadata(filePath, options) {
|
|
|
9571
9720
|
}
|
|
9572
9721
|
async function probeAudioMetadata(filePath, signal) {
|
|
9573
9722
|
const output = await probeMediaOutput(filePath, signal);
|
|
9574
|
-
const
|
|
9575
|
-
|
|
9723
|
+
const audioStreams = output.streams.filter((s) => s.codec_type === "audio");
|
|
9724
|
+
const audioStreamIndex = decodableAudioStream(output.streams);
|
|
9725
|
+
const audioStream = audioStreamIndex === null ? void 0 : audioStreams[audioStreamIndex];
|
|
9726
|
+
if (audioStreamIndex === null || !audioStream) throw new Error("[FFmpeg] No audio stream found");
|
|
9576
9727
|
let durationSeconds = output.format.duration ? parseFloat(output.format.duration) : 0;
|
|
9577
9728
|
const streamDuration = audioStream.duration ? parseFloat(audioStream.duration) : void 0;
|
|
9578
9729
|
const sampleRate = audioStream.sample_rate ? parseInt(audioStream.sample_rate) : 44100;
|
|
@@ -9580,6 +9731,7 @@ async function probeAudioMetadata(filePath, signal) {
|
|
|
9580
9731
|
if (sampleRate > 0) {
|
|
9581
9732
|
const decoded = await probeDecodedAudioDuration(
|
|
9582
9733
|
filePath,
|
|
9734
|
+
audioStreamIndex,
|
|
9583
9735
|
sampleRate,
|
|
9584
9736
|
audioStartSeconds(audioStream, output.format),
|
|
9585
9737
|
durationSeconds,
|
|
@@ -9598,7 +9750,8 @@ async function probeAudioMetadata(filePath, signal) {
|
|
|
9598
9750
|
bitrate: output.format.bit_rate ? parseInt(output.format.bit_rate) : void 0,
|
|
9599
9751
|
latestStreamLeadSeconds: latestStreamLeadSeconds(output),
|
|
9600
9752
|
audioStreamLeadSeconds: streamLeadSeconds(output, audioStream),
|
|
9601
|
-
audioStreamCount:
|
|
9753
|
+
audioStreamCount: audioStreams.length,
|
|
9754
|
+
audioStream: audioStreamIndex
|
|
9602
9755
|
};
|
|
9603
9756
|
}
|
|
9604
9757
|
function audioVideoStreamStarts(output) {
|
|
@@ -9626,11 +9779,11 @@ function reconcileAudioDuration(containerSeconds, decodedSeconds, format) {
|
|
|
9626
9779
|
if (trustShorter && difference < -AUDIO_DURATION_PROBE_MARGIN_SECONDS) return decodedSeconds;
|
|
9627
9780
|
return containerSeconds;
|
|
9628
9781
|
}
|
|
9629
|
-
async function probeDecodedAudioDuration(filePath, sampleRate, startSeconds, containerDurationSeconds, signal) {
|
|
9782
|
+
async function probeDecodedAudioDuration(filePath, audioStream, sampleRate, startSeconds, containerDurationSeconds, signal) {
|
|
9630
9783
|
const probe = async (readInterval) => {
|
|
9631
9784
|
const args = [
|
|
9632
9785
|
"-select_streams",
|
|
9633
|
-
|
|
9786
|
+
`a:${audioStream}`,
|
|
9634
9787
|
"-show_entries",
|
|
9635
9788
|
"frame=best_effort_timestamp_time,nb_samples",
|
|
9636
9789
|
"-of",
|
|
@@ -9744,7 +9897,7 @@ function appendSoftwareEncoderThreadsArg(args, encoder, parallelism = availableP
|
|
|
9744
9897
|
|
|
9745
9898
|
// ../engine/src/utils/renderProvenance.ts
|
|
9746
9899
|
import { readFileSync as readFileSync2 } from "fs";
|
|
9747
|
-
import { dirname, join as
|
|
9900
|
+
import { dirname, join as join7 } from "path";
|
|
9748
9901
|
import { fileURLToPath } from "url";
|
|
9749
9902
|
var PROVENANCE_RENDERER_TAG = "hyperframes_renderer";
|
|
9750
9903
|
var PROVENANCE_VERSION_TAG = "hyperframes_version";
|
|
@@ -9755,7 +9908,7 @@ var MAX_WALK_DEPTH = 12;
|
|
|
9755
9908
|
function resolveOwnVersionFrom(startDir) {
|
|
9756
9909
|
let dir = startDir;
|
|
9757
9910
|
for (let depth = 0; depth < MAX_WALK_DEPTH; depth++) {
|
|
9758
|
-
const candidate =
|
|
9911
|
+
const candidate = join7(dir, "package.json");
|
|
9759
9912
|
let pkg;
|
|
9760
9913
|
try {
|
|
9761
9914
|
pkg = JSON.parse(readFileSync2(candidate, "utf8"));
|
|
@@ -10190,7 +10343,7 @@ function buildConcatArgs(concatListPath, outputPath) {
|
|
|
10190
10343
|
var concatListSeq = 0;
|
|
10191
10344
|
function writeConcatList(dir, inputPaths) {
|
|
10192
10345
|
concatListSeq += 1;
|
|
10193
|
-
const listPath =
|
|
10346
|
+
const listPath = join8(dir, `concat-list-${process.pid}-${concatListSeq}.txt`);
|
|
10194
10347
|
const body = inputPaths.map((p) => `file '${resolve(p).replace(/'/g, "'\\''")}'`).join("\n");
|
|
10195
10348
|
writeFileSync2(listPath, body, "utf-8");
|
|
10196
10349
|
return listPath;
|
|
@@ -10234,7 +10387,7 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
|
|
|
10234
10387
|
const chunkSize = Math.max(30, Math.floor(chunkSizeFrames));
|
|
10235
10388
|
const chunkCount = Math.ceil(files.length / chunkSize);
|
|
10236
10389
|
mkdirSync2(dirname2(outputPath), { recursive: true });
|
|
10237
|
-
const chunkDir =
|
|
10390
|
+
const chunkDir = mkdtempSync3(join8(dirname2(outputPath), "chunk-encode-"));
|
|
10238
10391
|
const chunkPaths = [];
|
|
10239
10392
|
for (let i = 0; i < chunkCount; i++) {
|
|
10240
10393
|
if (signal?.aborted) {
|
|
@@ -10250,7 +10403,7 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
|
|
|
10250
10403
|
const startNumber = i * chunkSize;
|
|
10251
10404
|
const framesInChunk = Math.min(chunkSize, files.length - startNumber);
|
|
10252
10405
|
const ext = outputPath.endsWith(".webm") ? ".webm" : outputPath.endsWith(".mov") ? ".mov" : ".mp4";
|
|
10253
|
-
const chunkPath =
|
|
10406
|
+
const chunkPath = join8(chunkDir, `chunk_${String(i).padStart(4, "0")}${ext}`);
|
|
10254
10407
|
const inputPath = frameSequencePath(framesDir, framePattern);
|
|
10255
10408
|
const inputArgs = [
|
|
10256
10409
|
"-framerate",
|
|
@@ -10420,14 +10573,14 @@ async function packageHls(videoPath, audioPath, outputDir, options) {
|
|
|
10420
10573
|
"-master_pl_name",
|
|
10421
10574
|
HLS_MASTER_PLAYLIST,
|
|
10422
10575
|
"-hls_segment_filename",
|
|
10423
|
-
|
|
10576
|
+
join8(outputDir, "%v_%05d.ts"),
|
|
10424
10577
|
// Without these the mpegts muxer starts the stream at PTS 1.4 s.
|
|
10425
10578
|
"-muxdelay",
|
|
10426
10579
|
"0",
|
|
10427
10580
|
"-muxpreload",
|
|
10428
10581
|
"0"
|
|
10429
10582
|
);
|
|
10430
|
-
args.push("-y",
|
|
10583
|
+
args.push("-y", join8(outputDir, "%v.m3u8"));
|
|
10431
10584
|
const processTimeout = options.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
|
|
10432
10585
|
const result = await runFfmpeg(args, { signal, timeout: processTimeout });
|
|
10433
10586
|
if (signal?.aborted) {
|
|
@@ -10439,7 +10592,7 @@ async function packageHls(videoPath, audioPath, outputDir, options) {
|
|
|
10439
10592
|
};
|
|
10440
10593
|
}
|
|
10441
10594
|
if (result.success && hasAudio) {
|
|
10442
|
-
const masterPath =
|
|
10595
|
+
const masterPath = join8(outputDir, HLS_MASTER_PLAYLIST);
|
|
10443
10596
|
let master;
|
|
10444
10597
|
try {
|
|
10445
10598
|
master = openSync(masterPath, "r+", 384);
|
|
@@ -10544,7 +10697,7 @@ function quantizationTableError(buffer, start, end) {
|
|
|
10544
10697
|
}
|
|
10545
10698
|
|
|
10546
10699
|
// ../engine/src/services/streamingEncoder.ts
|
|
10547
|
-
import { spawn as
|
|
10700
|
+
import { spawn as spawn5 } from "child_process";
|
|
10548
10701
|
import { once } from "events";
|
|
10549
10702
|
import { existsSync as existsSync6, mkdirSync as mkdirSync3, statSync as statSync4 } from "fs";
|
|
10550
10703
|
import { dirname as dirname3 } from "path";
|
|
@@ -10791,7 +10944,7 @@ async function spawnStreamingEncoder(outputPath, options, signal, config) {
|
|
|
10791
10944
|
gpuEncoder = await getCachedGpuEncoder();
|
|
10792
10945
|
}
|
|
10793
10946
|
const args = buildStreamingArgs(options, outputPath, gpuEncoder);
|
|
10794
|
-
const ffmpeg =
|
|
10947
|
+
const ffmpeg = spawn5(getFfmpegBinary(), args, {
|
|
10795
10948
|
stdio: ["pipe", "pipe", "pipe"],
|
|
10796
10949
|
// See runFfmpeg.ts: keeps a console window off the user's desktop on Windows.
|
|
10797
10950
|
windowsHide: true
|
|
@@ -11017,8 +11170,8 @@ function isMemberGroupHidden(groupsById, el) {
|
|
|
11017
11170
|
}
|
|
11018
11171
|
|
|
11019
11172
|
// ../engine/src/services/videoFrameExtractor.ts
|
|
11020
|
-
import { copyFileSync as
|
|
11021
|
-
import { join as
|
|
11173
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync9, linkSync as linkSync2, mkdirSync as mkdirSync6, rmSync as rmSync5 } from "fs";
|
|
11174
|
+
import { basename as basename2, join as join12 } from "path";
|
|
11022
11175
|
import { cpus } from "os";
|
|
11023
11176
|
|
|
11024
11177
|
// ../engine/src/utils/concurrencyLimit.ts
|
|
@@ -11060,9 +11213,9 @@ function isKnownInactiveTimelineWindow(element, resolvedStart) {
|
|
|
11060
11213
|
}
|
|
11061
11214
|
|
|
11062
11215
|
// ../engine/src/utils/alphaPlaneProbe.ts
|
|
11063
|
-
import { mkdtempSync as
|
|
11064
|
-
import { tmpdir as
|
|
11065
|
-
import { join as
|
|
11216
|
+
import { mkdtempSync as mkdtempSync4, readFileSync as readFileSync4, rmSync as rmSync2 } from "fs";
|
|
11217
|
+
import { tmpdir as tmpdir4 } from "os";
|
|
11218
|
+
import { join as join9 } from "path";
|
|
11066
11219
|
var BYTES_PER_SAMPLE_FRAME = 8 * 8 * 4;
|
|
11067
11220
|
var MAX_SAMPLE_BYTES = BYTES_PER_SAMPLE_FRAME * 3;
|
|
11068
11221
|
function sampledRgbaAlphaIsFullyOpaque(buf) {
|
|
@@ -11077,8 +11230,8 @@ function sampledRgbaAlphaIsFullyOpaque(buf) {
|
|
|
11077
11230
|
async function probeInputAlphaPlane(videoPath, decoder, signal) {
|
|
11078
11231
|
let probeDir;
|
|
11079
11232
|
try {
|
|
11080
|
-
probeDir =
|
|
11081
|
-
const samplePath =
|
|
11233
|
+
probeDir = mkdtempSync4(join9(tmpdir4(), "hf-alpha-probe-"));
|
|
11234
|
+
const samplePath = join9(probeDir, "alpha.raw");
|
|
11082
11235
|
const result = await runFfmpeg(
|
|
11083
11236
|
[
|
|
11084
11237
|
"-v",
|
|
@@ -11120,7 +11273,7 @@ import {
|
|
|
11120
11273
|
existsSync as existsSync7,
|
|
11121
11274
|
fsyncSync,
|
|
11122
11275
|
linkSync,
|
|
11123
|
-
mkdtempSync as
|
|
11276
|
+
mkdtempSync as mkdtempSync5,
|
|
11124
11277
|
mkdirSync as mkdirSync4,
|
|
11125
11278
|
lstatSync,
|
|
11126
11279
|
openSync as openSync2,
|
|
@@ -11132,7 +11285,7 @@ import {
|
|
|
11132
11285
|
} from "fs";
|
|
11133
11286
|
import { createHash, randomUUID as randomUUID2 } from "crypto";
|
|
11134
11287
|
import { BlockList, isIP } from "net";
|
|
11135
|
-
import { dirname as dirname4, extname as extname2, join as
|
|
11288
|
+
import { dirname as dirname4, extname as extname2, join as join10 } from "path";
|
|
11136
11289
|
import { Readable, Transform } from "stream";
|
|
11137
11290
|
import { pipeline } from "stream/promises";
|
|
11138
11291
|
var inFlightDownloads = /* @__PURE__ */ new Map();
|
|
@@ -11324,7 +11477,7 @@ function removeCacheLockDirectoryIfEmpty(lockPath) {
|
|
|
11324
11477
|
}
|
|
11325
11478
|
function releaseOwnedCachePathLock(lockPath, owner) {
|
|
11326
11479
|
try {
|
|
11327
|
-
rmdirSync(
|
|
11480
|
+
rmdirSync(join10(lockPath, owner));
|
|
11328
11481
|
} catch (error) {
|
|
11329
11482
|
if (error.code === "ENOENT") return;
|
|
11330
11483
|
throw error;
|
|
@@ -11365,12 +11518,12 @@ async function acquireCachePathLock(localPath, timeoutMs, signal) {
|
|
|
11365
11518
|
if (createdLock) {
|
|
11366
11519
|
const owner = `${CACHE_LOCK_OWNER_PREFIX}${randomUUID2()}`;
|
|
11367
11520
|
try {
|
|
11368
|
-
mkdirSync4(
|
|
11521
|
+
mkdirSync4(join10(lockPath, owner));
|
|
11369
11522
|
const entries = readdirSync4(lockPath);
|
|
11370
11523
|
if (entries.length === 1 && entries[0] === owner) {
|
|
11371
11524
|
return () => releaseOwnedCachePathLock(lockPath, owner);
|
|
11372
11525
|
}
|
|
11373
|
-
rmdirSync(
|
|
11526
|
+
rmdirSync(join10(lockPath, owner));
|
|
11374
11527
|
removeCacheLockDirectoryIfEmpty(lockPath);
|
|
11375
11528
|
continue;
|
|
11376
11529
|
} catch (error) {
|
|
@@ -11388,7 +11541,7 @@ async function acquireCachePathLock(localPath, timeoutMs, signal) {
|
|
|
11388
11541
|
if (Date.now() - observedLock.stats.mtimeMs > CACHE_LOCK_STALE_MS) {
|
|
11389
11542
|
if (observedLock.owner) {
|
|
11390
11543
|
try {
|
|
11391
|
-
rmdirSync(
|
|
11544
|
+
rmdirSync(join10(lockPath, observedLock.owner));
|
|
11392
11545
|
} catch (error) {
|
|
11393
11546
|
if (error.code === "ENOENT") continue;
|
|
11394
11547
|
throw error;
|
|
@@ -11396,7 +11549,7 @@ async function acquireCachePathLock(localPath, timeoutMs, signal) {
|
|
|
11396
11549
|
removeCacheLockDirectoryIfEmpty(lockPath);
|
|
11397
11550
|
continue;
|
|
11398
11551
|
}
|
|
11399
|
-
const reclaimPath =
|
|
11552
|
+
const reclaimPath = join10(lockPath, CACHE_LOCK_RECLAIM_NAME);
|
|
11400
11553
|
try {
|
|
11401
11554
|
mkdirSync4(reclaimPath);
|
|
11402
11555
|
} catch (error) {
|
|
@@ -11837,8 +11990,8 @@ function emitDownloadTelemetry(options, event) {
|
|
|
11837
11990
|
}
|
|
11838
11991
|
}
|
|
11839
11992
|
async function runDownloadAttempt(url, localPath, timeoutMs, attempt, options, signal) {
|
|
11840
|
-
const attemptDir =
|
|
11841
|
-
const partialPath =
|
|
11993
|
+
const attemptDir = mkdtempSync5(join10(dirname4(localPath), ".hf-download-"));
|
|
11994
|
+
const partialPath = join10(attemptDir, "payload");
|
|
11842
11995
|
const controller = new AbortController();
|
|
11843
11996
|
let timedOut = false;
|
|
11844
11997
|
let callerAborted = signal?.aborted ?? false;
|
|
@@ -12084,7 +12237,7 @@ async function downloadToTemp(url, destDir, timeoutMs = 3e5, signal, onTransient
|
|
|
12084
12237
|
mkdirSync4(destDir, { recursive: true });
|
|
12085
12238
|
}
|
|
12086
12239
|
const filename = getFilenameFromUrl(url, validationScope);
|
|
12087
|
-
const localPath =
|
|
12240
|
+
const localPath = join10(destDir, filename);
|
|
12088
12241
|
const downloadPromise = (async () => {
|
|
12089
12242
|
const cacheStartedAt = Date.now();
|
|
12090
12243
|
const reused = await reuseOrInvalidateCachedFile(
|
|
@@ -12161,104 +12314,12 @@ import {
|
|
|
12161
12314
|
lstatSync as lstatSync2,
|
|
12162
12315
|
mkdirSync as mkdirSync5,
|
|
12163
12316
|
readdirSync as readdirSync5,
|
|
12164
|
-
rmSync as
|
|
12317
|
+
rmSync as rmSync4,
|
|
12165
12318
|
statSync as statSync6,
|
|
12166
12319
|
utimesSync,
|
|
12167
12320
|
writeFileSync as writeFileSync3
|
|
12168
12321
|
} from "fs";
|
|
12169
|
-
|
|
12170
|
-
// ../engine/src/utils/renameWithRetry.ts
|
|
12171
|
-
import { copyFileSync as copyFileSync2, renameSync } from "fs";
|
|
12172
|
-
import { copyFile, rename } from "fs/promises";
|
|
12173
|
-
|
|
12174
|
-
// ../engine/src/utils/removeScratch.ts
|
|
12175
|
-
import { AsyncLocalStorage } from "async_hooks";
|
|
12176
|
-
import { rmSync as rmSync4 } from "fs";
|
|
12177
|
-
var collecting = new AsyncLocalStorage();
|
|
12178
|
-
function removeScratch(path) {
|
|
12179
|
-
try {
|
|
12180
|
-
rmSync4(path, { recursive: true, force: true });
|
|
12181
|
-
} catch {
|
|
12182
|
-
collecting.getStore()?.push(path);
|
|
12183
|
-
}
|
|
12184
|
-
}
|
|
12185
|
-
async function collectScratchLeftovers(run, report) {
|
|
12186
|
-
const left = [];
|
|
12187
|
-
try {
|
|
12188
|
-
return await collecting.run(left, run);
|
|
12189
|
-
} finally {
|
|
12190
|
-
report(left);
|
|
12191
|
-
}
|
|
12192
|
-
}
|
|
12193
|
-
|
|
12194
|
-
// ../engine/src/utils/renameWithRetry.ts
|
|
12195
|
-
var RETRYABLE = /* @__PURE__ */ new Set(["EPERM", "EACCES", "EBUSY"]);
|
|
12196
|
-
var BACKOFF_MS = [10, 20, 40, 80, 160, 320, 640];
|
|
12197
|
-
function isRetryable(error, platform) {
|
|
12198
|
-
if (platform !== "win32") return false;
|
|
12199
|
-
return RETRYABLE.has(error?.code ?? "");
|
|
12200
|
-
}
|
|
12201
|
-
function nextStep(error, attempt, options, platform) {
|
|
12202
|
-
if (!isRetryable(error, platform)) return "throw";
|
|
12203
|
-
if (attempt < BACKOFF_MS.length) return "wait";
|
|
12204
|
-
return options.copyFallback ? "copy" : "throw";
|
|
12205
|
-
}
|
|
12206
|
-
function sleepSync(ms) {
|
|
12207
|
-
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
12208
|
-
}
|
|
12209
|
-
function renameWithRetry(from, to, options = {}) {
|
|
12210
|
-
const doRename = options.rename ?? renameSync;
|
|
12211
|
-
const doCopy = options.copy ?? copyFileSync2;
|
|
12212
|
-
const platform = options.platform ?? process.platform;
|
|
12213
|
-
for (let attempt = 0; ; attempt++) {
|
|
12214
|
-
try {
|
|
12215
|
-
doRename(from, to);
|
|
12216
|
-
return;
|
|
12217
|
-
} catch (error) {
|
|
12218
|
-
const step = nextStep(error, attempt, options, platform);
|
|
12219
|
-
if (step === "throw") throw error;
|
|
12220
|
-
if (step === "wait") {
|
|
12221
|
-
sleepSync(BACKOFF_MS[attempt]);
|
|
12222
|
-
continue;
|
|
12223
|
-
}
|
|
12224
|
-
try {
|
|
12225
|
-
doCopy(from, to);
|
|
12226
|
-
} catch {
|
|
12227
|
-
throw error;
|
|
12228
|
-
}
|
|
12229
|
-
removeScratch(from);
|
|
12230
|
-
return;
|
|
12231
|
-
}
|
|
12232
|
-
}
|
|
12233
|
-
}
|
|
12234
|
-
async function renameWithRetryAsync(from, to, options = {}) {
|
|
12235
|
-
const doRename = options.rename ?? rename;
|
|
12236
|
-
const doCopy = options.copy ?? copyFile;
|
|
12237
|
-
const platform = options.platform ?? process.platform;
|
|
12238
|
-
for (let attempt = 0; ; attempt++) {
|
|
12239
|
-
try {
|
|
12240
|
-
await doRename(from, to);
|
|
12241
|
-
return;
|
|
12242
|
-
} catch (error) {
|
|
12243
|
-
const step = nextStep(error, attempt, options, platform);
|
|
12244
|
-
if (step === "throw") throw error;
|
|
12245
|
-
if (step === "wait") {
|
|
12246
|
-
await new Promise((resolve2) => setTimeout(resolve2, BACKOFF_MS[attempt]));
|
|
12247
|
-
continue;
|
|
12248
|
-
}
|
|
12249
|
-
try {
|
|
12250
|
-
await doCopy(from, to);
|
|
12251
|
-
} catch {
|
|
12252
|
-
throw error;
|
|
12253
|
-
}
|
|
12254
|
-
removeScratch(from);
|
|
12255
|
-
return;
|
|
12256
|
-
}
|
|
12257
|
-
}
|
|
12258
|
-
}
|
|
12259
|
-
|
|
12260
|
-
// ../engine/src/services/extractionCache.ts
|
|
12261
|
-
import { join as join10 } from "path";
|
|
12322
|
+
import { join as join11 } from "path";
|
|
12262
12323
|
var COMPLETE_SENTINEL = ".hf-complete";
|
|
12263
12324
|
var GC_MARKER = ".hf-last-gc";
|
|
12264
12325
|
var SCHEMA_PREFIX = "hfcache-v8-";
|
|
@@ -12309,8 +12370,8 @@ function hasFrameFiles(dir) {
|
|
|
12309
12370
|
}
|
|
12310
12371
|
function lookupCacheEntry(rootDir, input) {
|
|
12311
12372
|
const keyHash = computeCacheKey(input);
|
|
12312
|
-
const dir =
|
|
12313
|
-
const complete = existsSync8(
|
|
12373
|
+
const dir = join11(rootDir, cacheEntryDirName(keyHash));
|
|
12374
|
+
const complete = existsSync8(join11(dir, COMPLETE_SENTINEL)) && hasFrameFiles(dir);
|
|
12314
12375
|
return { entry: { dir, keyHash }, hit: complete };
|
|
12315
12376
|
}
|
|
12316
12377
|
function partialCacheEntryDir(entry) {
|
|
@@ -12321,13 +12382,13 @@ function isTargetExistsRenameError(err) {
|
|
|
12321
12382
|
return code === "EEXIST" || code === "ENOTEMPTY" || code === "EPERM";
|
|
12322
12383
|
}
|
|
12323
12384
|
function adoptPublishedWinner(entry, partialDir) {
|
|
12324
|
-
if (!existsSync8(
|
|
12385
|
+
if (!existsSync8(join11(entry.dir, COMPLETE_SENTINEL)) || !hasFrameFiles(entry.dir)) return null;
|
|
12325
12386
|
removeDir(partialDir);
|
|
12326
12387
|
return { dir: entry.dir, published: true };
|
|
12327
12388
|
}
|
|
12328
12389
|
function publishCacheEntry(entry, partialDir) {
|
|
12329
12390
|
try {
|
|
12330
|
-
writeFileSync3(
|
|
12391
|
+
writeFileSync3(join11(partialDir, COMPLETE_SENTINEL), "", "utf-8");
|
|
12331
12392
|
} catch {
|
|
12332
12393
|
return { dir: partialDir, published: false };
|
|
12333
12394
|
}
|
|
@@ -12340,7 +12401,7 @@ function publishCacheEntry(entry, partialDir) {
|
|
|
12340
12401
|
const winner = adoptPublishedWinner(entry, partialDir);
|
|
12341
12402
|
if (winner) return winner;
|
|
12342
12403
|
try {
|
|
12343
|
-
|
|
12404
|
+
rmSync4(entry.dir, { recursive: true, force: true });
|
|
12344
12405
|
} catch {
|
|
12345
12406
|
return { dir: partialDir, published: false };
|
|
12346
12407
|
}
|
|
@@ -12358,7 +12419,7 @@ function touchCacheDir(dir) {
|
|
|
12358
12419
|
} catch {
|
|
12359
12420
|
}
|
|
12360
12421
|
try {
|
|
12361
|
-
utimesSync(
|
|
12422
|
+
utimesSync(join11(dir, COMPLETE_SENTINEL), now, now);
|
|
12362
12423
|
} catch {
|
|
12363
12424
|
}
|
|
12364
12425
|
}
|
|
@@ -12387,7 +12448,7 @@ function directorySizeBytes(path) {
|
|
|
12387
12448
|
return 0;
|
|
12388
12449
|
}
|
|
12389
12450
|
for (const child of children) {
|
|
12390
|
-
const childPath =
|
|
12451
|
+
const childPath = join11(path, child);
|
|
12391
12452
|
try {
|
|
12392
12453
|
const stat = lstatSync2(childPath);
|
|
12393
12454
|
if (stat.isDirectory()) {
|
|
@@ -12402,7 +12463,7 @@ function directorySizeBytes(path) {
|
|
|
12402
12463
|
}
|
|
12403
12464
|
function removeDir(path) {
|
|
12404
12465
|
try {
|
|
12405
|
-
|
|
12466
|
+
rmSync4(path, { recursive: true, force: true });
|
|
12406
12467
|
} catch {
|
|
12407
12468
|
}
|
|
12408
12469
|
}
|
|
@@ -12416,7 +12477,7 @@ function collectGcEntry(dir, name, now, minAgeMs, stats, remove) {
|
|
|
12416
12477
|
}
|
|
12417
12478
|
let lastUseMs = dirStat.mtimeMs;
|
|
12418
12479
|
try {
|
|
12419
|
-
lastUseMs = statSync6(
|
|
12480
|
+
lastUseMs = statSync6(join11(dir, COMPLETE_SENTINEL)).mtimeMs;
|
|
12420
12481
|
} catch {
|
|
12421
12482
|
}
|
|
12422
12483
|
return { dir, size: directorySizeBytes(dir), lastUseMs, ageMs: now - lastUseMs };
|
|
@@ -12426,14 +12487,14 @@ function collectGcEntry(dir, name, now, minAgeMs, stats, remove) {
|
|
|
12426
12487
|
}
|
|
12427
12488
|
function gcSweepDue(rootDir, maxAgeMs) {
|
|
12428
12489
|
try {
|
|
12429
|
-
return Date.now() - statSync6(
|
|
12490
|
+
return Date.now() - statSync6(join11(rootDir, GC_MARKER)).mtimeMs > maxAgeMs;
|
|
12430
12491
|
} catch {
|
|
12431
12492
|
return true;
|
|
12432
12493
|
}
|
|
12433
12494
|
}
|
|
12434
12495
|
function markGcSweep(rootDir) {
|
|
12435
12496
|
try {
|
|
12436
|
-
writeFileSync3(
|
|
12497
|
+
writeFileSync3(join11(rootDir, GC_MARKER), "", "utf-8");
|
|
12437
12498
|
} catch {
|
|
12438
12499
|
}
|
|
12439
12500
|
}
|
|
@@ -12448,7 +12509,7 @@ function gcExtractionCache(rootDir, opts) {
|
|
|
12448
12509
|
for (const child of readdirSync5(rootDir, { withFileTypes: true })) {
|
|
12449
12510
|
if (!child.isDirectory() || !isCacheLikeChild(child.name)) continue;
|
|
12450
12511
|
const entry = collectGcEntry(
|
|
12451
|
-
|
|
12512
|
+
join11(rootDir, child.name),
|
|
12452
12513
|
child.name,
|
|
12453
12514
|
now,
|
|
12454
12515
|
opts.minAgeMs,
|
|
@@ -12611,18 +12672,28 @@ function downloadFailureGroup(source, error) {
|
|
|
12611
12672
|
};
|
|
12612
12673
|
}
|
|
12613
12674
|
var VideoSourceExtractionError = class extends Error {
|
|
12614
|
-
constructor(kind, retryable, message, diagnostic = message) {
|
|
12675
|
+
constructor(kind, retryable, message, diagnostic = message, ffmpegReason) {
|
|
12615
12676
|
super(message);
|
|
12616
12677
|
this.kind = kind;
|
|
12617
12678
|
this.retryable = retryable;
|
|
12618
12679
|
this.diagnostic = diagnostic;
|
|
12680
|
+
this.ffmpegReason = ffmpegReason;
|
|
12619
12681
|
this.name = "VideoSourceExtractionError";
|
|
12620
12682
|
}
|
|
12621
12683
|
kind;
|
|
12622
12684
|
retryable;
|
|
12623
12685
|
diagnostic;
|
|
12686
|
+
ffmpegReason;
|
|
12624
12687
|
hyperframesVideoSourceExtractionError = true;
|
|
12625
12688
|
};
|
|
12689
|
+
var FFMPEG_REASON_LINES = 3;
|
|
12690
|
+
var FFMPEG_REASON_CHARS = 300;
|
|
12691
|
+
function ffmpegReasonFrom(stderr, paths) {
|
|
12692
|
+
let text = stderr;
|
|
12693
|
+
for (const known of paths.filter(Boolean).sort((a, b) => b.length - a.length))
|
|
12694
|
+
text = text.split(known).join("<path>");
|
|
12695
|
+
return text.replace(/[a-z][a-z\d+.-]*:\/\/[^\s'"]+/gi, "<url>").replace(/(?:[a-z]:)?(?:[\\/][^\s\\/:'"]+){2,}/gi, "<path>").split(/\r?\n/).map((line) => line.trim()).filter(Boolean).slice(-FFMPEG_REASON_LINES).join(" | ").slice(-FFMPEG_REASON_CHARS);
|
|
12696
|
+
}
|
|
12626
12697
|
function isVideoSourceExtractionError(error) {
|
|
12627
12698
|
return typeof error === "object" && error !== null && "hyperframesVideoSourceExtractionError" in error && error.hyperframesVideoSourceExtractionError === true;
|
|
12628
12699
|
}
|
|
@@ -13009,7 +13080,7 @@ async function extractVideoFramesRangeUnredacted(videoPath, videoId, startTime,
|
|
|
13009
13080
|
const normalizedFps = toFps(options.fps);
|
|
13010
13081
|
const fps = fpsToNumber(normalizedFps);
|
|
13011
13082
|
const ffmpegFps = fpsToFfmpegArg(normalizedFps);
|
|
13012
|
-
const videoOutputDir = outputDirOverride ??
|
|
13083
|
+
const videoOutputDir = outputDirOverride ?? join12(outputDir, videoId);
|
|
13013
13084
|
if (!existsSync9(videoOutputDir)) mkdirSync6(videoOutputDir, { recursive: true });
|
|
13014
13085
|
let metadata;
|
|
13015
13086
|
try {
|
|
@@ -13136,12 +13207,18 @@ async function extractVideoFramesRangeUnredacted(videoPath, videoId, startTime,
|
|
|
13136
13207
|
const timedOut = processResult.terminationReason === "inactivity";
|
|
13137
13208
|
const timeoutSuffix = timedOut ? ` (no new frame for ${ffmpegProcessTimeout} ms)` : "";
|
|
13138
13209
|
const diagnostic = `${hdrPrefix}FFmpeg exited with code ${processResult.exitCode}${timeoutSuffix}: ` + processResult.stderr.slice(-500);
|
|
13210
|
+
const ffmpegReason = ffmpegReasonFrom(processResult.stderr, [
|
|
13211
|
+
videoPath,
|
|
13212
|
+
basename2(videoPath),
|
|
13213
|
+
videoOutputDir
|
|
13214
|
+
]);
|
|
13139
13215
|
if (timedOut) {
|
|
13140
13216
|
throw new VideoSourceExtractionError(
|
|
13141
13217
|
"ffmpeg_timeout",
|
|
13142
13218
|
true,
|
|
13143
13219
|
"Video frame extraction timed out",
|
|
13144
|
-
diagnostic
|
|
13220
|
+
diagnostic,
|
|
13221
|
+
ffmpegReason
|
|
13145
13222
|
);
|
|
13146
13223
|
}
|
|
13147
13224
|
const transientIo = /resource temporarily unavailable|device or resource busy|input\/output error/i.test(
|
|
@@ -13151,7 +13228,8 @@ async function extractVideoFramesRangeUnredacted(videoPath, videoId, startTime,
|
|
|
13151
13228
|
transientIo ? "ffmpeg_transient" : "ffmpeg_failed",
|
|
13152
13229
|
transientIo,
|
|
13153
13230
|
transientIo ? "Video frame extraction hit a transient I/O failure" : "Video source could not be decoded",
|
|
13154
|
-
diagnostic
|
|
13231
|
+
diagnostic,
|
|
13232
|
+
ffmpegReason
|
|
13155
13233
|
);
|
|
13156
13234
|
}
|
|
13157
13235
|
const framePaths = framePathsFromDirectory(videoOutputDir, format, !!options.frameRanges);
|
|
@@ -13415,7 +13493,7 @@ function linkOrCopyFrame(src, dest) {
|
|
|
13415
13493
|
try {
|
|
13416
13494
|
linkSync2(src, dest);
|
|
13417
13495
|
} catch {
|
|
13418
|
-
|
|
13496
|
+
copyFileSync2(src, dest);
|
|
13419
13497
|
}
|
|
13420
13498
|
}
|
|
13421
13499
|
function supersetGroupingKey(work, fps) {
|
|
@@ -13505,7 +13583,7 @@ function planSupersetGroups(misses, fps) {
|
|
|
13505
13583
|
}
|
|
13506
13584
|
function sliceSupersetMember(member, superset, outputDir, fps, configuredFps) {
|
|
13507
13585
|
const { work } = member.miss;
|
|
13508
|
-
|
|
13586
|
+
rmSync5(outputDir, { recursive: true, force: true });
|
|
13509
13587
|
mkdirSync6(outputDir, { recursive: true });
|
|
13510
13588
|
const requestedFrames = extractionFrameCountForDuration(
|
|
13511
13589
|
work.videoDuration,
|
|
@@ -13517,7 +13595,7 @@ function sliceSupersetMember(member, superset, outputDir, fps, configuredFps) {
|
|
|
13517
13595
|
for (let i = 0; i < frameCount; i += 1) {
|
|
13518
13596
|
const sourceFrame = superset.framePaths.get(member.offsetFrames + i);
|
|
13519
13597
|
if (!sourceFrame) throw new Error(`superset frame ${member.offsetFrames + i} missing`);
|
|
13520
|
-
linkOrCopyFrame(sourceFrame,
|
|
13598
|
+
linkOrCopyFrame(sourceFrame, join12(outputDir, frameFileName(i + 1, work.format)));
|
|
13521
13599
|
}
|
|
13522
13600
|
return extractedFramesFromDirectory(work, outputDir, work.videoPath, fps);
|
|
13523
13601
|
}
|
|
@@ -13573,7 +13651,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13573
13651
|
continue;
|
|
13574
13652
|
}
|
|
13575
13653
|
if (isHttpUrl(videoPath)) {
|
|
13576
|
-
const downloadDir =
|
|
13654
|
+
const downloadDir = join12(options.outputDir, DOWNLOAD_SUBDIR);
|
|
13577
13655
|
mkdirSync6(downloadDir, { recursive: true });
|
|
13578
13656
|
videoPath = await downloadToTemp(
|
|
13579
13657
|
videoPath,
|
|
@@ -13602,19 +13680,15 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13602
13680
|
}
|
|
13603
13681
|
resolvedVideos.push({ video, videoPath });
|
|
13604
13682
|
} catch (err) {
|
|
13605
|
-
const classified = classifyVideoExtractionError(err);
|
|
13606
13683
|
errors.push({
|
|
13607
|
-
|
|
13608
|
-
|
|
13609
|
-
retryable: classified.retryable,
|
|
13610
|
-
...err instanceof UrlDownloadError ? { group: downloadFailureGroup(video.src, err) } : {},
|
|
13611
|
-
error: classified.diagnostic
|
|
13684
|
+
...extractionError(video.id, err),
|
|
13685
|
+
...err instanceof UrlDownloadError ? { group: downloadFailureGroup(video.src, err) } : {}
|
|
13612
13686
|
});
|
|
13613
13687
|
}
|
|
13614
13688
|
}
|
|
13615
13689
|
breakdown.resolveMs = Date.now() - phase1Start;
|
|
13616
13690
|
const contentKeyedDirs = [
|
|
13617
|
-
|
|
13691
|
+
join12(options.outputDir, DOWNLOAD_SUBDIR),
|
|
13618
13692
|
...options.contentKeyedDirs ?? []
|
|
13619
13693
|
];
|
|
13620
13694
|
const cacheKeyInputs = resolvedVideos.map(({ video, videoPath }) => {
|
|
@@ -13749,7 +13823,8 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13749
13823
|
videoId,
|
|
13750
13824
|
kind: classified.kind,
|
|
13751
13825
|
retryable: classified.retryable,
|
|
13752
|
-
error: classified.diagnostic
|
|
13826
|
+
error: classified.diagnostic,
|
|
13827
|
+
...classified.ffmpegReason ? { ffmpegReason: classified.ffmpegReason } : {}
|
|
13753
13828
|
};
|
|
13754
13829
|
}
|
|
13755
13830
|
function scopedExtractionOptions(work) {
|
|
@@ -13821,7 +13896,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13821
13896
|
async function extractDirectMiss(miss, maxTransientRetries = options.maxTransientRetries ?? 0) {
|
|
13822
13897
|
const { work, cacheTarget } = miss;
|
|
13823
13898
|
if (!cacheTarget) {
|
|
13824
|
-
const outputDir =
|
|
13899
|
+
const outputDir = join12(options.outputDir, work.video.id);
|
|
13825
13900
|
const attempted2 = await runVideoExtractionWithRetry(
|
|
13826
13901
|
() => extractVideoFramesRange(
|
|
13827
13902
|
work.videoPath,
|
|
@@ -13837,14 +13912,14 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13837
13912
|
maxTransientRetries,
|
|
13838
13913
|
onRetry: () => {
|
|
13839
13914
|
recordTransientRetries(1);
|
|
13840
|
-
|
|
13915
|
+
rmSync5(outputDir, { recursive: true, force: true });
|
|
13841
13916
|
}
|
|
13842
13917
|
}
|
|
13843
13918
|
);
|
|
13844
13919
|
return attempted2.result;
|
|
13845
13920
|
}
|
|
13846
13921
|
const partialDir = partialCacheEntryDir(cacheTarget.entry);
|
|
13847
|
-
|
|
13922
|
+
rmSync5(partialDir, { recursive: true, force: true });
|
|
13848
13923
|
mkdirSync6(partialDir, { recursive: true });
|
|
13849
13924
|
const attempted = await runVideoExtractionWithRetry(
|
|
13850
13925
|
() => extractVideoFramesRange(
|
|
@@ -13862,7 +13937,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13862
13937
|
maxTransientRetries,
|
|
13863
13938
|
onRetry: () => {
|
|
13864
13939
|
recordTransientRetries(1);
|
|
13865
|
-
|
|
13940
|
+
rmSync5(partialDir, { recursive: true, force: true });
|
|
13866
13941
|
mkdirSync6(partialDir, { recursive: true });
|
|
13867
13942
|
}
|
|
13868
13943
|
}
|
|
@@ -13887,7 +13962,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13887
13962
|
const tailFrames = Math.min(expectedFrames, Math.ceil(fps));
|
|
13888
13963
|
if (expectedFrames <= tailFrames) return null;
|
|
13889
13964
|
const deferred = (totalFrames) => {
|
|
13890
|
-
const outputDir =
|
|
13965
|
+
const outputDir = join12(options.outputDir, work.video.id);
|
|
13891
13966
|
mkdirSync6(outputDir, { recursive: true });
|
|
13892
13967
|
return {
|
|
13893
13968
|
videoId: work.video.id,
|
|
@@ -13924,9 +13999,9 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13924
13999
|
const totalFrames = firstTailFrame + storedTailFrames;
|
|
13925
14000
|
return totalFrames <= expectedFrames * 0.6 ? null : deferred(totalFrames);
|
|
13926
14001
|
}
|
|
13927
|
-
const probeDir =
|
|
14002
|
+
const probeDir = join12(options.outputDir, `${work.video.id}.tail-probe`);
|
|
13928
14003
|
try {
|
|
13929
|
-
const
|
|
14004
|
+
const tail2 = await extractVideoFramesRange(
|
|
13930
14005
|
work.videoPath,
|
|
13931
14006
|
work.video.id,
|
|
13932
14007
|
work.extractionMediaStart,
|
|
@@ -13940,13 +14015,13 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13940
14015
|
config,
|
|
13941
14016
|
probeDir
|
|
13942
14017
|
);
|
|
13943
|
-
const totalFrames = firstTailFrame +
|
|
14018
|
+
const totalFrames = firstTailFrame + tail2.totalFrames;
|
|
13944
14019
|
if (totalFrames <= expectedFrames * 0.6) return null;
|
|
13945
14020
|
return deferred(totalFrames);
|
|
13946
14021
|
} catch {
|
|
13947
14022
|
return null;
|
|
13948
14023
|
} finally {
|
|
13949
|
-
|
|
14024
|
+
rmSync5(probeDir, { recursive: true, force: true });
|
|
13950
14025
|
}
|
|
13951
14026
|
}
|
|
13952
14027
|
async function executeDirectMiss(miss, maxTransientRetries = options.maxTransientRetries ?? 0) {
|
|
@@ -13963,7 +14038,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13963
14038
|
return sliceSupersetMember(
|
|
13964
14039
|
member,
|
|
13965
14040
|
superset,
|
|
13966
|
-
|
|
14041
|
+
join12(options.outputDir, work.video.id),
|
|
13967
14042
|
fps,
|
|
13968
14043
|
configuredFps
|
|
13969
14044
|
);
|
|
@@ -13980,9 +14055,9 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13980
14055
|
async function executeSupersetGroup(group) {
|
|
13981
14056
|
const first = group.members[0]?.miss.work;
|
|
13982
14057
|
if (!first) return [];
|
|
13983
|
-
const tempDir = cacheRootDir ?
|
|
14058
|
+
const tempDir = cacheRootDir ? join12(cacheRootDir, `${group.groupId}.partial-${process.pid}`) : join12(options.outputDir, group.groupId);
|
|
13984
14059
|
try {
|
|
13985
|
-
|
|
14060
|
+
rmSync5(tempDir, { recursive: true, force: true });
|
|
13986
14061
|
const superset = await extractVideoFramesRange(
|
|
13987
14062
|
first.videoPath,
|
|
13988
14063
|
group.groupId,
|
|
@@ -14015,7 +14090,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
14015
14090
|
);
|
|
14016
14091
|
return fallback;
|
|
14017
14092
|
} finally {
|
|
14018
|
-
|
|
14093
|
+
rmSync5(tempDir, { recursive: true, force: true });
|
|
14019
14094
|
}
|
|
14020
14095
|
}
|
|
14021
14096
|
const preparedExtractions = await Promise.all(
|
|
@@ -14125,12 +14200,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
14125
14200
|
const isFollower = outcome.error.videoId !== prepared.work.video.id;
|
|
14126
14201
|
const message = isFollower ? `[shared extraction, leader ${outcome.error.videoId}] ${outcome.error.error}` : outcome.error.error;
|
|
14127
14202
|
results.push({
|
|
14128
|
-
error: {
|
|
14129
|
-
videoId: prepared.work.video.id,
|
|
14130
|
-
kind: outcome.error.kind,
|
|
14131
|
-
retryable: outcome.error.retryable,
|
|
14132
|
-
error: message
|
|
14133
|
-
}
|
|
14203
|
+
error: { ...outcome.error, videoId: prepared.work.video.id, error: message }
|
|
14134
14204
|
});
|
|
14135
14205
|
continue;
|
|
14136
14206
|
}
|
|
@@ -14324,7 +14394,7 @@ var FrameLookupTable = class {
|
|
|
14324
14394
|
for (const video of this.videos.values()) {
|
|
14325
14395
|
if (video.extracted.ownedByLookup) continue;
|
|
14326
14396
|
if (existsSync9(video.extracted.outputDir)) {
|
|
14327
|
-
|
|
14397
|
+
rmSync5(video.extracted.outputDir, { recursive: true, force: true });
|
|
14328
14398
|
}
|
|
14329
14399
|
}
|
|
14330
14400
|
this.videos.clear();
|
|
@@ -14829,8 +14899,8 @@ async function queryElementStacking(page, nativeHdrIds) {
|
|
|
14829
14899
|
}
|
|
14830
14900
|
|
|
14831
14901
|
// ../engine/src/services/audioMixer.ts
|
|
14832
|
-
import { closeSync as closeSync4, existsSync as existsSync11, mkdirSync as mkdirSync7, mkdtempSync as
|
|
14833
|
-
import { join as
|
|
14902
|
+
import { closeSync as closeSync4, existsSync as existsSync11, mkdirSync as mkdirSync7, mkdtempSync as mkdtempSync9, openSync as openSync4, rmSync as rmSync7, writeFileSync as writeFileSync7 } from "fs";
|
|
14903
|
+
import { join as join16, dirname as dirname7, isAbsolute, relative } from "path";
|
|
14834
14904
|
|
|
14835
14905
|
// ../engine/src/utils/notMediaPayload.ts
|
|
14836
14906
|
import { createHash as createHash3 } from "crypto";
|
|
@@ -14949,8 +15019,8 @@ import { cpus as cpus2 } from "os";
|
|
|
14949
15019
|
|
|
14950
15020
|
// ../engine/src/services/aacEncode.ts
|
|
14951
15021
|
import { execFile as execFile3 } from "child_process";
|
|
14952
|
-
import { mkdtempSync as
|
|
14953
|
-
import { dirname as dirname5, join as
|
|
15022
|
+
import { mkdtempSync as mkdtempSync6, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
|
|
15023
|
+
import { dirname as dirname5, join as join13 } from "path";
|
|
14954
15024
|
var SAMPLE_RATE = 48e3;
|
|
14955
15025
|
var FRAME_SAMPLES = 1024;
|
|
14956
15026
|
var MIN_SEGMENT_SECONDS = 60;
|
|
@@ -15013,11 +15083,11 @@ async function encodeAac(input, outputPath, totalDuration, {
|
|
|
15013
15083
|
if (!await supportsSettsDuration()) {
|
|
15014
15084
|
return encodeInOnePass(input, outputPath, { signal, timeout, filter });
|
|
15015
15085
|
}
|
|
15016
|
-
const dir =
|
|
15086
|
+
const dir = mkdtempSync6(join13(dirname5(outputPath), ".aac-segments-"));
|
|
15017
15087
|
try {
|
|
15018
15088
|
const segments = planSegments(totalDuration, count).map((segment, k) => ({
|
|
15019
15089
|
...segment,
|
|
15020
|
-
path:
|
|
15090
|
+
path: join13(dir, `${k}.aac`)
|
|
15021
15091
|
}));
|
|
15022
15092
|
const results = await Promise.all(
|
|
15023
15093
|
segments.map(
|
|
@@ -15044,7 +15114,7 @@ async function encodeAac(input, outputPath, totalDuration, {
|
|
|
15044
15114
|
);
|
|
15045
15115
|
const failed = results.find((result) => !result.success);
|
|
15046
15116
|
if (failed) return failed;
|
|
15047
|
-
const joined =
|
|
15117
|
+
const joined = join13(dir, "joined.aac");
|
|
15048
15118
|
const frames = segments.flatMap(({ path, keepFrom, keepTo }) => {
|
|
15049
15119
|
const segmentFrames = splitAdtsFrames(readFileSync5(path));
|
|
15050
15120
|
if (segmentFrames.length < keepTo) {
|
|
@@ -15178,8 +15248,8 @@ function audioFailureDiagnostics(values) {
|
|
|
15178
15248
|
}
|
|
15179
15249
|
|
|
15180
15250
|
// ../engine/src/services/audioVolumeEnvelope.ts
|
|
15181
|
-
import { mkdtempSync as
|
|
15182
|
-
import { dirname as dirname6, join as
|
|
15251
|
+
import { mkdtempSync as mkdtempSync7, readFileSync as readFileSync6, rmSync as rmSync6, writeFileSync as writeFileSync5 } from "fs";
|
|
15252
|
+
import { dirname as dirname6, join as join14 } from "path";
|
|
15183
15253
|
|
|
15184
15254
|
// ../core/dist/runtime/mediaVolumeEnvelope.js
|
|
15185
15255
|
function normaliseEnvelope(keyframes, trackStart, baseVolume) {
|
|
@@ -15305,8 +15375,8 @@ function applyVolumeEnvelopeToWav(wavPath, keyframes, trackStart, baseVolume) {
|
|
|
15305
15375
|
const layout = parseWavLayout(buffer);
|
|
15306
15376
|
if (!layout) return false;
|
|
15307
15377
|
scaleSamples(buffer, layout, gainAt);
|
|
15308
|
-
stagingDir =
|
|
15309
|
-
const tempPath =
|
|
15378
|
+
stagingDir = mkdtempSync7(join14(dirname6(wavPath), ".hf-volume-"));
|
|
15379
|
+
const tempPath = join14(stagingDir, "audio.wav");
|
|
15310
15380
|
writeFileSync5(tempPath, buffer, { flag: "wx" });
|
|
15311
15381
|
renameWithRetry(tempPath, wavPath);
|
|
15312
15382
|
return true;
|
|
@@ -15315,7 +15385,7 @@ function applyVolumeEnvelopeToWav(wavPath, keyframes, trackStart, baseVolume) {
|
|
|
15315
15385
|
} finally {
|
|
15316
15386
|
if (stagingDir) {
|
|
15317
15387
|
try {
|
|
15318
|
-
|
|
15388
|
+
rmSync6(stagingDir, { recursive: true, force: true });
|
|
15319
15389
|
} catch {
|
|
15320
15390
|
}
|
|
15321
15391
|
}
|
|
@@ -15536,7 +15606,7 @@ function chainTailSeconds(chain, automation) {
|
|
|
15536
15606
|
import {
|
|
15537
15607
|
closeSync as closeSync3,
|
|
15538
15608
|
existsSync as existsSync10,
|
|
15539
|
-
mkdtempSync as
|
|
15609
|
+
mkdtempSync as mkdtempSync8,
|
|
15540
15610
|
openSync as openSync3,
|
|
15541
15611
|
readFileSync as readFileSync7,
|
|
15542
15612
|
readSync,
|
|
@@ -15544,8 +15614,8 @@ import {
|
|
|
15544
15614
|
writeFileSync as writeFileSync6,
|
|
15545
15615
|
writeSync as writeSync2
|
|
15546
15616
|
} from "fs";
|
|
15547
|
-
import { tmpdir as
|
|
15548
|
-
import { join as
|
|
15617
|
+
import { tmpdir as tmpdir5 } from "os";
|
|
15618
|
+
import { join as join15 } from "path";
|
|
15549
15619
|
import { pathToFileURL } from "url";
|
|
15550
15620
|
|
|
15551
15621
|
// ../core/dist/generated/audio-fx-runtime-inline.js
|
|
@@ -15896,14 +15966,19 @@ async function applyAudioFxChain(inputWav, chain, outputWav, options) {
|
|
|
15896
15966
|
}
|
|
15897
15967
|
});
|
|
15898
15968
|
}
|
|
15969
|
+
var fxBrowserArgs;
|
|
15970
|
+
var fxChromeArgs = () => fxBrowserArgs ??= buildChromeArgs(
|
|
15971
|
+
{ width: 1280, height: 720, captureMode: "screenshot" },
|
|
15972
|
+
{ browserGpuMode: "software" }
|
|
15973
|
+
);
|
|
15899
15974
|
async function withFxBrowser(options, body) {
|
|
15900
|
-
const hostDir =
|
|
15975
|
+
const hostDir = mkdtempSync8(join15(tmpdir5(), "hf-fx-host-"));
|
|
15901
15976
|
let lease = null;
|
|
15902
15977
|
try {
|
|
15903
15978
|
if (options.signal?.aborted) {
|
|
15904
15979
|
throw new AudioFxRenderError(`Audio FX cancelled for track ${options.trackId}`);
|
|
15905
15980
|
}
|
|
15906
|
-
lease = await acquireBrowser(
|
|
15981
|
+
lease = await acquireBrowser(fxChromeArgs());
|
|
15907
15982
|
const { browser } = lease;
|
|
15908
15983
|
return await body(() => openFxPage(browser, hostDir));
|
|
15909
15984
|
} catch (err) {
|
|
@@ -15919,7 +15994,7 @@ async function withFxBrowser(options, body) {
|
|
|
15919
15994
|
async function openFxPage(browser, hostDir) {
|
|
15920
15995
|
const page = await browser.newPage();
|
|
15921
15996
|
try {
|
|
15922
|
-
const hostPage =
|
|
15997
|
+
const hostPage = join15(hostDir, "audio-fx.html");
|
|
15923
15998
|
writeFileSync6(hostPage, "<!doctype html><meta charset=utf-8><title>audio fx</title>");
|
|
15924
15999
|
await page.goto(pathToFileURL(hostPage).href, {
|
|
15925
16000
|
waitUntil: "domcontentloaded"
|
|
@@ -16044,11 +16119,11 @@ function buildAtempoFilter(playbackRate) {
|
|
|
16044
16119
|
}
|
|
16045
16120
|
var RAMP_SLICE_SECONDS = 0.25;
|
|
16046
16121
|
var MAX_RAMP_SLICES = 240;
|
|
16047
|
-
function buildRampFilterComplex(lane, duration, headFilter, tailFilter) {
|
|
16122
|
+
function buildRampFilterComplex(lane, duration, headFilter, tailFilter, input) {
|
|
16048
16123
|
const slices = Math.min(MAX_RAMP_SLICES, Math.max(1, Math.ceil(duration / RAMP_SLICE_SECONDS)));
|
|
16049
16124
|
const step = duration / slices;
|
|
16050
16125
|
const split = Array.from({ length: slices }, (_, i) => `[s${i}]`).join("");
|
|
16051
|
-
const parts = [`[
|
|
16126
|
+
const parts = [`[${input}]${headFilter ? `${headFilter},` : ""}asplit=${slices}${split}`];
|
|
16052
16127
|
for (let i = 0; i < slices; i += 1) {
|
|
16053
16128
|
const from = sourceTimeAt(lane, i * step);
|
|
16054
16129
|
const to = sourceTimeAt(lane, (i + 1) * step);
|
|
@@ -16068,16 +16143,22 @@ function buildRampFilterComplex(lane, duration, headFilter, tailFilter) {
|
|
|
16068
16143
|
if (tailFilter) parts.push(`[cat]${tailFilter}[out]`);
|
|
16069
16144
|
return parts.join(";");
|
|
16070
16145
|
}
|
|
16071
|
-
function preparedAudioOutputArgs(metadata, playbackRate, duration, headFilter) {
|
|
16146
|
+
function preparedAudioOutputArgs(metadata, playbackRate, duration, headFilter, stream) {
|
|
16072
16147
|
const channelFilter = metadata?.channels === 1 ? STEREO_CHANNEL_FILTER : null;
|
|
16073
16148
|
const outputArgs = channelFilter ? [] : ["-ac", "2"];
|
|
16074
16149
|
if (typeof playbackRate === "object") {
|
|
16075
|
-
const graph = buildRampFilterComplex(
|
|
16150
|
+
const graph = buildRampFilterComplex(
|
|
16151
|
+
playbackRate,
|
|
16152
|
+
duration,
|
|
16153
|
+
headFilter,
|
|
16154
|
+
channelFilter,
|
|
16155
|
+
stream ?? "0:a"
|
|
16156
|
+
);
|
|
16076
16157
|
return ["-filter_complex", graph, "-map", "[out]", ...outputArgs];
|
|
16077
16158
|
}
|
|
16078
16159
|
const filters = [headFilter, channelFilter, buildAtempoFilter(playbackRate)].filter(Boolean);
|
|
16079
16160
|
if (filters.length > 0) outputArgs.push("-af", filters.join(","));
|
|
16080
|
-
return outputArgs;
|
|
16161
|
+
return [...stream ? ["-map", stream] : [], ...outputArgs];
|
|
16081
16162
|
}
|
|
16082
16163
|
function escapeExpressionCommas(expression) {
|
|
16083
16164
|
return expression.replace(/\\/g, "\\\\").replace(/,/g, "\\,");
|
|
@@ -16384,8 +16465,8 @@ async function extractAudioSegment(srcPath, outputPath, stage, mediaStart, durat
|
|
|
16384
16465
|
});
|
|
16385
16466
|
const loopDuration = (metadata?.durationSeconds ?? 0) - mediaStart;
|
|
16386
16467
|
if (options?.loop && loopDuration > 0 && sourceDuration > loopDuration) {
|
|
16387
|
-
const cycleDir =
|
|
16388
|
-
const cyclePath =
|
|
16468
|
+
const cycleDir = mkdtempSync9(join16(outputDir, ".audio-loop-"));
|
|
16469
|
+
const cyclePath = join16(cycleDir, "cycle.wav");
|
|
16389
16470
|
try {
|
|
16390
16471
|
const cycle = await extractAudioSegment(
|
|
16391
16472
|
srcPath,
|
|
@@ -16400,7 +16481,13 @@ async function extractAudioSegment(srcPath, outputPath, stage, mediaStart, durat
|
|
|
16400
16481
|
{ padToDuration: true }
|
|
16401
16482
|
);
|
|
16402
16483
|
if (!cycle.success) return { ...cycle, outputPath };
|
|
16403
|
-
const outputArgs2 = preparedAudioOutputArgs(
|
|
16484
|
+
const outputArgs2 = preparedAudioOutputArgs(
|
|
16485
|
+
metadata,
|
|
16486
|
+
normalizedPlaybackRate,
|
|
16487
|
+
duration,
|
|
16488
|
+
null,
|
|
16489
|
+
null
|
|
16490
|
+
);
|
|
16404
16491
|
const result2 = await runFfmpeg(
|
|
16405
16492
|
[
|
|
16406
16493
|
"-stream_loop",
|
|
@@ -16446,7 +16533,8 @@ async function extractAudioSegment(srcPath, outputPath, stage, mediaStart, durat
|
|
|
16446
16533
|
[
|
|
16447
16534
|
warmUp > 0 ? `atrim=start=${warmUp},asetpts=PTS-STARTPTS` : timestampTrim,
|
|
16448
16535
|
...options?.padToDuration ? ["apad"] : []
|
|
16449
|
-
].filter(Boolean).join(",") || null
|
|
16536
|
+
].filter(Boolean).join(",") || null,
|
|
16537
|
+
metadata ? `0:a:${metadata.audioStream}` : null
|
|
16450
16538
|
);
|
|
16451
16539
|
const readFrom = fromSidecar ? audioSidecarUrl : srcPath;
|
|
16452
16540
|
const args = [
|
|
@@ -16573,8 +16661,8 @@ async function mixAudioTracksFlat(tracks, outputPath, totalDuration, signal, con
|
|
|
16573
16661
|
const runMix = async (ignoreAutomation, useNormalize2) => {
|
|
16574
16662
|
const inputs = [];
|
|
16575
16663
|
tracks.forEach((track) => inputs.push("-i", track.srcPath));
|
|
16576
|
-
const scriptDir =
|
|
16577
|
-
const scriptPath =
|
|
16664
|
+
const scriptDir = mkdtempSync9(join16(outputDir, ".filter-complex-"));
|
|
16665
|
+
const scriptPath = join16(scriptDir, "graph.txt");
|
|
16578
16666
|
const fd = openSync4(scriptPath, "wx", 384);
|
|
16579
16667
|
try {
|
|
16580
16668
|
writeFileSync7(fd, buildFilterComplex(ignoreAutomation, useNormalize2));
|
|
@@ -16684,8 +16772,8 @@ async function mixGroupMembersFlat(memberTracks, outputPath, totalDuration, sign
|
|
|
16684
16772
|
`${mixInputs}amix=inputs=${memberTracks.length}:duration=longest:dropout_transition=0[mixed];[mixed]volume=${formatFilterNumber(memberTracks.length)}[out]`
|
|
16685
16773
|
);
|
|
16686
16774
|
const filterComplex = [...inputFilters, mixFilter].join(";");
|
|
16687
|
-
const scriptDir =
|
|
16688
|
-
const scriptPath =
|
|
16775
|
+
const scriptDir = mkdtempSync9(join16(outputDir, ".group-filter-complex-"));
|
|
16776
|
+
const scriptPath = join16(scriptDir, "graph.txt");
|
|
16689
16777
|
const fd = openSync4(scriptPath, "wx", 384);
|
|
16690
16778
|
try {
|
|
16691
16779
|
writeFileSync7(fd, filterComplex);
|
|
@@ -16764,7 +16852,7 @@ async function sumInSlices(tracks, scratchDir, totalDuration, signal, config) {
|
|
|
16764
16852
|
let degradedAutomation = false;
|
|
16765
16853
|
for (let at = 0; at < tracks.length; at += MAX_MIX_INPUTS) {
|
|
16766
16854
|
const id = `sum-${at / MAX_MIX_INPUTS}`;
|
|
16767
|
-
const slicePath =
|
|
16855
|
+
const slicePath = join16(scratchDir, `${id}-slice.wav`);
|
|
16768
16856
|
const slice = await mixGroupMembersFlat(
|
|
16769
16857
|
tracks.slice(at, at + MAX_MIX_INPUTS),
|
|
16770
16858
|
slicePath,
|
|
@@ -16778,7 +16866,7 @@ async function sumInSlices(tracks, scratchDir, totalDuration, signal, config) {
|
|
|
16778
16866
|
running = wavTrack(id, slicePath);
|
|
16779
16867
|
continue;
|
|
16780
16868
|
}
|
|
16781
|
-
const foldedPath =
|
|
16869
|
+
const foldedPath = join16(scratchDir, `${id}.wav`);
|
|
16782
16870
|
const folded = await mixGroupMembersFlat(
|
|
16783
16871
|
[running, wavTrack(`${id}-slice`, slicePath)],
|
|
16784
16872
|
foldedPath,
|
|
@@ -16799,7 +16887,7 @@ async function mixGroupMembers(memberTracks, outputPath, totalDuration, signal,
|
|
|
16799
16887
|
return mixGroupMembersFlat(memberTracks, outputPath, totalDuration, signal, config);
|
|
16800
16888
|
}
|
|
16801
16889
|
mkdirSync7(dirname7(outputPath), { recursive: true });
|
|
16802
|
-
const scratchDir =
|
|
16890
|
+
const scratchDir = mkdtempSync9(join16(dirname7(outputPath), ".mix-batches-"));
|
|
16803
16891
|
try {
|
|
16804
16892
|
const summed = await sumInSlices(memberTracks, scratchDir, totalDuration, signal, config);
|
|
16805
16893
|
if (!summed.success) return summed;
|
|
@@ -16814,7 +16902,7 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config)
|
|
|
16814
16902
|
return mixAudioTracksFlat(tracks, outputPath, totalDuration, signal, config);
|
|
16815
16903
|
}
|
|
16816
16904
|
mkdirSync7(dirname7(outputPath), { recursive: true });
|
|
16817
|
-
const scratchDir =
|
|
16905
|
+
const scratchDir = mkdtempSync9(join16(dirname7(outputPath), ".mix-batches-"));
|
|
16818
16906
|
try {
|
|
16819
16907
|
const summed = await sumInSlices(tracks, scratchDir, totalDuration, signal, config);
|
|
16820
16908
|
if (!summed.success) {
|
|
@@ -16844,12 +16932,12 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config)
|
|
|
16844
16932
|
}
|
|
16845
16933
|
}
|
|
16846
16934
|
async function mixThroughFloatSum(tracks, masterChain, outputPath, workDir, totalDuration, signal, config) {
|
|
16847
|
-
const sumPath =
|
|
16935
|
+
const sumPath = join16(workDir, "master-sum.wav");
|
|
16848
16936
|
const mixStart = Date.now();
|
|
16849
16937
|
const sum = await mixAudioTracks(tracks, sumPath, totalDuration, signal, config);
|
|
16850
16938
|
if (!sum.success) return { ...sum, outputPath };
|
|
16851
16939
|
const masterStart = Date.now();
|
|
16852
|
-
const encoderInput = masterChain ? (await applyAudioFxChain(sumPath, masterChain,
|
|
16940
|
+
const encoderInput = masterChain ? (await applyAudioFxChain(sumPath, masterChain, join16(workDir, "master-fx.wav"), {
|
|
16853
16941
|
trackId: "master",
|
|
16854
16942
|
signal
|
|
16855
16943
|
})).path : sumPath;
|
|
@@ -16994,7 +17082,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
16994
17082
|
}
|
|
16995
17083
|
let audioSrcPath = srcPath;
|
|
16996
17084
|
if (element.type === "video") {
|
|
16997
|
-
const extractedPath =
|
|
17085
|
+
const extractedPath = join16(workDir, `${element.id}-extracted.wav`);
|
|
16998
17086
|
const extractResult = await extractAudioSegment(
|
|
16999
17087
|
srcPath,
|
|
17000
17088
|
extractedPath,
|
|
@@ -17022,7 +17110,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
17022
17110
|
}
|
|
17023
17111
|
audioSrcPath = extractedPath;
|
|
17024
17112
|
} else {
|
|
17025
|
-
const trimmedPath =
|
|
17113
|
+
const trimmedPath = join16(workDir, `${element.id}-trimmed.wav`);
|
|
17026
17114
|
const prepResult = await extractAudioSegment(
|
|
17027
17115
|
srcPath,
|
|
17028
17116
|
trimmedPath,
|
|
@@ -17074,7 +17162,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
17074
17162
|
const fxResult = await applyAudioFxChain(
|
|
17075
17163
|
audioSrcPath,
|
|
17076
17164
|
chain,
|
|
17077
|
-
|
|
17165
|
+
join16(workDir, `${element.id}-fx.wav`),
|
|
17078
17166
|
{
|
|
17079
17167
|
trackId: element.id,
|
|
17080
17168
|
signal: effectiveSignal,
|
|
@@ -17127,7 +17215,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
17127
17215
|
).catch((err) => {
|
|
17128
17216
|
internalController.abort();
|
|
17129
17217
|
try {
|
|
17130
|
-
|
|
17218
|
+
rmSync7(workDir, { recursive: true, force: true });
|
|
17131
17219
|
} catch {
|
|
17132
17220
|
}
|
|
17133
17221
|
throw err;
|
|
@@ -17152,7 +17240,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
17152
17240
|
});
|
|
17153
17241
|
const removeWorkDir = () => {
|
|
17154
17242
|
try {
|
|
17155
|
-
|
|
17243
|
+
rmSync7(workDir, { recursive: true, force: true });
|
|
17156
17244
|
} catch {
|
|
17157
17245
|
}
|
|
17158
17246
|
};
|
|
@@ -17197,7 +17285,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
17197
17285
|
const meta = groupMeta.get(groupId);
|
|
17198
17286
|
if (!meta) continue;
|
|
17199
17287
|
const pathId = safePathSegment(groupId, groupIndex);
|
|
17200
|
-
const groupWavPath =
|
|
17288
|
+
const groupWavPath = join16(workDir, `group-${pathId}.wav`);
|
|
17201
17289
|
try {
|
|
17202
17290
|
const subMix = await mixGroupMembers(
|
|
17203
17291
|
memberTracks,
|
|
@@ -17230,7 +17318,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
17230
17318
|
const fxResult = await applyAudioFxChain(
|
|
17231
17319
|
groupSrcPath,
|
|
17232
17320
|
chain,
|
|
17233
|
-
|
|
17321
|
+
join16(workDir, `group-${pathId}-fx.wav`),
|
|
17234
17322
|
{
|
|
17235
17323
|
trackId: groupId,
|
|
17236
17324
|
signal: effectiveSignal,
|
|
@@ -17311,22 +17399,22 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
17311
17399
|
// ../engine/src/services/parallelCoordinator.ts
|
|
17312
17400
|
import { cpus as cpus3, freemem } from "os";
|
|
17313
17401
|
import { existsSync as existsSync12, mkdirSync as mkdirSync8, readdirSync as readdirSync6 } from "fs";
|
|
17314
|
-
import { copyFile
|
|
17315
|
-
import { join as
|
|
17402
|
+
import { copyFile, readFile as readFile2 } from "fs/promises";
|
|
17403
|
+
import { join as join18 } from "path";
|
|
17316
17404
|
import { getHeapStatistics } from "v8";
|
|
17317
17405
|
|
|
17318
17406
|
// ../engine/src/utils/psnr.ts
|
|
17319
17407
|
import { execFile as execFile4 } from "child_process";
|
|
17320
17408
|
import { mkdtemp, rm, writeFile } from "fs/promises";
|
|
17321
|
-
import { tmpdir as
|
|
17322
|
-
import { join as
|
|
17409
|
+
import { tmpdir as tmpdir6 } from "os";
|
|
17410
|
+
import { join as join17 } from "path";
|
|
17323
17411
|
import { promisify as promisify3 } from "util";
|
|
17324
17412
|
async function psnrDb(a, b) {
|
|
17325
17413
|
const execFileP = promisify3(execFile4);
|
|
17326
|
-
const dir = await mkdtemp(
|
|
17414
|
+
const dir = await mkdtemp(join17(tmpdir6(), "hf-de-verify-"));
|
|
17327
17415
|
try {
|
|
17328
|
-
const pa =
|
|
17329
|
-
const pb =
|
|
17416
|
+
const pa = join17(dir, "a.jpg");
|
|
17417
|
+
const pb = join17(dir, "b.jpg");
|
|
17330
17418
|
await Promise.all([writeFile(pa, a), writeFile(pb, b)]);
|
|
17331
17419
|
const { stderr } = await execFileP(
|
|
17332
17420
|
getFfmpegBinary(),
|
|
@@ -17550,7 +17638,7 @@ function distributeFrames(totalFrames, workerCount, workDir, rangeStart = 0) {
|
|
|
17550
17638
|
workerId: i,
|
|
17551
17639
|
startFrame,
|
|
17552
17640
|
endFrame,
|
|
17553
|
-
outputDir:
|
|
17641
|
+
outputDir: join18(workDir, `worker-${i}`),
|
|
17554
17642
|
outputFrameOffset: rangeStart
|
|
17555
17643
|
});
|
|
17556
17644
|
}
|
|
@@ -17564,7 +17652,7 @@ function distributeFramesInterleaved(totalFrames, workerCount, workDir, rangeSta
|
|
|
17564
17652
|
startFrame: rangeStart + i,
|
|
17565
17653
|
endFrame: rangeStart + totalFrames,
|
|
17566
17654
|
frameStride: workerCount,
|
|
17567
|
-
outputDir:
|
|
17655
|
+
outputDir: join18(workDir, `worker-${i}`),
|
|
17568
17656
|
outputFrameOffset: rangeStart
|
|
17569
17657
|
});
|
|
17570
17658
|
}
|
|
@@ -17770,13 +17858,13 @@ async function verifyDiskDrawElementSamples(session, task, streaming) {
|
|
|
17770
17858
|
for (const idx of selectVerifySampleIndicesForTask(truths.keys(), task)) {
|
|
17771
17859
|
const truth = truths.get(idx);
|
|
17772
17860
|
if (!truth) continue;
|
|
17773
|
-
const framePath =
|
|
17861
|
+
const framePath = join18(task.outputDir, `frame_${String(idx - offset).padStart(6, "0")}.${ext}`);
|
|
17774
17862
|
const db = await psnrForDiskSample(framePath, truth, task.workerId, idx);
|
|
17775
17863
|
if (db === null) continue;
|
|
17776
17864
|
assertDiskSampleAboveFloor(db, verifyMinDb, idx, task.workerId);
|
|
17777
17865
|
}
|
|
17778
17866
|
}
|
|
17779
|
-
async function executeWorkerTask(task, serverUrl, captureOptions, createBeforeCaptureHook, signal, onFrameCaptured, onFrameBuffer, config, parallel, onFailure, onWorkerPhase, onWorkerOperation) {
|
|
17867
|
+
async function executeWorkerTask(task, serverUrl, captureOptions, createBeforeCaptureHook, signal, onFrameCaptured, onFrameBuffer, config, parallel, onFailure, onWorkerPhase, onWorkerOperation, gate) {
|
|
17780
17868
|
const startTime = Date.now();
|
|
17781
17869
|
let framesCaptured = 0;
|
|
17782
17870
|
if (!existsSync12(task.outputDir)) mkdirSync8(task.outputDir, { recursive: true });
|
|
@@ -17834,6 +17922,7 @@ async function executeWorkerTask(task, serverUrl, captureOptions, createBeforeCa
|
|
|
17834
17922
|
await assertSwiftShader(activeSession.page, readWebGlVendorInfoFromCanvas);
|
|
17835
17923
|
}
|
|
17836
17924
|
await initializeSession(activeSession);
|
|
17925
|
+
if (gate) await (task.workerId === 0 ? gate.verify(activeSession) : gate.wait());
|
|
17837
17926
|
});
|
|
17838
17927
|
canvasDrawElement = activeSession.captureMode === "drawelement";
|
|
17839
17928
|
gpuBackend = activeSession.gpuRenderer ?? "unknown";
|
|
@@ -17865,6 +17954,7 @@ async function executeWorkerTask(task, serverUrl, captureOptions, createBeforeCa
|
|
|
17865
17954
|
pageErrorLines: pageErrorLinesOf(activeSession)
|
|
17866
17955
|
};
|
|
17867
17956
|
} catch (error) {
|
|
17957
|
+
if (task.workerId === 0) gate?.fail(error);
|
|
17868
17958
|
const diagnostics = session ? selectWorkerDiagnostics(session.browserConsoleBuffer) : [];
|
|
17869
17959
|
const workerDiagnostic = {
|
|
17870
17960
|
workerId: task.workerId,
|
|
@@ -17906,6 +17996,24 @@ function isPoolFatalWorkerFailure(failure, streaming) {
|
|
|
17906
17996
|
if (streaming) return failure.kind !== "cancelled";
|
|
17907
17997
|
return isFatalCaptureFailure(failure);
|
|
17908
17998
|
}
|
|
17999
|
+
function createFirstSessionGate(verify) {
|
|
18000
|
+
let fail;
|
|
18001
|
+
let pass;
|
|
18002
|
+
const settled = new Promise((resolve2, reject) => {
|
|
18003
|
+
pass = resolve2;
|
|
18004
|
+
fail = reject;
|
|
18005
|
+
});
|
|
18006
|
+
settled.catch(() => {
|
|
18007
|
+
});
|
|
18008
|
+
return {
|
|
18009
|
+
verify: (session) => verify(session).then(pass, (error) => {
|
|
18010
|
+
fail(error);
|
|
18011
|
+
throw error;
|
|
18012
|
+
}),
|
|
18013
|
+
wait: () => settled,
|
|
18014
|
+
fail
|
|
18015
|
+
};
|
|
18016
|
+
}
|
|
17909
18017
|
function pageErrorLinesOf(session) {
|
|
17910
18018
|
return session.browserConsoleBuffer.filter((line) => line.includes("PAGEERROR"));
|
|
17911
18019
|
}
|
|
@@ -17977,6 +18085,7 @@ async function executeParallelCapture(serverUrl, workDir, tasks, captureOptions,
|
|
|
17977
18085
|
hooks
|
|
17978
18086
|
});
|
|
17979
18087
|
const onFailure = failureHandler.onFailure;
|
|
18088
|
+
const gate = hooks?.verifyFirstSession && createFirstSessionGate(hooks.verifyFirstSession);
|
|
17980
18089
|
const results = await Promise.all(
|
|
17981
18090
|
tasks.map(
|
|
17982
18091
|
(task) => executeWorkerTask(
|
|
@@ -17991,7 +18100,8 @@ async function executeParallelCapture(serverUrl, workDir, tasks, captureOptions,
|
|
|
17991
18100
|
parallel,
|
|
17992
18101
|
onFailure,
|
|
17993
18102
|
onWorkerPhase,
|
|
17994
|
-
hooks?.onWorkerOperation
|
|
18103
|
+
hooks?.onWorkerOperation,
|
|
18104
|
+
gate
|
|
17995
18105
|
)
|
|
17996
18106
|
)
|
|
17997
18107
|
);
|
|
@@ -18021,12 +18131,12 @@ async function mergeWorkerFrames(workDir, tasks, outputDir) {
|
|
|
18021
18131
|
}
|
|
18022
18132
|
const files = readdirSync6(task.outputDir).filter((f) => f.startsWith("frame_") && (f.endsWith(".jpg") || f.endsWith(".png"))).sort();
|
|
18023
18133
|
const copyTasks = files.map(async (file) => {
|
|
18024
|
-
const sourcePath =
|
|
18025
|
-
const targetPath =
|
|
18134
|
+
const sourcePath = join18(task.outputDir, file);
|
|
18135
|
+
const targetPath = join18(outputDir, file);
|
|
18026
18136
|
try {
|
|
18027
18137
|
await renameWithRetryAsync(sourcePath, targetPath);
|
|
18028
18138
|
} catch {
|
|
18029
|
-
await
|
|
18139
|
+
await copyFile(sourcePath, targetPath);
|
|
18030
18140
|
}
|
|
18031
18141
|
});
|
|
18032
18142
|
await Promise.all(copyTasks);
|
|
@@ -18047,7 +18157,7 @@ function getSystemResources() {
|
|
|
18047
18157
|
import { Hono } from "hono";
|
|
18048
18158
|
import { serve } from "@hono/node-server";
|
|
18049
18159
|
import { readFileSync as readFileSync8, openSync as openSync5, fstatSync, closeSync as closeSync5, statSync as statSync8, constants } from "fs";
|
|
18050
|
-
import { join as
|
|
18160
|
+
import { join as join19, extname as extname3 } from "path";
|
|
18051
18161
|
var MIME_TYPES = {
|
|
18052
18162
|
".html": "text/html; charset=utf-8",
|
|
18053
18163
|
".css": "text/css; charset=utf-8",
|
|
@@ -18094,10 +18204,10 @@ function readRegularFile(filePath) {
|
|
|
18094
18204
|
}
|
|
18095
18205
|
}
|
|
18096
18206
|
function resolveContainedPaths(projectDir, compiledDir, relativePath) {
|
|
18097
|
-
const projectPath =
|
|
18207
|
+
const projectPath = join19(projectDir, relativePath);
|
|
18098
18208
|
if (!isWithinProjectRoot(projectDir, projectPath)) return null;
|
|
18099
18209
|
if (!compiledDir) return { projectPath, compiledPath: null };
|
|
18100
|
-
const compiledPath =
|
|
18210
|
+
const compiledPath = join19(compiledDir, relativePath);
|
|
18101
18211
|
if (!isWithinProjectRoot(compiledDir, compiledPath)) return null;
|
|
18102
18212
|
return { projectPath, compiledPath };
|
|
18103
18213
|
}
|
|
@@ -18478,6 +18588,13 @@ export {
|
|
|
18478
18588
|
applyConcreteGpuScreenshotClamp,
|
|
18479
18589
|
SDR_RGB_TO_BT709_FILTER,
|
|
18480
18590
|
SDR_RGB_TO_TAGGED_BT709_FILTER,
|
|
18591
|
+
explainChromeLaunchFailure,
|
|
18592
|
+
machServiceDenied,
|
|
18593
|
+
pipeLaunchClosedOnMac,
|
|
18594
|
+
inAgentSandbox,
|
|
18595
|
+
oneProcessOverPipe,
|
|
18596
|
+
isOneProcessOverPipe,
|
|
18597
|
+
sandboxDeniedRemediation,
|
|
18481
18598
|
BrowserLeasePool,
|
|
18482
18599
|
setHostHandlesSigint,
|
|
18483
18600
|
resolveHeadlessShellPath,
|
|
@@ -18622,10 +18739,6 @@ export {
|
|
|
18622
18739
|
fetchPublicHttpsText,
|
|
18623
18740
|
downloadToTemp,
|
|
18624
18741
|
isHttpUrl,
|
|
18625
|
-
removeScratch,
|
|
18626
|
-
collectScratchLeftovers,
|
|
18627
|
-
renameWithRetry,
|
|
18628
|
-
renameWithRetryAsync,
|
|
18629
18742
|
directorySizeBytes,
|
|
18630
18743
|
gcExtractionCache,
|
|
18631
18744
|
VIDEO_FRAME_FORMATS,
|