hyperframes 0.8.201 → 0.8.203
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-33XNCMY4.js → add-HVWZZBVO.js} +15 -13
- package/dist/{animatedGifPrep-MI7Z4OYQ.js → animatedGifPrep-7SQD4XQY.js} +11 -9
- package/dist/api.js +23 -21
- package/dist/{asset-RMRQN24O.js → asset-H2D5ENJ6.js} +4 -3
- package/dist/{assetCataloger-KWTQNFUU.js → assetCataloger-PIRQXMHM.js} +11 -9
- package/dist/{audio-SQDZZS6X.js → audio-F6TTYCGR.js} +21 -19
- package/dist/{auth-PNC6K5ZD.js → auth-HK5IYSNR.js} +1 -1
- package/dist/{autoUpdate-MBZFLUF2.js → autoUpdate-DQMCXE6X.js} +2 -2
- package/dist/{backgroundChecks-ZMSPA6TK.js → backgroundChecks-Y466WV7Y.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-2MMOZRMW.js → batchRender-PGJELR2B.js} +8 -6
- package/dist/{beats-GDLNPR4A.js → beats-AD2IJGBZ.js} +13 -11
- package/dist/{benchmark-AUKB3XDF.js → benchmark-B564OTLO.js} +12 -10
- package/dist/{browser-C3AU5TST.js → browser-B7BELTLZ.js} +3 -3
- package/dist/{bundleWithLocalizedFonts-G3UT65XI.js → bundleWithLocalizedFonts-INYZKCJN.js} +4 -4
- package/dist/{capture-XGBPNGC5.js → capture-LKV2HS5Q.js} +2 -2
- package/dist/{capture-EKNPCFPF.js → capture-VMJVXQJ2.js} +14 -12
- package/dist/{captureCompositionFrame-4HHLPTDH.js → captureCompositionFrame-L2W6KSAL.js} +16 -15
- package/dist/{catalog-HLDNEJX3.js → catalog-5ETWOAL2.js} +15 -13
- package/dist/{catch-up-LRFV4LJO.js → catch-up-3RWU3BRJ.js} +4 -4
- package/dist/{check-XWHWGNYE.js → check-KD57MC5Z.js} +40 -39
- package/dist/{checkBrowser-KSOBXPJ3.js → checkBrowser-R72NYI4S.js} +36 -33
- package/dist/{chunk-ZDVJXWEG.js → chunk-2G6EI3WQ.js} +3 -3
- package/dist/chunk-2RY2LWAA.js +3466 -0
- package/dist/{chunk-TOT3CLUK.js → chunk-32SIPBON.js} +1 -1
- package/dist/{chunk-47NZWTJL.js → chunk-35KHQKEX.js} +5 -5
- package/dist/{chunk-B7CYKBXQ.js → chunk-3CISA3OS.js} +1 -1
- package/dist/{chunk-XONIZ5CH.js → chunk-3NUFUEAX.js} +235 -38
- package/dist/{chunk-GKXH4C2B.js → chunk-3YZ2ESXP.js} +5 -6
- package/dist/chunk-42DLVZNO.js +3983 -0
- package/dist/{chunk-B67P2WP3.js → chunk-4GV742H2.js} +2 -2
- package/dist/{chunk-WO3XZ6HC.js → chunk-5GFNMC2F.js} +2 -2
- package/dist/{chunk-CFUCHO4T.js → chunk-6MUI2H6P.js} +1 -1
- package/dist/{chunk-IFOZZYHK.js → chunk-7RQXBL4L.js} +8 -8
- package/dist/{chunk-JOI7TNCX.js → chunk-7SNVSO4A.js} +1 -1
- package/dist/{chunk-K2AUGELJ.js → chunk-AII6P2TC.js} +1 -1
- package/dist/{chunk-U2EK5MFR.js → chunk-B7MRZJOW.js} +9 -9
- package/dist/{chunk-6XGO7ZKS.js → chunk-BD3LJRJT.js} +1 -1
- package/dist/{chunk-RVKJDAYE.js → chunk-CAHZZOEC.js} +1 -1
- package/dist/{chunk-X72DJZCM.js → chunk-CFFPH6D3.js} +1 -1
- package/dist/{chunk-3J5KO4EJ.js → chunk-CTNWZASM.js} +5 -5
- package/dist/{chunk-YTBE4JCX.js → chunk-DO2OTFCJ.js} +2 -2
- package/dist/{chunk-GNX3BCQP.js → chunk-DZZ6VHPY.js} +1 -1
- package/dist/{chunk-SEAHCCQ4.js → chunk-E3LRVXM2.js} +3 -3
- package/dist/{chunk-FDWN4XAD.js → chunk-EUFBE5BW.js} +2 -2
- package/dist/{chunk-UIIGEPYY.js → chunk-FE72SB2F.js} +2 -2
- package/dist/chunk-FR7YBU3H.js +179 -0
- package/dist/{chunk-74UH2KGI.js → chunk-FRXPZCEP.js} +7 -3
- package/dist/{chunk-Q6SHXSZX.js → chunk-FTARAZAL.js} +1 -1
- package/dist/{chunk-GC6N2LH5.js → chunk-GOPGJXEQ.js} +7 -7
- package/dist/{chunk-ITJAHKYO.js → chunk-GOWNPWCJ.js} +1 -1
- package/dist/{chunk-SDYDNHEE.js → chunk-GWTIFRF5.js} +262 -3711
- package/dist/{chunk-I4DHHX7E.js → chunk-GX4CEJCX.js} +3 -3
- package/dist/{chunk-IHQBTZHE.js → chunk-H6NXL4VB.js} +1 -1
- package/dist/{chunk-53E45AKI.js → chunk-HAKKV3SY.js} +22 -13
- package/dist/{chunk-VCVUEK65.js → chunk-HO2N4UWV.js} +2 -2
- package/dist/{chunk-SIZYTGG4.js → chunk-HOQNNE3I.js} +1 -1
- package/dist/{chunk-YBJECXQJ.js → chunk-HYMW42OE.js} +3 -3
- package/dist/{chunk-CV32PRH3.js → chunk-IDASYE4U.js} +5 -3
- package/dist/{chunk-TYRDDIIH.js → chunk-IREQUN2P.js} +1 -1
- package/dist/{chunk-7EJ7OZGC.js → chunk-JEFIEL6S.js} +1 -1
- package/dist/{chunk-6UFEOVR5.js → chunk-JKUVH7BF.js} +1 -1
- package/dist/{chunk-QTWSMJ22.js → chunk-JVWPKIVV.js} +13 -13
- package/dist/{chunk-UKB62QOT.js → chunk-KBCV6BHL.js} +5 -5
- package/dist/{chunk-Q537KXWA.js → chunk-KWQWEY6F.js} +298 -92
- package/dist/chunk-ML7IPYOC.js +39 -0
- package/dist/{chunk-2FA53V5S.js → chunk-MPGJNUML.js} +2 -2
- package/dist/{chunk-UOSTDTBF.js → chunk-ND5ELD7A.js} +1 -1
- package/dist/{chunk-SZNCAINN.js → chunk-OKRH4JU3.js} +1 -1
- package/dist/{chunk-QYTGUWNF.js → chunk-OKZZWUZN.js} +1 -1
- package/dist/{chunk-6BNTGNGD.js → chunk-PBNWRWKA.js} +1 -1
- package/dist/{chunk-57GN6KWT.js → chunk-PLGGKTCB.js} +15 -1
- package/dist/{chunk-LVEXHBSH.js → chunk-Q6B7MFTU.js} +1 -1
- package/dist/{chunk-XG365L6T.js → chunk-R36C6H32.js} +1 -1
- package/dist/{chunk-SGKG7DNX.js → chunk-RUVO77RK.js} +3 -3
- package/dist/{chunk-DWULQYOQ.js → chunk-RWHMKGJA.js} +3 -3
- package/dist/{chunk-T33GLS6C.js → chunk-RZAPLMVM.js} +3 -3
- package/dist/{chunk-MSGWR7WP.js → chunk-SVVAUJPL.js} +33 -83
- package/dist/{chunk-ORMTNJBS.js → chunk-TMIX2WQL.js} +3 -3
- package/dist/{chunk-VF2VMKNI.js → chunk-TRDUMOUW.js} +3 -3
- package/dist/{chunk-A7YO6YSD.js → chunk-TT6HSBYK.js} +5 -5
- package/dist/{chunk-VKTUZP7U.js → chunk-TVC4EI2W.js} +1 -1
- package/dist/{chunk-QXBZ6VBL.js → chunk-TZKMAQOY.js} +2 -2
- package/dist/{chunk-AK2MOAJY.js → chunk-UNBGZQZ6.js} +21 -18
- package/dist/{chunk-IDRUJFT4.js → chunk-UVV2DKZR.js} +2 -2
- package/dist/{chunk-DS3XITZ5.js → chunk-VI7GBPF6.js} +2 -2
- package/dist/{chunk-L33EDCSR.js → chunk-VL5ES6ZM.js} +6 -6
- package/dist/{chunk-TAXGZAXM.js → chunk-VYFMJ2HM.js} +23 -20
- package/dist/{chunk-7WEGIXI3.js → chunk-WGZOPGHX.js} +1 -1
- package/dist/{chunk-IIH24PKY.js → chunk-X5PKA5KH.js} +2 -2
- package/dist/{chunk-CD5ZU6PN.js → chunk-YJKSLCKV.js} +5 -5
- package/dist/{chunk-XHVQIOOF.js → chunk-YOLS2E5P.js} +156 -24
- package/dist/{chunk-442JNXRM.js → chunk-ZBAF6L74.js} +1 -1
- package/dist/{clean-EUKURSX2.js → clean-7OBS6NMK.js} +20 -18
- package/dist/cli.js +53 -53
- package/dist/{cloud-LJDRNQ2N.js → cloud-JFL6IMUV.js} +4 -4
- package/dist/{cloudrun-AXVFD6KV.js → cloudrun-GHA4FXS3.js} +10 -8
- package/dist/{compare-T3LMATAF.js → compare-UFTPPNLD.js} +31 -30
- package/dist/{compiler-KH6DMHIJ.js → compiler-6LUGBYWD.js} +8 -6
- package/dist/{component-2FOHCMP2.js → component-4W3MT53Y.js} +5 -4
- package/dist/{compositions-REQ6ARAO.js → compositions-63M4AHPA.js} +18 -16
- package/dist/{delete-KEPP2QAZ.js → delete-XCSORSYR.js} +2 -2
- package/dist/{deploy-N756FEME.js → deploy-JUC2BVCE.js} +72 -20
- package/dist/{deterministicFonts-4FULD3AS.js → deterministicFonts-HQYCUUAL.js} +5 -3
- package/dist/{dist-TFHABY7N.js → dist-6JMYDD7F.js} +4 -3
- package/dist/{dist-5ULOGA6A.js → dist-SOMNYPEE.js} +12 -4
- package/dist/{doctor-2SJPC4WZ.js → doctor-LZ5KMUGS.js} +15 -13
- package/dist/{dom-37K6YOH4.js → dom-VFHEO7VM.js} +3 -2
- package/dist/{events-24ZE2PKB.js → events-DSJDLP3V.js} +3 -3
- package/dist/{events-U53QH4XZ.js → events-XN26WXN3.js} +2 -2
- package/dist/{feedback-QFMLDLUN.js → feedback-VZZT77OU.js} +11 -9
- package/dist/{ffmpeg-7XNWNO7M.js → ffmpeg-TU5BPXP6.js} +11 -9
- package/dist/{figma-B4JO44CV.js → figma-BYBMKBNS.js} +3 -3
- package/dist/fontLocalizeCli.js +15 -13
- package/dist/{get-7CFVCINR.js → get-JAKXQVNF.js} +2 -2
- package/dist/{gpuPolicy-MU7CFSAF.js → gpuPolicy-A6BRKFTK.js} +11 -9
- package/dist/{grade-compare-Q23U2HGS.js → grade-compare-6TLS63GE.js} +32 -31
- package/dist/{help-M67MEDV3.js → help-WMABNXSF.js} +1 -1
- package/dist/{history-I2PZXOFL.js → history-PNOTK4KM.js} +6 -6
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +65 -65
- package/dist/hyperframes-player.global.js +1 -1
- package/dist/{info-Z2MX54IE.js → info-457IZRNA.js} +14 -12
- package/dist/{init-SWH5KZO2.js → init-QNOPZRQJ.js} +32 -30
- package/dist/{inspect-WBBDB3YS.js → inspect-4PECXE65.js} +32 -31
- package/dist/inspection.js +2088 -0
- package/dist/{installer-DQIHGUBJ.js → installer-K6VCZN74.js} +8 -6
- package/dist/{keyframes-PSNEUS6P.js → keyframes-KBR4RHQO.js} +12 -11
- package/dist/{lambda-KSZFMQ3L.js → lambda-FSC3XJOQ.js} +26 -12
- package/dist/{layout-AAOI7W2M.js → layout-PFXAKL65.js} +32 -31
- package/dist/{lint-GGNVITIK.js → lint-MR7WHCBO.js} +10 -9
- package/dist/{lintProject-Q36Y3AHA.js → lintProject-4IVYXS5J.js} +4 -3
- package/dist/{list-OFPDL2AM.js → list-OCSE7GSX.js} +2 -2
- package/dist/live-LAHBXVK2.js +4165 -0
- package/dist/{login-MZAHGGP4.js → login-M4L3MHVL.js} +4 -4
- package/dist/{manager-ZOFTZTRY.js → manager-G6G2WQU3.js} +12 -10
- package/dist/{media-treatment-PF67GSUD.js → media-treatment-6ATFI5M2.js} +18 -16
- package/dist/{models-WR7CL54R.js → models-NPSWNLVS.js} +15 -13
- package/dist/{motionShot-ISLDWLIU.js → motionShot-HVPC2V7Q.js} +19 -18
- package/dist/{normalize-FASIPBUM.js → normalize-QJVXFMWO.js} +3 -2
- package/dist/{normalize-audio-D7AH5GFZ.js → normalize-audio-YEEAY2TB.js} +13 -11
- package/dist/{open-HPVBB2CX.js → open-6LSE4QDQ.js} +15 -13
- package/dist/{parakeetRunner-P6PE4WXG.js → parakeetRunner-HMDK2MEQ.js} +16 -14
- package/dist/{pipeline-XKBZG2CM.js → pipeline-GQV2DL2T.js} +12 -10
- package/dist/{play-QXHO47ZH.js → play-NORPMDGV.js} +23 -21
- package/dist/{preflight-KZCU66ES.js → preflight-SDPP63GU.js} +12 -10
- package/dist/{present-ERGC5PR4.js → present-BVPAEHE6.js} +19 -17
- package/dist/{preview-AGTOQIE7.js → preview-C762R2VY.js} +22 -20
- package/dist/{producer-4ONVM5A2.js → producer-XXFVYAW6.js} +1 -1
- package/dist/{projectConfig-7T4VY6RJ.js → projectConfig-72HEHSHM.js} +10 -8
- package/dist/{publication-J5TS5VR3.js → publication-QOK2NB7H.js} +6 -4
- package/dist/{publish-BSOVXRF4.js → publish-OVCPM2R4.js} +14 -12
- package/dist/{remove-background-645NVCGL.js → remove-background-BK7G24LO.js} +13 -11
- package/dist/{render-55TYPJ5U.js → render-3RV5ZZHB.js} +20 -16
- package/dist/{render-R3L44QAP.js → render-BA4DJGH2.js} +34 -32
- package/dist/{render-IAVH33YG.js → render-KCRWPUSH.js} +20 -18
- package/dist/{render-batch-JWWLQ7ZC.js → render-batch-EKMNALAK.js} +20 -16
- package/dist/renderSetupWorker.js +4 -3
- package/dist/{resolver-DBAFWC4F.js → resolver-ZQAEKX2N.js} +8 -6
- package/dist/{sherpa-UPWG6TKY.js → sherpa-UPEEZCVJ.js} +15 -13
- package/dist/skills/hyperframes-cli/references/lambda.md +1 -0
- package/dist/{skills-ILH52UL4.js → skills-EBCABDEA.js} +5 -5
- package/dist/{skillsUpdateCheck-ZHFDGMEL.js → skillsUpdateCheck-2TBQ3R7X.js} +3 -3
- package/dist/{snapshot-WMVHIQVQ.js → snapshot-KRDQ6UFY.js} +37 -36
- package/dist/{src-HPLELQRK.js → src-FMPMLWOE.js} +10 -8
- package/dist/{src-46QTOHZE.js → src-HODRARUH.js} +16 -14
- package/dist/{staticProjectServer-FHP2YQFV.js → staticProjectServer-NBWPYBIH.js} +20 -19
- package/dist/studio/assets/{hyperframes-player-BNeO6YSP.js → hyperframes-player-C3pgGOtp.js} +1 -1
- package/dist/studio/assets/{index-DiNYtcMK.js → index-5EFQxr70.js} +1 -1
- package/dist/studio/assets/{index-CZWE0FI8.js → index-BbcMyD3j.js} +120 -120
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-5YHQ4Y2D.js → studio-api-BOV2DTPC.js} +13 -11
- package/dist/{studioServer-P6IC76SV.js → studioServer-TSKSIQC3.js} +51 -50
- package/dist/{telemetry-WZ7OGFWQ.js → telemetry-RLKGEBGR.js} +3 -3
- package/dist/{timeline-U6S7BGMI.js → timeline-ADFTKSNX.js} +24 -22
- package/dist/{tokens-FPUYNZSV.js → tokens-2NKS4KAO.js} +4 -3
- package/dist/{transcribe-DZHTKXI5.js → transcribe-63XQBLF3.js} +14 -12
- package/dist/{transcribe-DJX4E2PE.js → transcribe-AHNMYPY4.js} +21 -19
- package/dist/{updateCheck-2LHWRDE7.js → updateCheck-XDYXIVKF.js} +2 -2
- package/dist/{upgrade-WAQHCAUS.js → upgrade-GK2RSMPV.js} +2 -2
- package/dist/{urlDownloader-HZQPXQET.js → urlDownloader-X2B7NQSQ.js} +10 -8
- package/dist/{validate-D6XJ7OSS.js → validate-UN4RB6KN.js} +26 -25
- package/dist/{video-A4CQ4WDL.js → video-QRWQLU5O.js} +11 -9
- package/dist/warmCheck.js +40 -39
- package/package.json +2 -2
- package/dist/chunk-JXLHLR26.js +0 -40
- package/dist/chunk-ZKHXN2BV.js +0 -3983
|
@@ -14,11 +14,11 @@ import {
|
|
|
14
14
|
hdrToSdrToneMapFilter,
|
|
15
15
|
isHeavyForPreview,
|
|
16
16
|
parseFirstFrameColour
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-FRXPZCEP.js";
|
|
18
18
|
import {
|
|
19
19
|
decodeAuthoredAttribute,
|
|
20
20
|
scanHtmlOpeningTags
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-SVVAUJPL.js";
|
|
22
22
|
import {
|
|
23
23
|
mkdirWithinProject,
|
|
24
24
|
realProjectRoot,
|
|
@@ -32,12 +32,12 @@ import {
|
|
|
32
32
|
isRemoteOrInlineUrl,
|
|
33
33
|
isUnresolvedAssetPlaceholder,
|
|
34
34
|
resolveExistingLocalAsset
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-PBNWRWKA.js";
|
|
36
36
|
import {
|
|
37
37
|
rewriteAssetPath
|
|
38
38
|
} from "./chunk-2BGOB2QK.js";
|
|
39
39
|
|
|
40
|
-
// ../studio-server/dist/chunk-
|
|
40
|
+
// ../studio-server/dist/chunk-JKPLDWAB.js
|
|
41
41
|
import { statSync } from "fs";
|
|
42
42
|
import { sep } from "path";
|
|
43
43
|
import { execFile } from "child_process";
|
|
@@ -141,6 +141,30 @@ function sourceFactsOf(stream, formatBitrate) {
|
|
|
141
141
|
bitrate: Number.isFinite(bitrate) ? bitrate : 0
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
+
var STREAM_SUMMARY_MAX = 12;
|
|
145
|
+
function summarizeStream(stream) {
|
|
146
|
+
const flags = Object.entries(stream.disposition ?? {}).filter(([, on]) => on === 1).map(([name]) => name);
|
|
147
|
+
return `${stream.codec_type ?? "?"}:${stream.codec_name ?? "?"}[${flags.join(",")}]`;
|
|
148
|
+
}
|
|
149
|
+
function metadataFromProbe(kind, parsed) {
|
|
150
|
+
const stream = parsed.streams?.find((item) => {
|
|
151
|
+
if (kind === "image") return item.codec_type === "video";
|
|
152
|
+
return item.codec_type === kind && item.disposition?.attached_pic !== 1;
|
|
153
|
+
});
|
|
154
|
+
const metadata = {
|
|
155
|
+
kind,
|
|
156
|
+
color: classifyMediaColor(stream),
|
|
157
|
+
streams: (parsed.streams ?? []).slice(0, STREAM_SUMMARY_MAX).map(summarizeStream)
|
|
158
|
+
};
|
|
159
|
+
if (kind === "video") {
|
|
160
|
+
metadata.hasAudio = (parsed.streams ?? []).some((item) => item.codec_type === "audio");
|
|
161
|
+
metadata.hasAlpha = stream !== void 0 && videoStreamHasAlpha(stream);
|
|
162
|
+
const duration = Number(parsed.format?.duration);
|
|
163
|
+
if (Number.isFinite(duration) && duration > 0) metadata.durationSeconds = duration;
|
|
164
|
+
metadata.source = sourceFactsOf(stream, parsed.format?.bit_rate);
|
|
165
|
+
}
|
|
166
|
+
return metadata;
|
|
167
|
+
}
|
|
144
168
|
async function probeMediaMetadata(filePath, runner = execFileRunner) {
|
|
145
169
|
const kind = inferKindFromPath(filePath);
|
|
146
170
|
if (kind === "audio" || kind === "unknown") {
|
|
@@ -156,7 +180,7 @@ async function probeMediaMetadata(filePath, runner = execFileRunner) {
|
|
|
156
180
|
"-v",
|
|
157
181
|
"error",
|
|
158
182
|
"-show_entries",
|
|
159
|
-
"stream=codec_type,codec_name,profile,pix_fmt,color_space,color_transfer,color_primaries,bits_per_raw_sample,width,height,bit_rate:stream_disposition
|
|
183
|
+
"stream=codec_type,codec_name,profile,pix_fmt,color_space,color_transfer,color_primaries,bits_per_raw_sample,width,height,bit_rate:stream_disposition:stream_tags=alpha_mode:format=duration,bit_rate",
|
|
160
184
|
"-of",
|
|
161
185
|
"json",
|
|
162
186
|
"--",
|
|
@@ -171,20 +195,7 @@ async function probeMediaMetadata(filePath, runner = execFileRunner) {
|
|
|
171
195
|
return { kind, color: classifyMediaColor(null), probeError: "ffprobe failed" };
|
|
172
196
|
}
|
|
173
197
|
try {
|
|
174
|
-
|
|
175
|
-
const stream = parsed.streams?.find((item) => {
|
|
176
|
-
if (kind === "image") return item.codec_type === "video";
|
|
177
|
-
return item.codec_type === kind && item.disposition?.attached_pic !== 1;
|
|
178
|
-
});
|
|
179
|
-
const metadata = { kind, color: classifyMediaColor(stream) };
|
|
180
|
-
if (kind === "video") {
|
|
181
|
-
metadata.hasAudio = (parsed.streams ?? []).some((item) => item.codec_type === "audio");
|
|
182
|
-
metadata.hasAlpha = stream !== void 0 && videoStreamHasAlpha(stream);
|
|
183
|
-
const duration = Number(parsed.format?.duration);
|
|
184
|
-
if (Number.isFinite(duration) && duration > 0) metadata.durationSeconds = duration;
|
|
185
|
-
metadata.source = sourceFactsOf(stream, parsed.format?.bit_rate);
|
|
186
|
-
}
|
|
187
|
-
return metadata;
|
|
198
|
+
return metadataFromProbe(kind, JSON.parse(String(result.stdout || "{}")));
|
|
188
199
|
} catch {
|
|
189
200
|
return { kind, color: classifyMediaColor(null), probeError: "ffprobe returned invalid json" };
|
|
190
201
|
}
|
|
@@ -359,7 +370,7 @@ async function scanProjectMedia(projectDir, htmlSources, options = {}) {
|
|
|
359
370
|
const scan = { codecMap: {}, sourceFacts: {} };
|
|
360
371
|
for (const [pathname, facts] of await probeProjectAssets(projectDir, htmlSources, options)) {
|
|
361
372
|
if (facts?.browserHostile) scan.codecMap[pathname] = facts;
|
|
362
|
-
if (facts?.source) scan.sourceFacts[pathname] = facts.source;
|
|
373
|
+
if (facts?.source) scan.sourceFacts[pathname] = { ...facts.source, codec: facts.codecName };
|
|
363
374
|
}
|
|
364
375
|
return scan;
|
|
365
376
|
}
|
|
@@ -367,23 +378,44 @@ async function scanProjectMediaCodecMap(projectDir, htmlSources, options = {}) {
|
|
|
367
378
|
return (await scanProjectMedia(projectDir, htmlSources, options)).codecMap;
|
|
368
379
|
}
|
|
369
380
|
|
|
370
|
-
// ../studio-server/dist/chunk-
|
|
381
|
+
// ../studio-server/dist/chunk-MNJZQCBL.js
|
|
371
382
|
import { spawn } from "child_process";
|
|
372
|
-
import {
|
|
383
|
+
import { randomUUID } from "crypto";
|
|
373
384
|
import {
|
|
374
|
-
existsSync as
|
|
385
|
+
existsSync as existsSync4,
|
|
375
386
|
mkdtempSync,
|
|
376
387
|
renameSync,
|
|
377
|
-
rmSync,
|
|
378
|
-
statSync as statSync2,
|
|
388
|
+
rmSync as rmSync2,
|
|
379
389
|
unlinkSync as unlinkSync2,
|
|
380
390
|
utimesSync,
|
|
381
|
-
writeFileSync
|
|
391
|
+
writeFileSync as writeFileSync2
|
|
382
392
|
} from "fs";
|
|
383
393
|
import { availableParallelism, tmpdir, totalmem } from "os";
|
|
384
|
-
import { basename, dirname, extname as
|
|
385
|
-
import { existsSync, readdirSync, statSync as
|
|
386
|
-
import { extname as
|
|
394
|
+
import { basename as basename3, dirname as dirname3, extname as extname3, isAbsolute, join as join4, relative, resolve, sep as sep2 } from "path";
|
|
395
|
+
import { existsSync, readdirSync, statSync as statSync2, unlinkSync } from "fs";
|
|
396
|
+
import { extname as extname2, join } from "path";
|
|
397
|
+
import { createHash } from "crypto";
|
|
398
|
+
import {
|
|
399
|
+
closeSync,
|
|
400
|
+
createReadStream,
|
|
401
|
+
existsSync as existsSync2,
|
|
402
|
+
fstatSync,
|
|
403
|
+
openSync,
|
|
404
|
+
readFileSync,
|
|
405
|
+
statSync as statSync22,
|
|
406
|
+
writeFileSync
|
|
407
|
+
} from "fs";
|
|
408
|
+
import { basename, dirname, extname as extname22, join as join2 } from "path";
|
|
409
|
+
import {
|
|
410
|
+
closeSync as closeSync2,
|
|
411
|
+
existsSync as existsSync3,
|
|
412
|
+
openSync as openSync2,
|
|
413
|
+
readFileSync as readFileSync2,
|
|
414
|
+
rmSync,
|
|
415
|
+
statSync as statSync3,
|
|
416
|
+
writeSync
|
|
417
|
+
} from "fs";
|
|
418
|
+
import { basename as basename2, dirname as dirname2, join as join3 } from "path";
|
|
387
419
|
var DEFAULT_MAX_BYTES = 10 * 1024 * 1024 * 1024;
|
|
388
420
|
var DEFAULT_STALE_TEMP_MS = 60 * 60 * 1e3;
|
|
389
421
|
var DEFAULT_MIN_SWEEP_INTERVAL_MS = 5 * 60 * 1e3;
|
|
@@ -431,7 +463,7 @@ function readCacheInventory(cacheDir, protectedPaths, now, staleTempMs) {
|
|
|
431
463
|
for (const dirent of readdirSync(cacheDir, { withFileTypes: true })) {
|
|
432
464
|
if (!dirent.isFile()) continue;
|
|
433
465
|
const path = join(cacheDir, dirent.name);
|
|
434
|
-
const stat =
|
|
466
|
+
const stat = statSync2(path);
|
|
435
467
|
const entry = {
|
|
436
468
|
path,
|
|
437
469
|
size: stat.size,
|
|
@@ -442,7 +474,7 @@ function readCacheInventory(cacheDir, protectedPaths, now, staleTempMs) {
|
|
|
442
474
|
if (leftoverIsDead(cacheDir, dirent.name, stat.mtimeMs, protectedPaths, now, staleTempMs)) {
|
|
443
475
|
staleTemps.push(entry);
|
|
444
476
|
}
|
|
445
|
-
} else if (TRANSCODER_PROXY_NAME.test(dirent.name) && PROXY_EXTENSIONS.has(
|
|
477
|
+
} else if (TRANSCODER_PROXY_NAME.test(dirent.name) && PROXY_EXTENSIONS.has(extname2(dirent.name))) {
|
|
446
478
|
entries.push(entry);
|
|
447
479
|
}
|
|
448
480
|
}
|
|
@@ -492,6 +524,121 @@ function cleanupProxyCache(cacheDir, options = {}) {
|
|
|
492
524
|
skipped: false
|
|
493
525
|
};
|
|
494
526
|
}
|
|
527
|
+
var SMALL_FILE_BYTES = 16 * 1024 * 1024;
|
|
528
|
+
var COPY_NAME = /^[0-9a-f]{64}\.(?:mp4|webm)$/;
|
|
529
|
+
function digest(...parts) {
|
|
530
|
+
return createHash("sha256").update(parts.join("\0")).digest("hex");
|
|
531
|
+
}
|
|
532
|
+
function boxPart(box) {
|
|
533
|
+
return box ? formatPreviewProxyBox(box) : "";
|
|
534
|
+
}
|
|
535
|
+
function fastCopyKey(sourcePath, version, variant, box) {
|
|
536
|
+
const stat = statSync22(sourcePath);
|
|
537
|
+
return digest(
|
|
538
|
+
sourcePath,
|
|
539
|
+
String(stat.mtimeMs),
|
|
540
|
+
String(stat.size),
|
|
541
|
+
version,
|
|
542
|
+
variant,
|
|
543
|
+
boxPart(box)
|
|
544
|
+
);
|
|
545
|
+
}
|
|
546
|
+
async function contentCopyKey(sourcePath, version, variant, box, signal) {
|
|
547
|
+
const hash = createHash("sha256");
|
|
548
|
+
const fd = openSync(sourcePath, "r");
|
|
549
|
+
try {
|
|
550
|
+
if (fstatSync(fd).size <= SMALL_FILE_BYTES) hash.update(readFileSync(fd));
|
|
551
|
+
else
|
|
552
|
+
for await (const chunk of createReadStream(sourcePath, { fd, autoClose: false, signal }))
|
|
553
|
+
hash.update(chunk);
|
|
554
|
+
} finally {
|
|
555
|
+
closeSync(fd);
|
|
556
|
+
}
|
|
557
|
+
return digest(hash.digest("hex"), version, variant, boxPart(box));
|
|
558
|
+
}
|
|
559
|
+
function sourceSizeBytes(sourcePath) {
|
|
560
|
+
try {
|
|
561
|
+
const fd = openSync(sourcePath, "r");
|
|
562
|
+
try {
|
|
563
|
+
return fstatSync(fd).size;
|
|
564
|
+
} finally {
|
|
565
|
+
closeSync(fd);
|
|
566
|
+
}
|
|
567
|
+
} catch {
|
|
568
|
+
return void 0;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
function fastIndexPath(cachePath) {
|
|
572
|
+
return join2(dirname(cachePath), `.fast-${basename(cachePath, extname22(cachePath))}`);
|
|
573
|
+
}
|
|
574
|
+
function contentIndexPath(cacheDir, contentKey) {
|
|
575
|
+
return join2(cacheDir, `.content-${contentKey}`);
|
|
576
|
+
}
|
|
577
|
+
function readCopyIndex(indexPath) {
|
|
578
|
+
try {
|
|
579
|
+
const name = readFileSync(indexPath, "utf8").trim();
|
|
580
|
+
const target = join2(dirname(indexPath), name);
|
|
581
|
+
return COPY_NAME.test(name) && existsSync2(target) ? target : null;
|
|
582
|
+
} catch {
|
|
583
|
+
return null;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
function writeCopyIndex(indexPath, copyPath) {
|
|
587
|
+
writeFileSync(indexPath, basename(copyPath));
|
|
588
|
+
}
|
|
589
|
+
var POLL_MS = 500;
|
|
590
|
+
var UNREADABLE_LOCK_MS = 1e4;
|
|
591
|
+
function lockPathFor(cachePath) {
|
|
592
|
+
return join3(dirname2(cachePath), `.lock-${basename2(cachePath)}`);
|
|
593
|
+
}
|
|
594
|
+
function ownerIsAlive(lockPath) {
|
|
595
|
+
try {
|
|
596
|
+
const pid = Number(readFileSync2(lockPath, "utf8"));
|
|
597
|
+
if (!Number.isInteger(pid) || pid <= 0) {
|
|
598
|
+
return Date.now() - statSync3(lockPath).mtimeMs < UNREADABLE_LOCK_MS;
|
|
599
|
+
}
|
|
600
|
+
try {
|
|
601
|
+
process.kill(pid, 0);
|
|
602
|
+
return true;
|
|
603
|
+
} catch (err) {
|
|
604
|
+
return err.code === "EPERM";
|
|
605
|
+
}
|
|
606
|
+
} catch {
|
|
607
|
+
return false;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
function pause(ms, signal) {
|
|
611
|
+
return new Promise((resolve2, reject) => {
|
|
612
|
+
const timer = setTimeout(() => {
|
|
613
|
+
signal.removeEventListener("abort", onAbort);
|
|
614
|
+
resolve2();
|
|
615
|
+
}, ms);
|
|
616
|
+
const onAbort = () => {
|
|
617
|
+
clearTimeout(timer);
|
|
618
|
+
reject(signal.reason);
|
|
619
|
+
};
|
|
620
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
async function acquireCopyLock(cachePath, signal) {
|
|
624
|
+
const lockPath = lockPathFor(cachePath);
|
|
625
|
+
for (; ; ) {
|
|
626
|
+
signal.throwIfAborted();
|
|
627
|
+
if (existsSync3(cachePath)) return null;
|
|
628
|
+
try {
|
|
629
|
+
const fd = openSync2(lockPath, "wx");
|
|
630
|
+
writeSync(fd, String(process.pid));
|
|
631
|
+
closeSync2(fd);
|
|
632
|
+
if (!existsSync3(cachePath)) return () => rmSync(lockPath, { force: true });
|
|
633
|
+
rmSync(lockPath, { force: true });
|
|
634
|
+
return null;
|
|
635
|
+
} catch (err) {
|
|
636
|
+
if (err.code !== "EEXIST") throw err;
|
|
637
|
+
}
|
|
638
|
+
if (ownerIsAlive(lockPath)) await pause(POLL_MS, signal);
|
|
639
|
+
else rmSync(lockPath, { force: true });
|
|
640
|
+
}
|
|
641
|
+
}
|
|
495
642
|
var PROXY_PARAMS_VERSION = "v7";
|
|
496
643
|
var CACHE_DIR_NAME = ".transcode-cache";
|
|
497
644
|
function boundedEnvInteger(name, fallback, min, max) {
|
|
@@ -583,33 +730,16 @@ function canonicalizeProxySource(projectDir, absoluteSourcePath) {
|
|
|
583
730
|
if (requestedRelativePath === ".." || requestedRelativePath.startsWith(`..${sep2}`) || isAbsolute(requestedRelativePath)) {
|
|
584
731
|
throw new ProxySourceOutsideProjectError();
|
|
585
732
|
}
|
|
586
|
-
|
|
587
|
-
const canonicalSourcePath = realpath(absoluteSourcePath);
|
|
588
|
-
const canonicalRelativePath = relative(canonicalProjectDir, canonicalSourcePath);
|
|
589
|
-
const sourceIsInsideCanonicalProject = canonicalRelativePath !== ".." && !canonicalRelativePath.startsWith(`..${sep2}`) && !isAbsolute(canonicalRelativePath);
|
|
590
|
-
return {
|
|
591
|
-
projectDir: canonicalProjectDir,
|
|
592
|
-
sourcePath: canonicalSourcePath,
|
|
593
|
-
relativePath: requestedRelativePath.normalize("NFC"),
|
|
594
|
-
// An external target needs a stable identity in addition to its project-local
|
|
595
|
-
// symlink path, otherwise retargeting the link can reuse an unrelated proxy.
|
|
596
|
-
cacheIdentity: (sourceIsInsideCanonicalProject ? canonicalRelativePath : canonicalSourcePath).normalize("NFC")
|
|
597
|
-
};
|
|
598
|
-
}
|
|
599
|
-
function buildProxyCacheKey(source, variant, box) {
|
|
600
|
-
const stat = statSync2(source.sourcePath);
|
|
601
|
-
const size = box ? `\0${formatPreviewProxyBox(box)}` : "";
|
|
602
|
-
return createHash("sha256").update(
|
|
603
|
-
`${source.relativePath}\0${source.cacheIdentity}\0${stat.mtimeMs}\0${stat.size}\0${PROXY_PARAMS_VERSION}\0${variant}${size}`
|
|
604
|
-
).digest("hex");
|
|
733
|
+
return { projectDir: realProjectRoot(projectDir), sourcePath: realpath(absoluteSourcePath) };
|
|
605
734
|
}
|
|
606
735
|
function getCanonicalProxyCachePath(source, variant, box) {
|
|
607
|
-
const key =
|
|
608
|
-
|
|
736
|
+
const key = fastCopyKey(source.sourcePath, PROXY_PARAMS_VERSION, variant, box);
|
|
737
|
+
const made = join4(
|
|
609
738
|
source.projectDir,
|
|
610
739
|
CACHE_DIR_NAME,
|
|
611
740
|
`${key}${PROXY_VARIANT_CONFIG[variant].extension}`
|
|
612
741
|
);
|
|
742
|
+
return existsSync4(made) ? made : readCopyIndex(fastIndexPath(made)) ?? made;
|
|
613
743
|
}
|
|
614
744
|
function getProxyCachePath(projectDir, absoluteSourcePath, variant = "h264", box) {
|
|
615
745
|
return getCanonicalProxyCachePath(
|
|
@@ -751,11 +881,53 @@ function proxyScaleFilter(box) {
|
|
|
751
881
|
return `scale=${width}:${height}`;
|
|
752
882
|
}
|
|
753
883
|
var STDERR_ERROR_LINE = /error|invalid|denied|no space|not found|unknown/i;
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
884
|
+
var OPEN_OUTPUT_LINE = /^Error opening output file /;
|
|
885
|
+
var ABSOLUTE_PATH = /(?:[A-Za-z]:)?(?:[\\/][^\\/\s'"]+){2,}/g;
|
|
886
|
+
var REASON_LINES = 3;
|
|
887
|
+
function stderrReason(stderrTail, knownPaths) {
|
|
888
|
+
const lines = stderrTail.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
889
|
+
const openedAt = lines.map((candidate) => OPEN_OUTPUT_LINE.test(candidate)).lastIndexOf(true);
|
|
890
|
+
const causes = lines.filter(
|
|
891
|
+
(line, index) => !OPEN_OUTPUT_LINE.test(line) && (STDERR_ERROR_LINE.test(line) || index === openedAt - 1)
|
|
892
|
+
);
|
|
893
|
+
const shown = (causes.length ? causes : lines.slice(-1)).slice(-REASON_LINES);
|
|
894
|
+
const byLength = knownPaths.filter(isAbsolute).sort((a, b) => b.length - a.length);
|
|
895
|
+
const reason = shown.map(
|
|
896
|
+
(line) => byLength.reduce((text, path) => text.split(path).join("<path>"), line).replace(ABSOLUTE_PATH, "<path>").replace(/[.!]+$/, "")
|
|
897
|
+
);
|
|
898
|
+
return reason.length ? `: ${reason.join("; ")}` : "";
|
|
899
|
+
}
|
|
900
|
+
var CLOUD_FOLDER = /\/(?:Library\/CloudStorage|Dropbox|OneDrive|Google Drive)(?:[ \-/]|$)/i;
|
|
901
|
+
function sourceFolderKind(sourcePath) {
|
|
902
|
+
const path = sourcePath.replace(/\\/g, "/");
|
|
903
|
+
if (path.includes("/Library/Mobile Documents/")) return "icloud";
|
|
904
|
+
if (CLOUD_FOLDER.test(path)) return "cloud-storage";
|
|
905
|
+
return path.startsWith("/Volumes/") ? "external-volume" : "local";
|
|
906
|
+
}
|
|
907
|
+
function describeSource(sourcePath, metadata) {
|
|
908
|
+
const { codecName, pixelFormat, colorTransfer } = metadata.color;
|
|
909
|
+
const megabytes = sourceSizeBytes(sourcePath);
|
|
910
|
+
return [
|
|
911
|
+
metadata.kind,
|
|
912
|
+
codecName,
|
|
913
|
+
pixelFormat,
|
|
914
|
+
colorTransfer,
|
|
915
|
+
metadata.hasAudio ? "with audio" : "no audio",
|
|
916
|
+
metadata.streams?.length ? `streams ${metadata.streams.join(" ")}` : void 0,
|
|
917
|
+
metadata.durationSeconds ? `${Math.round(metadata.durationSeconds)}s` : void 0,
|
|
918
|
+
megabytes === void 0 ? "missing" : `${Math.round(megabytes / 1e6)} MB`,
|
|
919
|
+
sourceFolderKind(sourcePath)
|
|
920
|
+
].filter(Boolean).join(", ");
|
|
921
|
+
}
|
|
922
|
+
function withSource(err, describe) {
|
|
923
|
+
if (err instanceof ProxyTranscodeError && err.name === "ProxyTranscodeError") {
|
|
924
|
+
return new ProxyTranscodeError(
|
|
925
|
+
`${err.message} (source: ${describe()})`,
|
|
926
|
+
err.exitCode,
|
|
927
|
+
err.stderrTail
|
|
928
|
+
);
|
|
929
|
+
}
|
|
930
|
+
return err;
|
|
759
931
|
}
|
|
760
932
|
function chunkRanges(durationSeconds) {
|
|
761
933
|
if (!durationSeconds || durationSeconds <= PROXY_CHUNK_SECONDS * 1.5) return null;
|
|
@@ -801,9 +973,9 @@ function createPieceGate(size) {
|
|
|
801
973
|
}
|
|
802
974
|
async function encodeInChunks(ranges, chunkPrefix, tempPath, encode, concat, signal, gate, onDone = () => {
|
|
803
975
|
}) {
|
|
804
|
-
const extension =
|
|
976
|
+
const extension = extname3(tempPath);
|
|
805
977
|
const pieces = ranges.map((_, index) => `${chunkPrefix}${index}${extension}`);
|
|
806
|
-
const pending = ranges.flatMap((_, index) =>
|
|
978
|
+
const pending = ranges.flatMap((_, index) => existsSync4(pieces[index]) ? [] : [index]);
|
|
807
979
|
let doneSeconds = 0;
|
|
808
980
|
for (const [index, range] of ranges.entries()) {
|
|
809
981
|
if (!pending.includes(index)) doneSeconds += range.lengthSeconds;
|
|
@@ -822,7 +994,7 @@ async function encodeInChunks(ranges, chunkPrefix, tempPath, encode, concat, sig
|
|
|
822
994
|
const index = pending[cursor++];
|
|
823
995
|
const range = ranges[index];
|
|
824
996
|
const piece = pieces[index];
|
|
825
|
-
const pieceTemp =
|
|
997
|
+
const pieceTemp = join4(dirname3(piece), `.tmp-${randomUUID()}-${basename3(piece)}`);
|
|
826
998
|
try {
|
|
827
999
|
await encode(pieceTemp, range, pieceSignal, (encodedSeconds) => {
|
|
828
1000
|
inFlight2.set(index, encodedSeconds);
|
|
@@ -833,7 +1005,7 @@ async function encodeInChunks(ranges, chunkPrefix, tempPath, encode, concat, sig
|
|
|
833
1005
|
doneSeconds += range.lengthSeconds;
|
|
834
1006
|
onDone(doneSeconds);
|
|
835
1007
|
} finally {
|
|
836
|
-
if (
|
|
1008
|
+
if (existsSync4(pieceTemp)) unlinkSync2(pieceTemp);
|
|
837
1009
|
}
|
|
838
1010
|
} finally {
|
|
839
1011
|
gate.release();
|
|
@@ -850,19 +1022,19 @@ async function encodeInChunks(ranges, chunkPrefix, tempPath, encode, concat, sig
|
|
|
850
1022
|
)
|
|
851
1023
|
);
|
|
852
1024
|
if (failure !== void 0) throw failure;
|
|
853
|
-
const listDir = mkdtempSync(
|
|
1025
|
+
const listDir = mkdtempSync(join4(tmpdir(), "hf-proxy-join-"));
|
|
854
1026
|
try {
|
|
855
|
-
const listPath =
|
|
856
|
-
|
|
1027
|
+
const listPath = join4(listDir, "pieces.txt");
|
|
1028
|
+
writeFileSync2(
|
|
857
1029
|
listPath,
|
|
858
1030
|
pieces.map((piece) => `file '${piece.replace(/\\/g, "/").replace(/'/g, "'\\''")}'
|
|
859
1031
|
`).join("")
|
|
860
1032
|
);
|
|
861
1033
|
await concat(listPath, tempPath);
|
|
862
1034
|
} finally {
|
|
863
|
-
|
|
1035
|
+
rmSync2(listDir, { recursive: true, force: true });
|
|
864
1036
|
}
|
|
865
|
-
for (const piece of pieces) if (
|
|
1037
|
+
for (const piece of pieces) if (existsSync4(piece)) unlinkSync2(piece);
|
|
866
1038
|
}
|
|
867
1039
|
var KEYFRAME_EVERY_SECOND_ARGS = ["-force_key_frames", "expr:gte(t,n_forced*1)"];
|
|
868
1040
|
var H264_ARGS = [
|
|
@@ -972,24 +1144,28 @@ async function runFfmpeg(sourcePath, outputPath, chunkPrefix, variant, box, sign
|
|
|
972
1144
|
onEncoded
|
|
973
1145
|
);
|
|
974
1146
|
const ranges = chunkRanges(totalSeconds);
|
|
975
|
-
|
|
976
|
-
|
|
1147
|
+
try {
|
|
1148
|
+
if (!ranges) {
|
|
1149
|
+
return await encode(
|
|
1150
|
+
outputPath,
|
|
1151
|
+
void 0,
|
|
1152
|
+
signal,
|
|
1153
|
+
(encodedSeconds) => onProgress({ doneSeconds: encodedSeconds, totalSeconds })
|
|
1154
|
+
);
|
|
1155
|
+
}
|
|
1156
|
+
await encodeInChunks(
|
|
1157
|
+
ranges,
|
|
1158
|
+
chunkPrefix,
|
|
977
1159
|
outputPath,
|
|
978
|
-
|
|
1160
|
+
encode,
|
|
1161
|
+
(listPath, target) => spawnFfmpeg(ffmpegPath, concatArgs(listPath, target, variant), CONCAT_TIMEOUT_MS, signal),
|
|
979
1162
|
signal,
|
|
980
|
-
|
|
1163
|
+
gate,
|
|
1164
|
+
(doneSeconds) => onProgress({ doneSeconds, totalSeconds })
|
|
981
1165
|
);
|
|
1166
|
+
} catch (err) {
|
|
1167
|
+
throw withSource(err, () => describeSource(sourcePath, metadata));
|
|
982
1168
|
}
|
|
983
|
-
await encodeInChunks(
|
|
984
|
-
ranges,
|
|
985
|
-
chunkPrefix,
|
|
986
|
-
outputPath,
|
|
987
|
-
encode,
|
|
988
|
-
(listPath, target) => spawnFfmpeg(ffmpegPath, concatArgs(listPath, target, variant), CONCAT_TIMEOUT_MS, signal),
|
|
989
|
-
signal,
|
|
990
|
-
gate,
|
|
991
|
-
(doneSeconds) => onProgress({ doneSeconds, totalSeconds })
|
|
992
|
-
);
|
|
993
1169
|
}
|
|
994
1170
|
function concatArgs(listPath, target, variant) {
|
|
995
1171
|
return [
|
|
@@ -1070,7 +1246,7 @@ function spawnFfmpeg(ffmpegPath, args, stallMs, signal, onProgress) {
|
|
|
1070
1246
|
} else {
|
|
1071
1247
|
reject(
|
|
1072
1248
|
new ProxyTranscodeError(
|
|
1073
|
-
`ffmpeg exited with code ${code}${stderrReason(stderrTail)}`,
|
|
1249
|
+
`ffmpeg exited with code ${code}${stderrReason(stderrTail, args)}`,
|
|
1074
1250
|
code,
|
|
1075
1251
|
stderrTail
|
|
1076
1252
|
)
|
|
@@ -1082,14 +1258,31 @@ function spawnFfmpeg(ffmpegPath, args, stallMs, signal, onProgress) {
|
|
|
1082
1258
|
async function transcodeToCache(job, projectDir, absoluteSourcePath, cachePath, variant, box) {
|
|
1083
1259
|
await acquireSlot(job);
|
|
1084
1260
|
try {
|
|
1085
|
-
if (
|
|
1086
|
-
const cacheDir =
|
|
1261
|
+
if (existsSync4(cachePath)) return cachePath;
|
|
1262
|
+
const cacheDir = dirname3(cachePath);
|
|
1087
1263
|
mkdirWithinProject(projectDir, cacheDir);
|
|
1088
|
-
const
|
|
1264
|
+
const contentIndex = contentIndexPath(
|
|
1265
|
+
cacheDir,
|
|
1266
|
+
await contentCopyKey(
|
|
1267
|
+
absoluteSourcePath,
|
|
1268
|
+
PROXY_PARAMS_VERSION,
|
|
1269
|
+
variant,
|
|
1270
|
+
box,
|
|
1271
|
+
job.abandoned.signal
|
|
1272
|
+
)
|
|
1273
|
+
);
|
|
1274
|
+
const sameContent = readCopyIndex(contentIndex);
|
|
1275
|
+
if (sameContent) {
|
|
1276
|
+
writeCopyIndex(fastIndexPath(cachePath), sameContent);
|
|
1277
|
+
return sameContent;
|
|
1278
|
+
}
|
|
1279
|
+
const release = await acquireCopyLock(cachePath, job.abandoned.signal);
|
|
1280
|
+
if (!release) return cachePath;
|
|
1281
|
+
const tempPath = join4(cacheDir, `.tmp-${randomUUID()}-${basename3(cachePath)}`);
|
|
1089
1282
|
try {
|
|
1090
|
-
const chunkPrefix =
|
|
1283
|
+
const chunkPrefix = join4(
|
|
1091
1284
|
cacheDir,
|
|
1092
|
-
`${CHUNK_PREFIX}${
|
|
1285
|
+
`${CHUNK_PREFIX}${basename3(cachePath, extname3(cachePath))}-`
|
|
1093
1286
|
);
|
|
1094
1287
|
await runFfmpeg(
|
|
1095
1288
|
absoluteSourcePath,
|
|
@@ -1101,19 +1294,30 @@ async function transcodeToCache(job, projectDir, absoluteSourcePath, cachePath,
|
|
|
1101
1294
|
(progress) => reportProgress(job, progress)
|
|
1102
1295
|
);
|
|
1103
1296
|
renameSync(tempPath, cachePath);
|
|
1297
|
+
writeCopyIndex(contentIndex, cachePath);
|
|
1104
1298
|
maintainProxyCache(cacheDir);
|
|
1105
1299
|
return cachePath;
|
|
1106
1300
|
} finally {
|
|
1107
|
-
if (
|
|
1301
|
+
if (existsSync4(tempPath)) unlinkSync2(tempPath);
|
|
1302
|
+
release();
|
|
1108
1303
|
}
|
|
1109
1304
|
} finally {
|
|
1110
1305
|
releaseSlot();
|
|
1111
1306
|
}
|
|
1112
1307
|
}
|
|
1308
|
+
function proxyCopyProgress(projectDir, absoluteSourcePath, variant, box) {
|
|
1309
|
+
const source = canonicalizeProxySource(projectDir, absoluteSourcePath);
|
|
1310
|
+
const progress = inFlight.get(getCanonicalProxyCachePath(source, variant, box))?.job.lastProgress;
|
|
1311
|
+
return progress?.totalSeconds ? Math.min(1, progress.doneSeconds / progress.totalSeconds) : void 0;
|
|
1312
|
+
}
|
|
1313
|
+
function retryProxyCopy(projectDir, absoluteSourcePath, variant, box) {
|
|
1314
|
+
const source = canonicalizeProxySource(projectDir, absoluteSourcePath);
|
|
1315
|
+
failedTranscodes.delete(getCanonicalProxyCachePath(source, variant, box));
|
|
1316
|
+
}
|
|
1113
1317
|
var proxyActivity = 0;
|
|
1114
1318
|
function proxyActivityMark(projectDir) {
|
|
1115
|
-
if (!
|
|
1116
|
-
const cacheDir =
|
|
1319
|
+
if (!existsSync4(projectDir)) return String(proxyActivity);
|
|
1320
|
+
const cacheDir = join4(realpath(projectDir), CACHE_DIR_NAME) + sep2;
|
|
1117
1321
|
for (const cachePath of inFlight.keys()) if (cachePath.startsWith(cacheDir)) return null;
|
|
1118
1322
|
return String(proxyActivity);
|
|
1119
1323
|
}
|
|
@@ -1121,9 +1325,9 @@ async function resolveProxy(projectDir, absoluteSourcePath, variant = "h264", bo
|
|
|
1121
1325
|
options.signal?.throwIfAborted();
|
|
1122
1326
|
const source = canonicalizeProxySource(projectDir, absoluteSourcePath);
|
|
1123
1327
|
const cachePath = getCanonicalProxyCachePath(source, variant, box);
|
|
1124
|
-
if (
|
|
1328
|
+
if (existsSync4(cachePath)) {
|
|
1125
1329
|
markCacheEntryUsed(cachePath);
|
|
1126
|
-
maintainProxyCache(
|
|
1330
|
+
maintainProxyCache(dirname3(cachePath));
|
|
1127
1331
|
return cachePath;
|
|
1128
1332
|
}
|
|
1129
1333
|
const rememberedFailure = failedTranscodes.get(cachePath);
|
|
@@ -1180,7 +1384,7 @@ async function resolveProxies(projectDir, sources, onSettled = () => {
|
|
|
1180
1384
|
const first = sources[0];
|
|
1181
1385
|
if (first) {
|
|
1182
1386
|
maintainProxyCache(
|
|
1183
|
-
|
|
1387
|
+
dirname3(getProxyCachePath(projectDir, first.sourcePath, first.variant)),
|
|
1184
1388
|
Math.min(
|
|
1185
1389
|
Number(process.env.HYPERFRAMES_PROXY_CACHE_STALE_TEMP_MS) || UNTOUCHED_TEMP_IS_DEAD_MS,
|
|
1186
1390
|
UNTOUCHED_TEMP_IS_DEAD_MS
|
|
@@ -1243,6 +1447,8 @@ export {
|
|
|
1243
1447
|
ProxyWaitTimeoutError,
|
|
1244
1448
|
waitForProxy,
|
|
1245
1449
|
getProxyCachePath,
|
|
1450
|
+
proxyCopyProgress,
|
|
1451
|
+
retryProxyCopy,
|
|
1246
1452
|
proxyActivityMark,
|
|
1247
1453
|
resolveProxy,
|
|
1248
1454
|
resolveProxies
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
findCompositionDimensions
|
|
9
|
+
} from "./chunk-3YZ2ESXP.js";
|
|
10
|
+
import {
|
|
11
|
+
outputResolutionForSize
|
|
12
|
+
} from "./chunk-SVVAUJPL.js";
|
|
13
|
+
|
|
14
|
+
// src/commands/lambda/_dimensions.ts
|
|
15
|
+
import { readFileSync } from "fs";
|
|
16
|
+
import { join } from "path";
|
|
17
|
+
function resolveOutputResolutionFromSize(args) {
|
|
18
|
+
if (args.outputResolution) return args.outputResolution;
|
|
19
|
+
let html;
|
|
20
|
+
try {
|
|
21
|
+
html = readFileSync(join(args.projectDir, "index.html"), "utf-8");
|
|
22
|
+
} catch {
|
|
23
|
+
return void 0;
|
|
24
|
+
}
|
|
25
|
+
const composition = findCompositionDimensions(html);
|
|
26
|
+
if (!composition) return void 0;
|
|
27
|
+
const size = outputResolutionForSize({
|
|
28
|
+
compositionWidth: composition.width,
|
|
29
|
+
compositionHeight: composition.height,
|
|
30
|
+
width: args.cliWidth,
|
|
31
|
+
height: args.cliHeight
|
|
32
|
+
});
|
|
33
|
+
if (!size.ok) throw new Error(`--width/--height: ${size.message}`);
|
|
34
|
+
return size.outputResolution;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
resolveOutputResolutionFromSize
|
|
39
|
+
};
|
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
} from "./chunk-2ST4WAFY.js";
|
|
13
13
|
import {
|
|
14
14
|
createProjectConfig
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ND5ELD7A.js";
|
|
16
16
|
import {
|
|
17
17
|
isHyperframesProject
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-FRXPZCEP.js";
|
|
19
19
|
|
|
20
20
|
// src/utils/desktopApp.ts
|
|
21
21
|
import { spawn, spawnSync } from "child_process";
|
|
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
decodeHTMLAttribute
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-2RY2LWAA.js";
|
|
10
10
|
|
|
11
11
|
// ../parsers/dist/assetResolution.js
|
|
12
12
|
import { closeSync, constants, existsSync, fstatSync, openSync, readFileSync } from "fs";
|