hyperframes 0.8.222 → 0.8.223
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-6MPLIWVP.js → add-PBLOPJHC.js} +12 -12
- package/dist/{agentPromptGenerator-X7SQPCXZ.js → agentPromptGenerator-OD74HKYZ.js} +7 -7
- package/dist/{animatedGifPrep-ESOJ4FQ7.js → animatedGifPrep-QCG2BTDC.js} +7 -7
- package/dist/api.d.ts +5 -3
- package/dist/api.js +32 -21
- package/dist/{asset-Y735VQV6.js → asset-KHXCO4OR.js} +2 -2
- package/dist/{assetCataloger-AOJAUEZW.js → assetCataloger-ZX5WZTDQ.js} +8 -8
- package/dist/{audio-VMMCGPOV.js → audio-7AH2C6PB.js} +145 -1153
- package/dist/{auth-BD5NHYRA.js → auth-DJWMGXQB.js} +5 -5
- package/dist/{autoUpdate-VTMNHOAJ.js → autoUpdate-KJMLYSHE.js} +2 -2
- package/dist/{backgroundChecks-SUDYQZSW.js → backgroundChecks-XLVQMMXY.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-4NR7RMT7.js → batchRender-UR67LI4H.js} +8 -8
- package/dist/{beats-PKEHQHBY.js → beats-ISWSYNN6.js} +10 -10
- package/dist/{benchmark-K55DDFHG.js → benchmark-7JUATINH.js} +8 -8
- package/dist/billing-VGKY3FMX.js +86 -0
- package/dist/{browser-G2WFWJJ3.js → browser-HNGQB47C.js} +3 -3
- package/dist/{bundleWithLocalizedFonts-MNG2UVH3.js → bundleWithLocalizedFonts-4XWX2XPS.js} +2 -2
- package/dist/{capture-U3EEAPI6.js → capture-GFDP5THL.js} +3 -3
- package/dist/{capture-24PIC3TZ.js → capture-LBEGVQTJ.js} +25 -25
- package/dist/{captureCompositionFrame-KL4V6ORD.js → captureCompositionFrame-5L3J4MZ4.js} +12 -12
- package/dist/{catalog-J3BU4TFW.js → catalog-SNUTPI57.js} +12 -12
- package/dist/{catch-up-LDGNMEGL.js → catch-up-FE3HDMLJ.js} +4 -4
- package/dist/{check-J6HG6EKE.js → check-MQCBMOKA.js} +40 -39
- package/dist/{checkAudio-MAX7JUYG.js → checkAudio-6VPMLIY6.js} +15 -15
- package/dist/{checkBrowser-3W74WJ26.js → checkBrowser-SHUVFQ4S.js} +34 -33
- package/dist/{chunk-P5M3AXEP.js → chunk-2GMHYOV3.js} +1 -1
- package/dist/{chunk-7D2LTSNV.js → chunk-2HBB5U52.js} +1 -1
- package/dist/{chunk-G675S644.js → chunk-3FGEDDSA.js} +26 -26
- package/dist/{chunk-D6LGD472.js → chunk-44IPXXSK.js} +6 -4
- package/dist/{chunk-FT3CNACL.js → chunk-44YG42L5.js} +144 -41
- package/dist/{chunk-NUE44RN2.js → chunk-45UOXUUH.js} +16 -3
- package/dist/chunk-4JRFMRCQ.js +288 -0
- package/dist/{chunk-AIXH3V5A.js → chunk-4XQQQ4KN.js} +3 -3
- package/dist/{chunk-6MUI2H6P.js → chunk-54Q3H2UQ.js} +5 -2
- package/dist/{chunk-YEKJOA47.js → chunk-664JAO7C.js} +1 -1
- package/dist/{chunk-QOZPWIYV.js → chunk-6LE7K3YM.js} +16 -13
- package/dist/{chunk-DC26QLB7.js → chunk-7LKEHM2R.js} +1 -1
- package/dist/{chunk-CZOC7WY7.js → chunk-7XWCCFYW.js} +1 -1
- package/dist/{chunk-G2EY3MVW.js → chunk-A2KNKY4Z.js} +1 -1
- package/dist/{chunk-OAXWHPNS.js → chunk-A5WWEW6U.js} +1 -1
- package/dist/{chunk-Y7IV5MAK.js → chunk-AKTI2SHL.js} +2 -2
- package/dist/chunk-AW7UW2Z7.js +312 -0
- package/dist/{chunk-F6QV5N3A.js → chunk-B5HFCGI7.js} +2 -2
- package/dist/{chunk-K5UCRKUK.js → chunk-B6F33PUK.js} +2 -2
- package/dist/{chunk-HQDHMAUI.js → chunk-BDEBKAD2.js} +1 -1
- package/dist/{chunk-DNTPNSH5.js → chunk-BN75GXZM.js} +3 -3
- package/dist/{chunk-BPIY5LB3.js → chunk-C466I3DT.js} +3 -3
- package/dist/{chunk-KEY2VA65.js → chunk-CXEU6XNL.js} +6 -20
- package/dist/{chunk-JQWITWVC.js → chunk-CYE2NNFF.js} +2 -2
- package/dist/{chunk-RRPO44PE.js → chunk-DFK4RMNE.js} +5 -5
- package/dist/chunk-DY7PQLIE.js +248 -0
- package/dist/chunk-EF735J3K.js +59 -0
- package/dist/{chunk-EGJ4UECR.js → chunk-EHZESMRB.js} +8 -2
- package/dist/chunk-EJOFIHX4.js +46 -0
- package/dist/{chunk-SKCS4SUZ.js → chunk-EX75C5HT.js} +13 -9
- package/dist/{chunk-3RXZZIDQ.js → chunk-FKBWONRY.js} +2 -2
- package/dist/{chunk-CVY6OIKN.js → chunk-FORV75JT.js} +26 -14
- package/dist/{chunk-WWT6ETQA.js → chunk-G5KX4X6W.js} +26 -26
- package/dist/{chunk-VQMHDS2V.js → chunk-HT3D5AKG.js} +52 -12
- package/dist/{chunk-35JKCWYI.js → chunk-I6OY5MS6.js} +1 -1
- package/dist/{chunk-VJVVWYP6.js → chunk-IJI2JNN7.js} +1 -1
- package/dist/{chunk-IGBOFU2Y.js → chunk-IQ7FABPU.js} +2 -2
- package/dist/{chunk-ZPTNLDOB.js → chunk-JNQCM6CR.js} +2 -2
- package/dist/{chunk-IB7UYGXR.js → chunk-JO4LHFFP.js} +9 -9
- package/dist/chunk-JTZHDD63.js +70 -0
- package/dist/{chunk-L55LAERP.js → chunk-K5GMPWMG.js} +1 -1
- package/dist/{chunk-ZBNK6X5O.js → chunk-KCDWRMTC.js} +2 -2
- package/dist/{chunk-GOWU3NCE.js → chunk-KJGYQVFD.js} +1 -1
- package/dist/{chunk-7IH3RSSG.js → chunk-KT2WLSX5.js} +10 -10
- package/dist/{chunk-AOHG22HQ.js → chunk-KWYK65GR.js} +5 -5
- package/dist/{chunk-AN4USOFT.js → chunk-LAIGIOEA.js} +1 -1
- package/dist/{chunk-E5IIR67Q.js → chunk-LV5AVW6U.js} +1 -1
- package/dist/{chunk-GHEYGMKD.js → chunk-M4UVOUWC.js} +1 -1
- package/dist/{chunk-DIXTEVWQ.js → chunk-M7HNGAWN.js} +3 -3
- package/dist/{chunk-EOUKB53E.js → chunk-MTVL7FWZ.js} +1 -1
- package/dist/{chunk-6CFBFWLF.js → chunk-MUHOFRGW.js} +1 -1
- package/dist/{chunk-OROHGC7W.js → chunk-N6XKBBT5.js} +7 -7
- package/dist/{chunk-4VEXJTUT.js → chunk-NLWG5TU7.js} +2 -2
- package/dist/chunk-NZZQCWUC.js +205 -0
- package/dist/{chunk-42Q3VX34.js → chunk-OL2C3ODS.js} +5 -5
- package/dist/{chunk-ZLXWRYOO.js → chunk-OVINGNLQ.js} +3 -3
- package/dist/{chunk-BDZSH6P3.js → chunk-OWFSGDQS.js} +1 -1
- package/dist/chunk-OZM6VLD7.js +71 -0
- package/dist/{chunk-6W3DY5BP.js → chunk-P5QGZMGC.js} +2 -2
- package/dist/{chunk-52VXA3SC.js → chunk-PBPHKD56.js} +1 -1
- package/dist/chunk-PHEPL7OX.js +1048 -0
- package/dist/{chunk-537WSYHU.js → chunk-PX7Y4HMM.js} +1 -1
- package/dist/{chunk-XHD7RKEZ.js → chunk-QNLHDYYO.js} +2 -2
- package/dist/{chunk-ZAJQFY5Q.js → chunk-QU5OYMTB.js} +15 -2
- package/dist/chunk-QZGKKQ77.js +570 -0
- package/dist/{chunk-WJYFJGYT.js → chunk-RKVKFXYB.js} +3 -3
- package/dist/{chunk-OQLYKDL5.js → chunk-RORIFIUW.js} +1 -1
- package/dist/{chunk-MESSJFK3.js → chunk-RWSVSCOP.js} +38 -28
- package/dist/chunk-RZ6CXJ56.js +24 -0
- package/dist/chunk-SDBVVDBW.js +113 -0
- package/dist/{chunk-Z5VQBRU2.js → chunk-SNFVQDKE.js} +1 -1
- package/dist/{chunk-EE7YWKDY.js → chunk-SX7ESVCQ.js} +4 -4
- package/dist/{chunk-AXVTL7B6.js → chunk-UFYWGUUV.js} +2 -2
- package/dist/{chunk-DSHFKKSZ.js → chunk-UGUWSAJT.js} +2 -2
- package/dist/chunk-UQECNXFA.js +5013 -0
- package/dist/{chunk-QYRMR45H.js → chunk-UQVAAEPQ.js} +1 -1
- package/dist/{chunk-NHXGFQWQ.js → chunk-UVF4U3ZF.js} +1 -1
- package/dist/{chunk-YSTBSLWY.js → chunk-VBCBHDIW.js} +1 -1
- package/dist/chunk-VJM6NX54.js +250 -0
- package/dist/chunk-WGOIJN57.js +95 -0
- package/dist/{chunk-GODT7QDZ.js → chunk-WQLTKHPP.js} +3 -3
- package/dist/{chunk-RIGSGNDQ.js → chunk-WUXDIF5D.js} +20 -19
- package/dist/{chunk-5GSEM63G.js → chunk-WWOHLNFO.js} +1 -1
- package/dist/{chunk-L37AZWB2.js → chunk-XZEHFUQF.js} +2 -2
- package/dist/{chunk-FMKI7ZLM.js → chunk-Y4INSXS7.js} +2 -2
- package/dist/{chunk-YHL4CVTF.js → chunk-ZEKV5T3I.js} +13 -13
- package/dist/{clean-K6IM3LC4.js → clean-JZOPMJMV.js} +21 -21
- package/dist/cli.js +58 -55
- package/dist/{cloud-OV7EA4BJ.js → cloud-VMPF2KMA.js} +4 -4
- package/dist/{cloudrun-ZEMODIOP.js → cloudrun-LA2FKS2F.js} +5 -5
- package/dist/{compare-MJZ3D3HA.js → compare-IQCFSC5Z.js} +30 -30
- package/dist/{compiler-6KKETX77.js → compiler-J7OZQIPD.js} +4 -4
- package/dist/{component-EVXMYIP3.js → component-TRGBVFCI.js} +3 -3
- package/dist/{compositions-PZ7FQ7WN.js → compositions-FOC2CAZX.js} +13 -13
- package/dist/curve-ID3Z522S.js +329 -0
- package/dist/cuts-MWHQSE2Z.js +123 -0
- package/dist/{delete-DL3XA4QV.js → delete-47KZ7PLI.js} +5 -5
- package/dist/{deploy-VEYP3IP5.js → deploy-NTNEO4TI.js} +8 -8
- package/dist/describeProject-WWREIVQV.js +56 -0
- package/dist/diff-GH4KCQGQ.js +1825 -0
- package/dist/{dist-SHMQOKMF.js → dist-24QQO5IL.js} +2 -2
- package/dist/{dist-M77KFAYW.js → dist-XW7FATO6.js} +2 -2
- package/dist/{doctor-JM2WHH7Y.js → doctor-4ZH7WFU6.js} +11 -11
- package/dist/energy-2C65KXBH.js +134 -0
- package/dist/{events-S7KVBRSL.js → events-FUFFA55P.js} +3 -3
- package/dist/{events-GW5I5RCG.js → events-Q3EBOW2Y.js} +2 -2
- package/dist/events-QO5G2VCC.js +221 -0
- package/dist/extract-Z6TLBM5B.js +309 -0
- package/dist/face-WI6BPPUG.js +171 -0
- package/dist/{feedback-7OR5FVTX.js → feedback-M5GZWDXP.js} +12 -12
- package/dist/{ffmpeg-A7CSIX3U.js → ffmpeg-27H6P7ZU.js} +7 -7
- package/dist/{figma-444HKFX5.js → figma-AI6TSWVO.js} +3 -3
- package/dist/fontLocalizeCli.js +10 -10
- package/dist/frames-WUTLVZIR.js +352 -0
- package/dist/generate-3CJREF5U.js +74 -0
- package/dist/{get-6UTF3225.js → get-KTDRE33B.js} +5 -5
- package/dist/{gpuPolicy-ORPUS5Z2.js → gpuPolicy-Z4MM64HY.js} +7 -7
- package/dist/{grade-compare-UCTAYN3B.js → grade-compare-IM7Z7HWI.js} +34 -31
- package/dist/{heifImagePrep-ED6V6RFN.js → heifImagePrep-CXI2ZMUX.js} +8 -8
- package/dist/{help-HZR32XWP.js → help-5FR6BRLR.js} +7 -1
- package/dist/{history-TQ56MZIA.js → history-5P5YVP5H.js} +7 -7
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +70 -70
- package/dist/hyperframes-player.global.js +3 -3
- package/dist/index-gen-OPMQ5WSN.js +61 -0
- package/dist/{info-RPIIP7RN.js → info-5ZGNJJVA.js} +7 -7
- package/dist/{init-ONAWKHFW.js → init-NWIAEYSX.js} +29 -28
- package/dist/{inspect-A75PYOWJ.js → inspect-HBLAVW5C.js} +31 -30
- package/dist/{installer-ISMCCFBZ.js → installer-KVFTBZZ5.js} +4 -4
- package/dist/{keyframes-2I75DP3O.js → keyframes-LFCLUY2R.js} +6 -6
- package/dist/{lambda-4QIHGPGJ.js → lambda-RFWTTMLU.js} +13 -13
- package/dist/{layout-GW7WE7RT.js → layout-WOG2Y5ND.js} +31 -30
- package/dist/{lint-OWP72OZQ.js → lint-7MALXMMF.js} +8 -8
- package/dist/{lintProject-XYQ5L7RQ.js → lintProject-6H64SX3V.js} +2 -2
- package/dist/{list-WVK7ZCPW.js → list-XRYAT24W.js} +5 -5
- package/dist/{localPage-IQWHN7BH.js → localPage-IN36JVJU.js} +7 -7
- package/dist/{login-Q5CNHYWU.js → login-32WGVGTM.js} +15 -9
- package/dist/{logout-6VFJ7WMW.js → logout-SLI6YTHI.js} +2 -2
- package/dist/look-ZWVE6JO3.js +180 -0
- package/dist/{manager-JCYVNEWH.js → manager-SFL6GLYX.js} +9 -8
- package/dist/manifest-QSJYVERU.js +49 -0
- package/dist/measure-Q74BJTRQ.js +46 -0
- package/dist/{media-treatment-M5IUP7H4.js → media-treatment-3R6DYEAZ.js} +16 -16
- package/dist/{media-use-ZNTB7W6N.js → media-use-ZM2WCRQC.js} +9 -5
- package/dist/{models-CFXKDYZ3.js → models-NNC53UPU.js} +11 -11
- package/dist/{motionShot-CWUEI4ZM.js → motionShot-5BI5JFUP.js} +15 -15
- package/dist/{normalize-QJVXFMWO.js → normalize-MBNGRVQA.js} +2 -1
- package/dist/{normalize-audio-FASY33LR.js → normalize-audio-6Z2WN56Q.js} +8 -8
- package/dist/{open-KOVVESYN.js → open-5NCEN6RC.js} +11 -11
- package/dist/{parakeetRunner-E4IP5SL4.js → parakeetRunner-DH3XKR3C.js} +13 -12
- package/dist/{pipeline-C6EZVV43.js → pipeline-CGEGQAPH.js} +10 -10
- package/dist/{play-MZJI6SMH.js → play-K37BN736.js} +23 -23
- package/dist/{policies-J5BWAZHM.js → policies-U4PFXF5E.js} +4 -2
- package/dist/{preflight-K4SPUWXP.js → preflight-CG7H3D5B.js} +8 -8
- package/dist/{present-7L7ZTG7F.js → present-KQ53DOHA.js} +18 -18
- package/dist/{preview-QGDVMR3X.js → preview-V7CYHL6U.js} +21 -21
- package/dist/probe-JVW2MPY3.js +178 -0
- package/dist/{producer-EJPNNY3E.js → producer-UD32S7PX.js} +1 -1
- package/dist/{projectConfig-EEF6OPXO.js → projectConfig-WXCB5AZE.js} +6 -6
- package/dist/{publication-5KF44AKQ.js → publication-KG4UDZRM.js} +2 -2
- package/dist/{publish-SSKWZ5TE.js → publish-MEQB543T.js} +16 -16
- package/dist/{refresh-I6ITGHKL.js → refresh-2LU4XDL7.js} +2 -2
- package/dist/{remove-background-PCL6I5SZ.js → remove-background-FSV5KQK3.js} +11 -11
- package/dist/{render-DH4UA7KW.js → render-O4S4SURS.js} +6 -6
- package/dist/{render-UPRWOGLS.js → render-SQXZAGPQ.js} +37 -37
- package/dist/{render-DRWQ6F37.js → render-SY4AXKXC.js} +33 -33
- package/dist/{render-batch-EBW5WHB5.js → render-batch-GTZQUB3H.js} +6 -6
- package/dist/renderSetupWorker.js +2 -2
- package/dist/{resolver-ZSZXNRFP.js → resolver-BQZNCVJS.js} +4 -4
- package/dist/run-67OPNJGD.js +31 -0
- package/dist/{sherpa-IKVUCBOW.js → sherpa-KH3PJAUG.js} +12 -11
- package/dist/skills/media-use/SKILL.md +20 -21
- package/dist/skills/media-use/audio/scripts/lib/heygen.mjs +26 -1
- package/dist/skills/media-use/audio/scripts/lib/heygen.test.mjs +33 -0
- package/dist/skills/media-use/references/heygen.md +58 -0
- package/dist/skills/media-use/references/operations.md +9 -6
- package/dist/skills/media-use/references/setup-providers.md +11 -12
- package/dist/skills/media-use/scripts/lib/index-gen.d.mts +1 -0
- package/dist/skills/media-use/scripts/lib/manifest.d.mts +21 -0
- package/dist/{skills-ZREHX3TU.js → skills-FTZZJGAB.js} +5 -5
- package/dist/{skillsUpdateCheck-PPJ5NGAL.js → skillsUpdateCheck-LZPD2CZI.js} +3 -3
- package/dist/{snapshot-KPFLZNEL.js → snapshot-4BORZ3ED.js} +37 -36
- package/dist/{src-QRV3466B.js → src-6ZOFAM3F.js} +9 -9
- package/dist/{src-EPOGDJTT.js → src-D7AO7PGH.js} +6 -6
- package/dist/{staticProjectServer-ERKLMZVM.js → staticProjectServer-Q23A6XU2.js} +19 -19
- package/dist/{status-4AAPTTRW.js → status-VIJRZ4ZK.js} +34 -9
- package/dist/studio/assets/hyperframes-player-D0W1SNqK.js +478 -0
- package/dist/studio/assets/{index-C8VIUiGz.js → index-DD9KJoEr.js} +119 -119
- package/dist/studio/assets/{index-CVPNbydK.js → index-mbwAH5iR.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-7WFZIIPL.js → studio-api-XVVJZ7YT.js} +15 -15
- package/dist/{studioServer-3XZTLI26.js → studioServer-6HG3AMTW.js} +49 -49
- package/dist/sync-Q5SRIL7V.js +115 -0
- package/dist/{telemetry-BMLI4TMC.js → telemetry-VXPSJ3X3.js} +3 -3
- package/dist/{timeline-EDCDO2ZR.js → timeline-6477OWFA.js} +25 -21
- package/dist/{tokens-2ZFLFO3K.js → tokens-ZUUNEDKT.js} +2 -2
- package/dist/{transcribe-3WMH62HH.js → transcribe-HA4UGLKO.js} +11 -10
- package/dist/{transcribe-Y2LPBT7I.js → transcribe-ITVANIDK.js} +35 -18
- package/dist/{tts-BVTJEP72.js → tts-KMZPHG3K.js} +1 -1
- package/dist/{updateCheck-5LFZGC3P.js → updateCheck-SVADAQ43.js} +2 -2
- package/dist/{upgrade-X7QVSEKP.js → upgrade-WKW4FDNF.js} +2 -2
- package/dist/{urlDownloader-TYD6ROKL.js → urlDownloader-VWHCESDD.js} +6 -6
- package/dist/{validate-26KQ5VX7.js → validate-7VG2RLP2.js} +24 -24
- package/dist/{video-BPKLZIJK.js → video-LM3FYHGG.js} +8 -8
- package/dist/warmCheck.js +40 -39
- package/package.json +1 -1
- package/dist/chunk-LL3VMDAC.js +0 -5013
- package/dist/studio/assets/hyperframes-player-Dka6e1BG.js +0 -478
- package/dist/{chunk-NOH32H42.js → chunk-HBAUU3IK.js} +124 -124
- package/dist/{destroy-BQ5R7LUF.js → destroy-6NWJMQX2.js} +4 -4
- package/dist/{synthesize-4JC74JW5.js → synthesize-DIT2SR3D.js} +5 -5
|
@@ -6,32 +6,39 @@ var __filename = __hf_fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
parakeetRunner
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PX7Y4HMM.js";
|
|
10
10
|
import {
|
|
11
11
|
DecodeCancelled,
|
|
12
12
|
prepareSherpaWav,
|
|
13
13
|
sherpaUnsupportedReason,
|
|
14
14
|
transcribeWithSherpa
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-M7HNGAWN.js";
|
|
16
|
+
import {
|
|
17
|
+
idempotencyKey,
|
|
18
|
+
runJob
|
|
19
|
+
} from "./chunk-NZZQCWUC.js";
|
|
20
|
+
import {
|
|
21
|
+
runFfmpeg
|
|
22
|
+
} from "./chunk-VJM6NX54.js";
|
|
16
23
|
import {
|
|
17
24
|
initialModelForLanguage,
|
|
18
25
|
transcribe
|
|
19
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-44IPXXSK.js";
|
|
20
27
|
import {
|
|
21
28
|
createRenderCancellationScope,
|
|
22
29
|
stoppedByCancelSignal
|
|
23
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-LV5AVW6U.js";
|
|
24
31
|
import {
|
|
25
32
|
DEFAULT_MODEL,
|
|
26
33
|
findWhisper,
|
|
27
34
|
isWhisperUnavailable
|
|
28
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-CXEU6XNL.js";
|
|
29
36
|
import {
|
|
30
37
|
formatSrt,
|
|
31
38
|
formatVtt,
|
|
32
39
|
loadTranscript,
|
|
33
40
|
patchCaptionHtml
|
|
34
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-54Q3H2UQ.js";
|
|
35
42
|
import {
|
|
36
43
|
PARAKEET_INSTALL_COMMAND,
|
|
37
44
|
PARAKEET_LANGUAGES,
|
|
@@ -46,8 +53,86 @@ import {
|
|
|
46
53
|
} from "./chunk-E63BDV4Z.js";
|
|
47
54
|
|
|
48
55
|
// src/api/transcribe.ts
|
|
49
|
-
import { existsSync, realpathSync, rmSync, statSync, writeFileSync } from "fs";
|
|
50
|
-
import { basename, dirname, extname, join, resolve } from "path";
|
|
56
|
+
import { existsSync, realpathSync, rmSync as rmSync2, statSync, writeFileSync as writeFileSync2 } from "fs";
|
|
57
|
+
import { basename, dirname, extname, join as join2, resolve } from "path";
|
|
58
|
+
|
|
59
|
+
// src/heygen/transcribe.ts
|
|
60
|
+
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
61
|
+
import { tmpdir } from "os";
|
|
62
|
+
import { join } from "path";
|
|
63
|
+
var ROUTE = "/v3/audio/transcriptions";
|
|
64
|
+
var MODEL = "scribe-v2";
|
|
65
|
+
var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
66
|
+
var list = (v) => Array.isArray(v) ? v.filter(isRecord) : [];
|
|
67
|
+
function wordsOf(job) {
|
|
68
|
+
return list(job.segments).flatMap(
|
|
69
|
+
(segment) => list(segment.words).flatMap((w) => {
|
|
70
|
+
const text = String(w.word ?? w.text ?? "").trim();
|
|
71
|
+
if (!text || typeof w.start !== "number" || typeof w.end !== "number") return [];
|
|
72
|
+
const speaker = w.speaker ?? segment.speaker;
|
|
73
|
+
return [
|
|
74
|
+
{
|
|
75
|
+
text,
|
|
76
|
+
start: w.start,
|
|
77
|
+
end: w.end,
|
|
78
|
+
...speaker !== void 0 ? { speaker: String(speaker) } : {}
|
|
79
|
+
}
|
|
80
|
+
];
|
|
81
|
+
})
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
async function transcribeWithHeygen(inputPath, transcriptPath, opts = {}) {
|
|
85
|
+
const work = mkdtempSync(join(tmpdir(), "hf-heygen-asr-"));
|
|
86
|
+
try {
|
|
87
|
+
opts.onStatus?.("Preparing audio for HeyGen...");
|
|
88
|
+
const mp3 = join(work, "audio.mp3");
|
|
89
|
+
runFfmpeg([
|
|
90
|
+
"-y",
|
|
91
|
+
"-i",
|
|
92
|
+
inputPath,
|
|
93
|
+
"-vn",
|
|
94
|
+
"-ac",
|
|
95
|
+
"1",
|
|
96
|
+
"-ar",
|
|
97
|
+
"16000",
|
|
98
|
+
"-c:a",
|
|
99
|
+
"libmp3lame",
|
|
100
|
+
"-b:a",
|
|
101
|
+
"64k",
|
|
102
|
+
mp3
|
|
103
|
+
]);
|
|
104
|
+
const audio = readFileSync(mp3);
|
|
105
|
+
const diarize = opts.diarize === true;
|
|
106
|
+
opts.onStatus?.("Transcribing on HeyGen...");
|
|
107
|
+
const job = await runJob(
|
|
108
|
+
ROUTE,
|
|
109
|
+
{
|
|
110
|
+
model: MODEL,
|
|
111
|
+
audio: { type: "base64", media_type: "audio/mpeg", data: audio.toString("base64") },
|
|
112
|
+
diarize
|
|
113
|
+
},
|
|
114
|
+
idempotencyKey(ROUTE, [audio, String(diarize)]),
|
|
115
|
+
(id) => `${ROUTE}/${encodeURIComponent(id)}`,
|
|
116
|
+
{
|
|
117
|
+
log: { projectDir: opts.projectDir, what: `transcribe ${inputPath}` },
|
|
118
|
+
timeoutMs: 10 * 6e4
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
const words = wordsOf(job);
|
|
122
|
+
writeFileSync(transcriptPath, JSON.stringify(words, null, 2));
|
|
123
|
+
return {
|
|
124
|
+
transcriptPath,
|
|
125
|
+
model: typeof job.model === "string" ? job.model : MODEL,
|
|
126
|
+
detectedLanguage: typeof job.language === "string" ? job.language : null,
|
|
127
|
+
durationSeconds: typeof job.duration_seconds === "number" ? job.duration_seconds : words.at(-1)?.end ?? 0,
|
|
128
|
+
speechOnsetSeconds: words[0]?.start ?? null
|
|
129
|
+
};
|
|
130
|
+
} finally {
|
|
131
|
+
rmSync(work, { recursive: true, force: true });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// src/api/transcribe.ts
|
|
51
136
|
var MIN_TIMEOUT_MS = 5e3;
|
|
52
137
|
var TranscribeError = class extends Error {
|
|
53
138
|
code;
|
|
@@ -101,8 +186,8 @@ function parseSidecar(captions, inputPath, dir) {
|
|
|
101
186
|
const to = parseExportFormat(captions?.format);
|
|
102
187
|
if (!to) return void 0;
|
|
103
188
|
const output = captions?.outputPath;
|
|
104
|
-
const outPath = resolve(output ??
|
|
105
|
-
const keep = [inputPath,
|
|
189
|
+
const outPath = resolve(output ?? join2(dir, `transcript.${to}`));
|
|
190
|
+
const keep = [inputPath, join2(dir, TRANSCRIPT_FILE)];
|
|
106
191
|
const problem = output !== void 0 && outputProblem(output, outPath, to) || overwriteProblem(outPath, keep);
|
|
107
192
|
if (problem) throw new TranscribeError("invalid_option", problem);
|
|
108
193
|
return { to, outPath, preserveCues: captions?.preserveCues === true, keep };
|
|
@@ -114,7 +199,7 @@ function outputProblem(output, outPath, to) {
|
|
|
114
199
|
return `Output folder not found: ${folder}`;
|
|
115
200
|
}
|
|
116
201
|
if (/[\\/]$/.test(output) || existsSync(outPath) && statSync(outPath).isDirectory()) {
|
|
117
|
-
return `--output is a folder; give a file path such as ${
|
|
202
|
+
return `--output is a folder; give a file path such as ${join2(outPath, `transcript.${to}`)}`;
|
|
118
203
|
}
|
|
119
204
|
return void 0;
|
|
120
205
|
}
|
|
@@ -145,8 +230,8 @@ function readTranscript(inputPath) {
|
|
|
145
230
|
}
|
|
146
231
|
function importTranscript(inputPath, dir) {
|
|
147
232
|
const { words, format } = readTranscript(inputPath);
|
|
148
|
-
const transcriptPath =
|
|
149
|
-
|
|
233
|
+
const transcriptPath = join2(dir, TRANSCRIPT_FILE);
|
|
234
|
+
writeFileSync2(transcriptPath, JSON.stringify(words, null, 2));
|
|
150
235
|
patchCaptionHtml(dir, words);
|
|
151
236
|
return { kind: "imported", format, wordCount: words.length, transcriptPath };
|
|
152
237
|
}
|
|
@@ -173,7 +258,7 @@ function writeCaptionSidecar(words, { to, outPath, preserveCues, keep }, phraseL
|
|
|
173
258
|
if (hit) throw new Error(`it is the same file as ${hit}`);
|
|
174
259
|
const preGrouped = preserveCues || phraseLevelSource;
|
|
175
260
|
const content = to === "srt" ? formatSrt(words, { preGrouped }) : formatVtt(words, { preGrouped });
|
|
176
|
-
|
|
261
|
+
writeFileSync2(outPath, content);
|
|
177
262
|
}
|
|
178
263
|
function pickRunner(engine, parakeet, language, whisperForLanguage = false) {
|
|
179
264
|
if (engine === "whisper" || whisperForLanguage || !parakeetSpeaks(language)) return "whisper";
|
|
@@ -197,12 +282,54 @@ function failureMessage(err) {
|
|
|
197
282
|
return stderr ? `${base}
|
|
198
283
|
${stderr}` : base;
|
|
199
284
|
}
|
|
285
|
+
function finishTranscript(result, engine, dir, sidecar) {
|
|
286
|
+
const { words } = loadTranscript(result.transcriptPath);
|
|
287
|
+
writeFileSync2(result.transcriptPath, JSON.stringify(words, null, 2));
|
|
288
|
+
patchCaptionHtml(dir, words);
|
|
289
|
+
if (sidecar) {
|
|
290
|
+
try {
|
|
291
|
+
writeCaptionSidecar(words, sidecar, false);
|
|
292
|
+
} catch (err) {
|
|
293
|
+
throw new TranscribeError(
|
|
294
|
+
"caption_write_failed",
|
|
295
|
+
`Transcript saved to ${result.transcriptPath}, but the caption file ${sidecar.outPath} could not be written: ${normalizeErrorMessage(err)}`,
|
|
296
|
+
{ cause: err, transcriptPath: result.transcriptPath }
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return {
|
|
301
|
+
kind: "transcribed",
|
|
302
|
+
engine,
|
|
303
|
+
model: result.model,
|
|
304
|
+
detectedLanguage: result.detectedLanguage,
|
|
305
|
+
wordCount: words.length,
|
|
306
|
+
durationSeconds: result.durationSeconds,
|
|
307
|
+
speechOnsetSeconds: result.speechOnsetSeconds,
|
|
308
|
+
transcriptPath: result.transcriptPath,
|
|
309
|
+
...sidecar && { captions: { format: sidecar.to, outputPath: sidecar.outPath } }
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
async function transcribeOnHeygen(inputPath, dir, sidecar, options) {
|
|
313
|
+
try {
|
|
314
|
+
const result = await transcribeWithHeygen(inputPath, join2(dir, TRANSCRIPT_FILE), {
|
|
315
|
+
diarize: options.speakers,
|
|
316
|
+
projectDir: dir,
|
|
317
|
+
onStatus: options.onStatus
|
|
318
|
+
});
|
|
319
|
+
return finishTranscript(result, "heygen", dir, sidecar);
|
|
320
|
+
} catch (err) {
|
|
321
|
+
if (err instanceof TranscribeError) throw err;
|
|
322
|
+
const fix = err instanceof Error && "fix" in err && typeof err.fix === "string" ? ` Fix: ${err.fix}` : "";
|
|
323
|
+
throw new TranscribeError("failed", `${normalizeErrorMessage(err)}.${fix}`, { cause: err });
|
|
324
|
+
}
|
|
325
|
+
}
|
|
200
326
|
async function transcribeAudio(inputPath, dir, sidecar, options) {
|
|
201
327
|
const engine = (options.engine ?? "auto").toLowerCase();
|
|
328
|
+
if (engine === "heygen") return transcribeOnHeygen(inputPath, dir, sidecar, options);
|
|
202
329
|
if (engine !== "auto" && engine !== "parakeet" && engine !== "whisper") {
|
|
203
330
|
throw new TranscribeError(
|
|
204
331
|
"invalid_option",
|
|
205
|
-
`Unknown --engine: ${options.engine}. Use auto, parakeet, or
|
|
332
|
+
`Unknown --engine: ${options.engine}. Use auto, parakeet, whisper, or heygen.`
|
|
206
333
|
);
|
|
207
334
|
}
|
|
208
335
|
const unsupported = sherpaUnsupportedReason();
|
|
@@ -299,31 +426,7 @@ async function transcribeAudio(inputPath, dir, sidecar, options) {
|
|
|
299
426
|
throw new Error(`${parakeetError}. The ${runner} fallback failed too: ${why}`);
|
|
300
427
|
}
|
|
301
428
|
}
|
|
302
|
-
|
|
303
|
-
writeFileSync(result.transcriptPath, JSON.stringify(words, null, 2));
|
|
304
|
-
patchCaptionHtml(dir, words);
|
|
305
|
-
if (sidecar) {
|
|
306
|
-
try {
|
|
307
|
-
writeCaptionSidecar(words, sidecar, false);
|
|
308
|
-
} catch (err) {
|
|
309
|
-
throw new TranscribeError(
|
|
310
|
-
"caption_write_failed",
|
|
311
|
-
`Transcript saved to ${result.transcriptPath}, but the caption file ${sidecar.outPath} could not be written: ${normalizeErrorMessage(err)}`,
|
|
312
|
-
{ cause: err, transcriptPath: result.transcriptPath }
|
|
313
|
-
);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
return {
|
|
317
|
-
kind: "transcribed",
|
|
318
|
-
engine: engineOf(runner),
|
|
319
|
-
model: result.model,
|
|
320
|
-
detectedLanguage: result.detectedLanguage,
|
|
321
|
-
wordCount: words.length,
|
|
322
|
-
durationSeconds: result.durationSeconds,
|
|
323
|
-
speechOnsetSeconds: result.speechOnsetSeconds,
|
|
324
|
-
transcriptPath: result.transcriptPath,
|
|
325
|
-
...sidecar && { captions: { format: sidecar.to, outputPath: sidecar.outPath } }
|
|
326
|
-
};
|
|
429
|
+
return finishTranscript(result, engineOf(runner), dir, sidecar);
|
|
327
430
|
} catch (err) {
|
|
328
431
|
if (err instanceof TranscribeError) throw err;
|
|
329
432
|
if (err instanceof DecodeCancelled || cancellation?.signal.aborted) {
|
|
@@ -337,7 +440,7 @@ async function transcribeAudio(inputPath, dir, sidecar, options) {
|
|
|
337
440
|
throw new TranscribeError("failed", message, { cause: err });
|
|
338
441
|
} finally {
|
|
339
442
|
cancellation?.dispose();
|
|
340
|
-
if (wavPath !== inputPath)
|
|
443
|
+
if (wavPath !== inputPath) rmSync2(wavPath, { force: true });
|
|
341
444
|
}
|
|
342
445
|
}
|
|
343
446
|
|
|
@@ -43,11 +43,14 @@ import {
|
|
|
43
43
|
} from "./chunk-BLBMPEBX.js";
|
|
44
44
|
import {
|
|
45
45
|
VERSION
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-P5QGZMGC.js";
|
|
47
47
|
|
|
48
48
|
// src/telemetry/transport.ts
|
|
49
49
|
import { spawn } from "child_process";
|
|
50
50
|
import { randomUUID } from "crypto";
|
|
51
|
+
import { unlinkSync, writeFileSync } from "fs";
|
|
52
|
+
import { tmpdir } from "os";
|
|
53
|
+
import { join } from "path";
|
|
51
54
|
var POSTHOG_HOST = "https://us.i.posthog.com";
|
|
52
55
|
var FLUSH_TIMEOUT_MS = 5e3;
|
|
53
56
|
var eventQueue = [];
|
|
@@ -109,17 +112,27 @@ function flushSync() {
|
|
|
109
112
|
const payload = buildPayload(eventQueue);
|
|
110
113
|
if (payload == null) return;
|
|
111
114
|
eventQueue = [];
|
|
115
|
+
const file = join(tmpdir(), `hyperframes-telemetry-${randomUUID()}.json`);
|
|
112
116
|
try {
|
|
117
|
+
writeFileSync(file, payload, { mode: 384 });
|
|
113
118
|
const child = spawn(
|
|
114
119
|
process.execPath,
|
|
115
120
|
[
|
|
116
121
|
"-e",
|
|
117
|
-
`fetch(${JSON.stringify(`${POSTHOG_HOST}/batch/`)},{method:"POST",headers:{"Content-Type":"application/json"},body
|
|
122
|
+
`const f=require("node:fs"),b=f.readFileSync(process.argv[1],"utf8");f.unlinkSync(process.argv[1]);fetch(${JSON.stringify(`${POSTHOG_HOST}/batch/`)},{method:"POST",headers:{"Content-Type":"application/json"},body:b,signal:AbortSignal.timeout(${FLUSH_TIMEOUT_MS})}).catch(()=>{})`,
|
|
123
|
+
file
|
|
118
124
|
],
|
|
119
125
|
{ detached: true, stdio: "ignore", windowsHide: true }
|
|
120
126
|
);
|
|
121
127
|
child.unref();
|
|
122
|
-
} catch {
|
|
128
|
+
} catch (error) {
|
|
129
|
+
try {
|
|
130
|
+
unlinkSync(file);
|
|
131
|
+
} catch {
|
|
132
|
+
}
|
|
133
|
+
diag.warn(
|
|
134
|
+
`hyperframes: telemetry was not sent (${error instanceof Error ? error.message : error})`
|
|
135
|
+
);
|
|
123
136
|
}
|
|
124
137
|
}
|
|
125
138
|
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { createRequire as __hf_createRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __hf_fileURLToPath } from "node:url";
|
|
3
|
+
import { dirname as __hf_dirname } from "node:path";
|
|
4
|
+
var require = __hf_createRequire(import.meta.url);
|
|
5
|
+
var __filename = __hf_fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __hf_dirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
downloadToFile
|
|
9
|
+
} from "./chunk-NO6F7CLR.js";
|
|
10
|
+
import {
|
|
11
|
+
Fix,
|
|
12
|
+
frameAt,
|
|
13
|
+
round,
|
|
14
|
+
runFfmpeg
|
|
15
|
+
} from "./chunk-VJM6NX54.js";
|
|
16
|
+
import {
|
|
17
|
+
verifies
|
|
18
|
+
} from "./chunk-RZ6CXJ56.js";
|
|
19
|
+
|
|
20
|
+
// src/measure/opencv.ts
|
|
21
|
+
import { mkdirSync, readFileSync, renameSync, rmSync } from "fs";
|
|
22
|
+
import { createRequire } from "module";
|
|
23
|
+
import { homedir } from "os";
|
|
24
|
+
import { join } from "path";
|
|
25
|
+
var VERSION = "4.10.0";
|
|
26
|
+
var OPENCV_DIR = join(homedir(), ".cache", "hyperframes", "opencv", VERSION);
|
|
27
|
+
var CASCADES = "https://raw.githubusercontent.com/opencv/opencv/4.10.0/data/haarcascades";
|
|
28
|
+
var FILES = [
|
|
29
|
+
{
|
|
30
|
+
name: "opencv.js",
|
|
31
|
+
bytes: 10378215,
|
|
32
|
+
sha256: "19b46167b59efbef9cc3836264b0b657110833e4b1df84282004b8b3141c048d",
|
|
33
|
+
url: "https://cdn.jsdelivr.net/npm/@techstark/opencv-js@4.10.0-release.1/dist/opencv.js"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "haarcascade_frontalface_alt2.xml",
|
|
37
|
+
bytes: 540616,
|
|
38
|
+
sha256: "7b0c967d9abbdfbde025eb9c786947d151b6426040d07a8f9562ed8fd90724b4",
|
|
39
|
+
url: `${CASCADES}/haarcascade_frontalface_alt2.xml`
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "haarcascade_profileface.xml",
|
|
43
|
+
bytes: 828514,
|
|
44
|
+
sha256: "b39a4a3be45539db146a7fc1d3e761a292c196eb88421185e6a615b3055e612d",
|
|
45
|
+
url: `${CASCADES}/haarcascade_profileface.xml`
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
var isCv = (v) => typeof v === "object" && v !== null && "Mat" in v && "matFromArray" in v;
|
|
49
|
+
async function ensureOpenCv(onStatus) {
|
|
50
|
+
const missing = [];
|
|
51
|
+
for (const f of FILES) if (!await verifies(join(OPENCV_DIR, f.name), f)) missing.push(f);
|
|
52
|
+
if (!missing.length) return;
|
|
53
|
+
mkdirSync(OPENCV_DIR, { recursive: true });
|
|
54
|
+
for (const f of missing) {
|
|
55
|
+
onStatus?.(`Downloading ${f.name} (${Math.round(f.bytes / 1e5) / 10} MB, once)...`);
|
|
56
|
+
const temp = join(OPENCV_DIR, `${f.name}.part-${process.pid}`);
|
|
57
|
+
try {
|
|
58
|
+
await downloadToFile(f.url, temp);
|
|
59
|
+
if (!await verifies(temp, f))
|
|
60
|
+
throw new Fix(
|
|
61
|
+
`${f.name} did not match its pinned size and sha256`,
|
|
62
|
+
"run the command again to retry the download"
|
|
63
|
+
);
|
|
64
|
+
renameSync(temp, join(OPENCV_DIR, f.name));
|
|
65
|
+
} catch (err) {
|
|
66
|
+
if (err instanceof Fix) throw err;
|
|
67
|
+
throw new Fix(
|
|
68
|
+
`could not download ${f.name} (${err instanceof Error ? err.message : String(err)})`,
|
|
69
|
+
"check the network and run the command again"
|
|
70
|
+
);
|
|
71
|
+
} finally {
|
|
72
|
+
rmSync(temp, { force: true });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
var loaded = null;
|
|
77
|
+
function loadOpenCv(onStatus) {
|
|
78
|
+
loaded ??= (async () => {
|
|
79
|
+
await ensureOpenCv(onStatus);
|
|
80
|
+
const mod = createRequire(import.meta.url)(join(OPENCV_DIR, "opencv.js"));
|
|
81
|
+
if (typeof mod !== "object" || mod === null) throw new Error("opencv.js did not load");
|
|
82
|
+
await new Promise((resolve) => {
|
|
83
|
+
if ("Mat" in mod) resolve();
|
|
84
|
+
else Object.assign(mod, { onRuntimeInitialized: () => resolve() });
|
|
85
|
+
});
|
|
86
|
+
Reflect.deleteProperty(mod, "then");
|
|
87
|
+
if (!isCv(mod)) throw new Error("opencv.js did not initialize");
|
|
88
|
+
const cv = mod;
|
|
89
|
+
for (const f of FILES.filter((x) => x.name.endsWith(".xml")))
|
|
90
|
+
cv.FS_createDataFile("/", f.name, readFileSync(join(OPENCV_DIR, f.name)), true, false, false);
|
|
91
|
+
return cv;
|
|
92
|
+
})();
|
|
93
|
+
return loaded;
|
|
94
|
+
}
|
|
95
|
+
var greyMat = (cv, px, w, h) => cv.matFromArray(h, w, cv.CV_8UC1, px);
|
|
96
|
+
|
|
97
|
+
// src/measure/face.ts
|
|
98
|
+
var FACE_HOLDS = 0.25;
|
|
99
|
+
var FACE_SLIDES = 0.15;
|
|
100
|
+
var FACE_FLOOR = 0.06;
|
|
101
|
+
var FACE_MIN = 0.04;
|
|
102
|
+
var WORK_W = 960;
|
|
103
|
+
var STEP = 1.1;
|
|
104
|
+
var WINDOW_PX = 20;
|
|
105
|
+
var RUN_S = 2;
|
|
106
|
+
var ORDER = ["fail", "unmeasured", "warn", "pass"];
|
|
107
|
+
function faceVerdict(height, cast = false) {
|
|
108
|
+
if (height === null) return "unmeasured";
|
|
109
|
+
if (height >= FACE_HOLDS) return "pass";
|
|
110
|
+
return height < (cast ? FACE_SLIDES : FACE_FLOOR) ? "fail" : "warn";
|
|
111
|
+
}
|
|
112
|
+
function sampleFrames(fps, start, end, samples) {
|
|
113
|
+
const k0 = frameAt(start, fps);
|
|
114
|
+
const k1 = Math.max(k0, Math.ceil(end * fps - 1e-6) - 1);
|
|
115
|
+
const n = Math.min(samples, k1 - k0 + 1);
|
|
116
|
+
return [
|
|
117
|
+
...new Set(
|
|
118
|
+
Array.from({ length: n }, (_, i) => k0 + Math.round(i * (k1 - k0) / Math.max(1, n - 1)))
|
|
119
|
+
)
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
function minWindow(h, share) {
|
|
123
|
+
const steps = Math.floor(Math.log(Math.max(1, share * h / WINDOW_PX)) / Math.log(STEP) + 1e-9);
|
|
124
|
+
return Math.round(WINDOW_PX * STEP ** steps);
|
|
125
|
+
}
|
|
126
|
+
function readSamples(info, ks, w, h) {
|
|
127
|
+
const runs = [];
|
|
128
|
+
for (const k of ks) {
|
|
129
|
+
const run = runs.at(-1);
|
|
130
|
+
if (run && (info.vfr || (k - run.at(-1)) / info.fps <= RUN_S)) run.push(k);
|
|
131
|
+
else runs.push([k]);
|
|
132
|
+
}
|
|
133
|
+
const size = w * h;
|
|
134
|
+
return runs.flatMap((run) => {
|
|
135
|
+
const k0 = info.vfr ? 0 : run[0];
|
|
136
|
+
const seek = k0 > 0 ? ["-ss", ((k0 - 0.5) / info.fps).toFixed(6)] : [];
|
|
137
|
+
const filters = [
|
|
138
|
+
`select=${run.map((k) => `eq(n\\,${k - k0})`).join("+")}`,
|
|
139
|
+
...w !== info.width || h !== info.height ? [`scale=${w}:${h}`] : [],
|
|
140
|
+
"format=gray"
|
|
141
|
+
];
|
|
142
|
+
const raw = runFfmpeg([
|
|
143
|
+
...seek,
|
|
144
|
+
"-i",
|
|
145
|
+
info.path,
|
|
146
|
+
"-an",
|
|
147
|
+
"-vf",
|
|
148
|
+
filters.join(","),
|
|
149
|
+
"-fps_mode",
|
|
150
|
+
"passthrough",
|
|
151
|
+
"-frames:v",
|
|
152
|
+
String(run.length),
|
|
153
|
+
"-f",
|
|
154
|
+
"rawvideo",
|
|
155
|
+
"-"
|
|
156
|
+
]);
|
|
157
|
+
const frames = [];
|
|
158
|
+
for (let i = 0; i + size <= raw.length; i += size) frames.push(raw.subarray(i, i + size));
|
|
159
|
+
return frames;
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
async function faceBoxes(info, start, end, samples, opts = {}) {
|
|
163
|
+
const cv = await loadOpenCv((m) => console.error(m));
|
|
164
|
+
const ks = sampleFrames(info.fps, start, end, samples);
|
|
165
|
+
const w = Math.min(WORK_W, info.width);
|
|
166
|
+
const h = w === info.width ? info.height : Math.max(2, Math.round(info.height * w / info.width / 2) * 2);
|
|
167
|
+
const frames = readSamples(info, ks, w, h);
|
|
168
|
+
const min = minWindow(h, opts.minFace ?? FACE_MIN);
|
|
169
|
+
const cascades = ["haarcascade_frontalface_alt2.xml", "haarcascade_profileface.xml"].map(
|
|
170
|
+
(name) => {
|
|
171
|
+
const c = new cv.CascadeClassifier();
|
|
172
|
+
c.load(name);
|
|
173
|
+
return c;
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
try {
|
|
177
|
+
return frames.map((px, i) => {
|
|
178
|
+
const gray = greyMat(cv, px, w, h);
|
|
179
|
+
const boxes = [];
|
|
180
|
+
try {
|
|
181
|
+
for (const c of cascades) {
|
|
182
|
+
const found = new cv.RectVector();
|
|
183
|
+
c.detectMultiScale(gray, found, STEP, 5, 0, new cv.Size(min, min));
|
|
184
|
+
for (let j = 0; j < found.size(); j++) {
|
|
185
|
+
const r = found.get(j);
|
|
186
|
+
boxes.push([r.x / w, r.y / h, r.width / w, r.height / h]);
|
|
187
|
+
}
|
|
188
|
+
found.delete();
|
|
189
|
+
}
|
|
190
|
+
} finally {
|
|
191
|
+
gray.delete();
|
|
192
|
+
}
|
|
193
|
+
return { frame: ks[i], t: round(ks[i] / info.fps, 3), boxes };
|
|
194
|
+
});
|
|
195
|
+
} finally {
|
|
196
|
+
for (const c of cascades) c.delete();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function subjectFace(boxes, cast = false) {
|
|
200
|
+
return boxes.reduce(
|
|
201
|
+
(a, b) => !a || (cast ? b[3] < a[3] : b[3] > a[3]) ? b : a,
|
|
202
|
+
null
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
function faceSummary(samples, cast = false) {
|
|
206
|
+
const pick = (boxes) => subjectFace(boxes, cast);
|
|
207
|
+
const seen = samples.flatMap((s) => {
|
|
208
|
+
const b = pick(s.boxes);
|
|
209
|
+
return b ? [{ t: s.t, box: b.map((v) => round(v, 4)) }] : [];
|
|
210
|
+
});
|
|
211
|
+
const heights = seen.map((s) => s.box[3]).sort((a, b) => a - b);
|
|
212
|
+
const height = heights.length ? heights[heights.length >> 1] : null;
|
|
213
|
+
const lastFace = pick(samples.at(-1)?.boxes ?? []);
|
|
214
|
+
const last = lastFace ? lastFace[3] : null;
|
|
215
|
+
const verdicts = [faceVerdict(height, cast), faceVerdict(last, cast)];
|
|
216
|
+
return {
|
|
217
|
+
frames_sampled: samples.length,
|
|
218
|
+
frames_with_face: seen.length,
|
|
219
|
+
face_height: height === null ? null : round(height, 3),
|
|
220
|
+
last_face_height: last === null ? null : round(last, 3),
|
|
221
|
+
verdict: verdicts.reduce((a, b) => ORDER.indexOf(b) < ORDER.indexOf(a) ? b : a),
|
|
222
|
+
bands: { pass: FACE_HOLDS, cast_fail_below: FACE_SLIDES, fail_below: FACE_FLOOR },
|
|
223
|
+
boxes: seen,
|
|
224
|
+
...last === null ? {
|
|
225
|
+
note: "no face at the last sampled frame (turned away, covered or missed): look at the frames"
|
|
226
|
+
} : {}
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
var median = (v) => [...v].sort((x, y) => x - y)[v.length >> 1];
|
|
230
|
+
var FIT_MIN_FACES = 2;
|
|
231
|
+
var PAIR_S = 0.1;
|
|
232
|
+
function againstStart(clipDuration, originalDuration, from) {
|
|
233
|
+
return Math.abs(clipDuration - originalDuration) <= 0.5 ? from : 0;
|
|
234
|
+
}
|
|
235
|
+
function faceFit(original, clip, canvas, clipSize, cast = false) {
|
|
236
|
+
const pairs = original.flatMap((o2) => {
|
|
237
|
+
const near = clip.reduce(
|
|
238
|
+
(p, q) => !p || Math.abs(q.t - o2.t) < Math.abs(p.t - o2.t) ? q : p,
|
|
239
|
+
null
|
|
240
|
+
);
|
|
241
|
+
if (!near || Math.abs(near.t - o2.t) > PAIR_S) return [];
|
|
242
|
+
const [a, b] = [subjectFace(o2.boxes, cast), subjectFace(near.boxes, cast)];
|
|
243
|
+
return a && b ? [{ a, b }] : [];
|
|
244
|
+
});
|
|
245
|
+
if (pairs.length < FIT_MIN_FACES) return { moments: pairs.length, transform: null };
|
|
246
|
+
const { width: W, height: H } = canvas;
|
|
247
|
+
const s0 = Math.max(W / clipSize.width, H / clipSize.height);
|
|
248
|
+
const [cw, ch] = [clipSize.width * s0, clipSize.height * s0];
|
|
249
|
+
const [ox, oy] = [(W - cw) / 2, (H - ch) / 2];
|
|
250
|
+
const face = (b, w, h, x0, y0) => ({
|
|
251
|
+
x: x0 + (b[0] + b[2] / 2) * w,
|
|
252
|
+
y: y0 + (b[1] + b[3] / 2) * h,
|
|
253
|
+
h: b[3] * h
|
|
254
|
+
});
|
|
255
|
+
const os = pairs.map((p) => face(p.a, W, H, 0, 0));
|
|
256
|
+
const cs = pairs.map((p) => face(p.b, cw, ch, ox, oy));
|
|
257
|
+
const mid = (v) => ({
|
|
258
|
+
x: median(v.map((f) => f.x)),
|
|
259
|
+
y: median(v.map((f) => f.y)),
|
|
260
|
+
h: median(v.map((f) => f.h))
|
|
261
|
+
});
|
|
262
|
+
const [o, c] = [mid(os), mid(cs)];
|
|
263
|
+
const scale = o.h / c.h;
|
|
264
|
+
const x = o.x - (W / 2 + scale * (c.x - W / 2));
|
|
265
|
+
const y = o.y - (H / 2 + scale * (c.y - H / 2));
|
|
266
|
+
const residual = median(
|
|
267
|
+
pairs.map((_, i) => {
|
|
268
|
+
const [p, q] = [os[i], cs[i]];
|
|
269
|
+
const [mx, my] = [W / 2 + scale * (q.x - W / 2) + x, H / 2 + scale * (q.y - H / 2) + y];
|
|
270
|
+
return Math.hypot(mx - p.x, my - p.y) / p.h;
|
|
271
|
+
})
|
|
272
|
+
);
|
|
273
|
+
return {
|
|
274
|
+
moments: pairs.length,
|
|
275
|
+
transform: { scale: round(scale, 3), x: round(x, 1), y: round(y, 1) },
|
|
276
|
+
original_face: { centre: [round(o.x, 1), round(o.y, 1)], height: round(o.h, 1) },
|
|
277
|
+
clip_face: { centre: [round(c.x, 1), round(c.y, 1)], height: round(c.h, 1) },
|
|
278
|
+
residual: round(residual, 3)
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export {
|
|
283
|
+
faceBoxes,
|
|
284
|
+
faceSummary,
|
|
285
|
+
FIT_MIN_FACES,
|
|
286
|
+
againstStart,
|
|
287
|
+
faceFit
|
|
288
|
+
};
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
renderFrameIdForRenderId,
|
|
43
43
|
resolveAuthoredTimingWindow,
|
|
44
44
|
toFps
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-OWFSGDQS.js";
|
|
46
46
|
import {
|
|
47
47
|
AUDIO_GROUP_RENDER_ID_ATTR,
|
|
48
48
|
AUTHORED_SOURCE_BEGIN,
|
|
@@ -85,7 +85,7 @@ import {
|
|
|
85
85
|
sourceTimeAt,
|
|
86
86
|
timeAtSourceTime,
|
|
87
87
|
volumeSegmentSampleCount
|
|
88
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-UQECNXFA.js";
|
|
89
89
|
import {
|
|
90
90
|
redactTelemetryString,
|
|
91
91
|
redactUrlQueryStrings
|
|
@@ -103,7 +103,7 @@ import {
|
|
|
103
103
|
} from "./chunk-WE42NVH7.js";
|
|
104
104
|
import {
|
|
105
105
|
resolveReferencedStart
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-HT3D5AKG.js";
|
|
107
107
|
import {
|
|
108
108
|
FFMPEG_PATH_ENV,
|
|
109
109
|
FFPROBE_PATH_ENV,
|
|
@@ -4,6 +4,9 @@ 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
|
+
readJsonFileText
|
|
9
|
+
} from "./chunk-EHZESMRB.js";
|
|
7
10
|
import {
|
|
8
11
|
parseHTML
|
|
9
12
|
} from "./chunk-GWTIFRF5.js";
|
|
@@ -16,7 +19,7 @@ function detectFormat(filePath) {
|
|
|
16
19
|
const ext = extname(filePath).toLowerCase();
|
|
17
20
|
if (ext === ".srt") return "srt";
|
|
18
21
|
if (ext === ".vtt") return "vtt";
|
|
19
|
-
if (ext === ".json") return detectJsonFormat(JSON.parse(
|
|
22
|
+
if (ext === ".json") return detectJsonFormat(JSON.parse(readJsonFileText(filePath)));
|
|
20
23
|
throw new Error(`Unsupported transcript file extension: ${ext}. Use .json, .srt, or .vtt`);
|
|
21
24
|
}
|
|
22
25
|
function detectJsonFormat(raw) {
|
|
@@ -288,7 +291,7 @@ ${cue.text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")}`
|
|
|
288
291
|
}
|
|
289
292
|
function loadTranscript(filePath) {
|
|
290
293
|
const ext = extname(filePath).toLowerCase();
|
|
291
|
-
const content =
|
|
294
|
+
const content = readJsonFileText(filePath);
|
|
292
295
|
if (ext === ".srt") {
|
|
293
296
|
const words2 = parseSrt(content).map((w, i) => ({ ...w, id: w.id ?? `w${i}` }));
|
|
294
297
|
return { words: words2, format: "srt" };
|