hyperframes 0.8.196 → 0.8.197
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-JC7CRYAY.js → add-5GQIR5OE.js} +11 -11
- package/dist/{animatedGifPrep-5GSLZQUS.js → animatedGifPrep-MGFQWIGJ.js} +7 -7
- package/dist/api.js +15 -15
- package/dist/{asset-MM3F46VS.js → asset-ADX55DGH.js} +2 -2
- package/dist/{assetCataloger-G2ZIBRML.js → assetCataloger-GGBWBQZW.js} +7 -7
- package/dist/{audio-TTZ4OR5A.js → audio-SPB4CLRU.js} +13 -13
- package/dist/{auth-TFOUDLSS.js → auth-WBAB35QA.js} +1 -1
- package/dist/{autoUpdate-EIHQFY7Y.js → autoUpdate-5VUDX7JO.js} +2 -2
- package/dist/{backgroundChecks-SXRES7MW.js → backgroundChecks-ATZQQUMR.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-GH2HQQKN.js → batchRender-6S2XULOE.js} +3 -3
- package/dist/{beats-VYH72TGV.js → beats-WJPHWDZ6.js} +8 -8
- package/dist/{benchmark-72KJLRAY.js → benchmark-LZVR7PF6.js} +8 -8
- package/dist/{browser-3O7SAXSC.js → browser-QJ3PFVDY.js} +3 -3
- package/dist/{bundleWithLocalizedFonts-CJL3HHSF.js → bundleWithLocalizedFonts-564BQ73K.js} +2 -2
- package/dist/{capture-H33B5WVR.js → capture-3PUQLQNM.js} +10 -10
- package/dist/{capture-NQAJRPLR.js → capture-IRAYPK52.js} +2 -2
- package/dist/{captureCompositionFrame-HPIRZNGK.js → captureCompositionFrame-OHS3WBTA.js} +12 -12
- package/dist/{catalog-KMNTCN55.js → catalog-IQKJLTSF.js} +11 -11
- package/dist/{catch-up-Q367WUGC.js → catch-up-C4JJJNP3.js} +4 -4
- package/dist/{check-NQIN7ZQW.js → check-46Z5CAA4.js} +34 -34
- package/dist/{checkBrowser-IECG4M6A.js → checkBrowser-KAC54SLQ.js} +29 -29
- package/dist/{chunk-KCFKFKCU.js → chunk-2C4VIQ2H.js} +1 -1
- package/dist/{chunk-I452OMM7.js → chunk-2R7QYR2D.js} +1 -1
- package/dist/{chunk-RASESH32.js → chunk-33BFEUCL.js} +12 -8
- package/dist/{chunk-6RNGEUL3.js → chunk-3DEBV7RH.js} +1 -1
- package/dist/{chunk-KLOMOKJC.js → chunk-3HOQ5ZMS.js} +5 -5
- package/dist/{chunk-XJDMYIUI.js → chunk-454VK7CA.js} +6 -6
- package/dist/{chunk-IHGQEF3Z.js → chunk-46J53I7B.js} +15 -15
- package/dist/{chunk-TGHMJIHK.js → chunk-4FXJ54L4.js} +1 -1
- package/dist/{chunk-JL2PX5P2.js → chunk-4MNF7ALL.js} +1 -1
- package/dist/{chunk-FHRZK527.js → chunk-5FY7ARKL.js} +1 -1
- package/dist/{chunk-NTMKBXWW.js → chunk-5L6UY76S.js} +1 -1
- package/dist/{chunk-IZCW2NKT.js → chunk-5S7W3TUO.js} +1 -0
- package/dist/{chunk-TWHNETZP.js → chunk-6DMFWXDH.js} +3 -3
- package/dist/{chunk-MYVC3XTH.js → chunk-6LN4GQH3.js} +5 -5
- package/dist/{chunk-PTRDO7J4.js → chunk-6UX32GRW.js} +1 -1
- package/dist/{chunk-E7NEF2SC.js → chunk-7JMUJID2.js} +1 -1
- package/dist/{chunk-DMMYNEAF.js → chunk-AHE4R7PV.js} +9 -1
- package/dist/{chunk-DHSNTPEW.js → chunk-AXJMD32I.js} +1 -1
- package/dist/{chunk-JI7J3FTM.js → chunk-B6D7KOXQ.js} +2 -2
- package/dist/{chunk-PBHFZXYP.js → chunk-BF3ACZAB.js} +9 -9
- package/dist/{chunk-QK2MZ2SF.js → chunk-BNMVX4JK.js} +7 -7
- package/dist/{chunk-Z43NJYG2.js → chunk-BXXEQFRW.js} +2 -2
- package/dist/{chunk-EWXXMXNE.js → chunk-C4REI4HU.js} +2 -2
- package/dist/{chunk-I7BLPFXV.js → chunk-DTC4KKFP.js} +1 -1
- package/dist/{chunk-GHNIESBY.js → chunk-FFPKJU7T.js} +2 -2
- package/dist/{chunk-E7S6OJFP.js → chunk-FUAS4KCJ.js} +3 -3
- package/dist/chunk-G5RNOVAV.js +3901 -0
- package/dist/{chunk-ZKIHZDNI.js → chunk-GC4NUZAR.js} +3 -3
- package/dist/{chunk-3OKZJYA7.js → chunk-GGURM4ZM.js} +13 -13
- package/dist/{chunk-IYSIQ4GX.js → chunk-GI2WXOY5.js} +2 -2
- package/dist/{chunk-4VOUQCY6.js → chunk-GM6WM6YH.js} +1 -1
- package/dist/{chunk-WJJ6TPC7.js → chunk-IFOJM6PV.js} +3 -3
- package/dist/{chunk-62DVCRMX.js → chunk-IHSFWHXI.js} +1 -1
- package/dist/{chunk-VKFHSZYS.js → chunk-IK4Q7EKF.js} +1 -1
- package/dist/{chunk-TR7CDEU7.js → chunk-IY2NZKMG.js} +1 -1
- package/dist/{chunk-ZSREWHNW.js → chunk-J756NYRP.js} +5 -5
- package/dist/{chunk-MK6FWMMF.js → chunk-KBVJ6G65.js} +2 -2
- package/dist/{chunk-DTGW7DU3.js → chunk-MGSQPE6P.js} +1 -1
- package/dist/{chunk-REPDGLLY.js → chunk-NAZ54XAE.js} +5 -5
- package/dist/{chunk-REOE2ZEO.js → chunk-OEC7RJVD.js} +1 -1
- package/dist/{chunk-NCSX7WNM.js → chunk-PDDVEHWJ.js} +2 -2
- package/dist/{chunk-DMGXJRXV.js → chunk-POYHL7UJ.js} +2 -2
- package/dist/{chunk-XZE3IBMV.js → chunk-PRURJIVL.js} +1 -1
- package/dist/{chunk-UPPAKDU3.js → chunk-RHYXITPN.js} +3 -3
- package/dist/{chunk-3VI6DSO6.js → chunk-RNPTRRLX.js} +1 -1
- package/dist/{chunk-XLVUQGSA.js → chunk-SD2IVQXM.js} +1 -1
- package/dist/{chunk-WFHA6WC3.js → chunk-T3CBCGU4.js} +179 -131
- package/dist/{chunk-QSJUDSIC.js → chunk-UP7IRMTI.js} +9 -9
- package/dist/{chunk-L7UPBREN.js → chunk-VFSFTVOT.js} +66 -23
- package/dist/{chunk-5MPWOFWO.js → chunk-WKHPW2BC.js} +1 -1
- package/dist/{chunk-YU22E6SG.js → chunk-WNLHEUZU.js} +1 -1
- package/dist/{chunk-VAS2EQRM.js → chunk-WWE73ZFN.js} +2 -2
- package/dist/{chunk-LP6SFIWQ.js → chunk-WY6X5Q33.js} +1 -1
- package/dist/{chunk-W226NPSC.js → chunk-X56HO2IP.js} +1 -1
- package/dist/{chunk-VFDLKZJZ.js → chunk-X73MOLUS.js} +3 -3
- package/dist/{chunk-IO5NBG26.js → chunk-XE5DW6UC.js} +3 -3
- package/dist/{chunk-2TU4OKIR.js → chunk-YUODO5H2.js} +31 -0
- package/dist/{chunk-RP7QRLSK.js → chunk-ZAY376M4.js} +1 -1
- package/dist/{chunk-JCBZI47W.js → chunk-ZE6CLWXL.js} +1 -1
- package/dist/{clean-HINDVP2J.js → clean-JM6Y5V2G.js} +15 -15
- package/dist/cli.js +53 -53
- package/dist/{cloud-TPFDYW6D.js → cloud-DWKTRWWB.js} +4 -4
- package/dist/{cloudrun-XI4YKOBA.js → cloudrun-HLUQOVRO.js} +4 -4
- package/dist/{compare-I7GD7WNG.js → compare-GVTQBP4N.js} +26 -26
- package/dist/{compiler-K7SH7OZQ.js → compiler-3MDCAKFB.js} +3 -3
- package/dist/{component-FRH7UFTP.js → component-QSRD6BSP.js} +3 -3
- package/dist/{compositions-UQCJ7BG7.js → compositions-BDITIWMO.js} +11 -11
- package/dist/{delete-OTDM7JOD.js → delete-G2MXPSLU.js} +2 -2
- package/dist/{deploy-L6JEPE2A.js → deploy-Q7RDYGFL.js} +1 -1
- package/dist/{dist-FQBHBBKC.js → dist-WHAM6TAE.js} +2 -2
- package/dist/{dist-VRGIE57H.js → dist-XPD7X6JB.js} +1 -1
- package/dist/{doctor-RY44RTJD.js → doctor-Q7SJW3MZ.js} +11 -11
- package/dist/{events-JSL7JIXP.js → events-DOABLVUG.js} +2 -2
- package/dist/{events-ALOHDCL3.js → events-XEAJVOX2.js} +3 -3
- package/dist/{feedback-FSICK4WO.js → feedback-K7I2FQQF.js} +6 -6
- package/dist/{ffmpeg-FG7VOQTN.js → ffmpeg-2LKYJYAF.js} +7 -7
- package/dist/{figma-CN2672XS.js → figma-LXJRAIDI.js} +3 -3
- package/dist/fontLocalizeCli.js +9 -9
- package/dist/{get-C3OPJMWR.js → get-EDCTYZB6.js} +2 -2
- package/dist/{gpuPolicy-AJX7YIAS.js → gpuPolicy-4YOOXLBX.js} +7 -7
- package/dist/{grade-compare-WQHSPAHD.js → grade-compare-ZWUXB3MD.js} +27 -27
- package/dist/{help-E3MX427C.js → help-LEZ3E433.js} +1 -1
- package/dist/{history-FYLXZMI4.js → history-YD7OKO74.js} +6 -6
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +58 -58
- package/dist/hyperframes-player.global.js +1 -1
- package/dist/{info-OMF7O3KA.js → info-SI2KU7J7.js} +7 -7
- package/dist/{init-K3GNFQLD.js → init-INX5WA2G.js} +27 -27
- package/dist/{inspect-GYOEV66Q.js → inspect-SJENYN3F.js} +27 -27
- package/dist/{installer-6X4VLDTC.js → installer-JQ6DMFZ2.js} +4 -4
- package/dist/{keyframes-IPXUT4QI.js → keyframes-EAVHD4PM.js} +6 -6
- package/dist/{lambda-ZGMXIDJV.js → lambda-323RMLN5.js} +6 -6
- package/dist/{layout-QVTB5SUJ.js → layout-JGCQYWWK.js} +27 -27
- package/dist/{lint-V2I27FUE.js → lint-SFE43W5P.js} +7 -7
- package/dist/{lintProject-ESAJKFOX.js → lintProject-Q4ZVEF3G.js} +1 -1
- package/dist/{list-J5MFX5NA.js → list-N2NSYK6G.js} +2 -2
- package/dist/{login-ZRCLBPMK.js → login-QGISW3KF.js} +4 -4
- package/dist/{manager-GLJVKITP.js → manager-IXZJADWC.js} +8 -8
- package/dist/{media-treatment-HVGN5S4H.js → media-treatment-BTA7BV52.js} +13 -13
- package/dist/{models-4WEGIBNZ.js → models-NZEBSWXZ.js} +11 -11
- package/dist/{motionShot-B3I4ZE73.js → motionShot-E4GNRX4N.js} +15 -15
- package/dist/{normalize-audio-QIERL4II.js → normalize-audio-F4Q5ZX5R.js} +4 -4
- package/dist/{open-ALXHG55R.js → open-A4U2RXCG.js} +11 -11
- package/dist/{parakeetRunner-ESAELH2V.js → parakeetRunner-OVNNGTEB.js} +12 -12
- package/dist/{pipeline-QK6KHDQ3.js → pipeline-Z76DCEY7.js} +8 -8
- package/dist/{play-XBIN4KMI.js → play-NWSZMZZG.js} +18 -18
- package/dist/{preflight-D6VLCMOJ.js → preflight-I6UXFNYV.js} +8 -8
- package/dist/{present-DQ45WV7Q.js → present-QFZQ5VRM.js} +14 -14
- package/dist/{preview-CIAZ646P.js → preview-GXNG3UOV.js} +18 -18
- package/dist/{producer-T3FJ6HZE.js → producer-MGXGNSQX.js} +1 -1
- package/dist/{projectConfig-WFGZJAYZ.js → projectConfig-TNL3ZDIP.js} +6 -6
- package/dist/{publication-GWNKRVXZ.js → publication-OO772CBM.js} +2 -2
- package/dist/{publish-LIAAGUNA.js → publish-X33ZCMFO.js} +9 -9
- package/dist/{remove-background-HRFJZJHF.js → remove-background-JAD2RBYP.js} +9 -9
- package/dist/{render-3C5LHQ3P.js → render-2FX26ITP.js} +5 -5
- package/dist/{render-SMFKECFA.js → render-BZCK6XNT.js} +14 -14
- package/dist/{render-RWW4LGKJ.js → render-OJEKVJNG.js} +28 -28
- package/dist/{render-batch-7UH2F7N4.js → render-batch-SP6HKIF4.js} +5 -5
- package/dist/renderSetupWorker.js +1 -1
- package/dist/{resolver-4ZFA36XZ.js → resolver-QB7L6U4Q.js} +4 -4
- package/dist/{sherpa-NRSAFFIL.js → sherpa-BZLXBJTD.js} +11 -11
- package/dist/skills/hyperframes/references/film.md +1 -0
- package/dist/{skills-6ZUYEX75.js → skills-OMKCU4HZ.js} +5 -5
- package/dist/{skillsUpdateCheck-G2NSDI6O.js → skillsUpdateCheck-NNURJXBS.js} +3 -3
- package/dist/{snapshot-ZJBRKRHZ.js → snapshot-J7Y3PCCI.js} +55 -34
- package/dist/{src-GIB5BUZZ.js → src-2YZVFDNC.js} +6 -6
- package/dist/{src-CZHSSXXF.js → src-T5WHBOD2.js} +8 -8
- package/dist/{staticProjectServer-Q3BHJE7H.js → staticProjectServer-PHNKV2NL.js} +15 -15
- package/dist/studio/assets/{hyperframes-player-DG3nZ1bE.js → hyperframes-player-Cyi8HgFo.js} +1 -1
- package/dist/studio/assets/{index-BS2__aBb.js → index-6njHuMnJ.js} +106 -105
- package/dist/studio/assets/{index-C1r59TIq.js → index-DG6ZXBnu.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-QB4YAV5Q.js → studio-api-VLJJP2GQ.js} +8 -8
- package/dist/{studioServer-O6T4J75T.js → studioServer-G7RGGTWJ.js} +45 -45
- package/dist/{telemetry-IKTCBFN5.js → telemetry-2R6G2A54.js} +3 -3
- package/dist/{timeline-J2D5R53C.js → timeline-B2CM5IZO.js} +16 -16
- package/dist/{tokens-2D2TFXGD.js → tokens-7EOFUTMX.js} +2 -2
- package/dist/{transcribe-JX23YVIR.js → transcribe-7GTD3CEW.js} +10 -10
- package/dist/{transcribe-HGD5MUPC.js → transcribe-YJM673R7.js} +16 -16
- package/dist/{updateCheck-S56I5SDE.js → updateCheck-JBIJ7L2D.js} +2 -2
- package/dist/{upgrade-A4LUB5SH.js → upgrade-WF2CBHOE.js} +2 -2
- package/dist/{urlDownloader-ENNZJ7EM.js → urlDownloader-HMXLCV4T.js} +6 -6
- package/dist/{validate-IGVFY5CJ.js → validate-OHWQ7DQO.js} +21 -21
- package/dist/{video-HFXVZURT.js → video-OEEM43V6.js} +7 -7
- package/dist/warmCheck.js +34 -34
- package/package.json +1 -1
- package/dist/chunk-MXT76SSV.js +0 -3901
|
@@ -6,8 +6,9 @@ var __filename = __hf_fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
alphaDecoderFor,
|
|
9
|
+
pixelFormatHasAlpha,
|
|
9
10
|
videoStreamHasAlpha
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-5S7W3TUO.js";
|
|
11
12
|
import {
|
|
12
13
|
DISTRIBUTED_FPS,
|
|
13
14
|
MEDIA_VISUAL_STYLE_PROPERTIES,
|
|
@@ -26,7 +27,7 @@ import {
|
|
|
26
27
|
renderFrameIdForRenderId,
|
|
27
28
|
resolveAuthoredTimingWindow,
|
|
28
29
|
toFps
|
|
29
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-IK4Q7EKF.js";
|
|
30
31
|
import {
|
|
31
32
|
AUDIO_GROUP_RENDER_ID_ATTR,
|
|
32
33
|
COLOR_GRADING_SOURCE_HIDDEN_ATTR,
|
|
@@ -63,7 +64,7 @@ import {
|
|
|
63
64
|
sourceTimeAt,
|
|
64
65
|
timeAtSourceTime,
|
|
65
66
|
volumeSegmentSampleCount
|
|
66
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-G5RNOVAV.js";
|
|
67
68
|
import {
|
|
68
69
|
clampAudioGain,
|
|
69
70
|
clipGain,
|
|
@@ -86,7 +87,7 @@ import {
|
|
|
86
87
|
} from "./chunk-4UMPIPCQ.js";
|
|
87
88
|
import {
|
|
88
89
|
resolveReferencedStart
|
|
89
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-YUODO5H2.js";
|
|
90
91
|
import {
|
|
91
92
|
FFMPEG_PATH_ENV,
|
|
92
93
|
FFPROBE_PATH_ENV,
|
|
@@ -7862,7 +7863,7 @@ import {
|
|
|
7862
7863
|
existsSync as existsSync5,
|
|
7863
7864
|
ftruncateSync,
|
|
7864
7865
|
mkdirSync as mkdirSync2,
|
|
7865
|
-
mkdtempSync,
|
|
7866
|
+
mkdtempSync as mkdtempSync2,
|
|
7866
7867
|
openSync,
|
|
7867
7868
|
readFileSync as readFileSync3,
|
|
7868
7869
|
readdirSync as readdirSync3,
|
|
@@ -7870,7 +7871,7 @@ import {
|
|
|
7870
7871
|
writeFileSync as writeFileSync2,
|
|
7871
7872
|
writeSync
|
|
7872
7873
|
} from "fs";
|
|
7873
|
-
import { join as
|
|
7874
|
+
import { join as join7, dirname as dirname2, extname, resolve } from "path";
|
|
7874
7875
|
|
|
7875
7876
|
// ../engine/src/utils/gpuEncoder.ts
|
|
7876
7877
|
import { spawn } from "child_process";
|
|
@@ -8437,9 +8438,10 @@ async function runFfmpeg(args, opts) {
|
|
|
8437
8438
|
|
|
8438
8439
|
// ../engine/src/utils/ffprobe.ts
|
|
8439
8440
|
import { spawn as spawn3 } from "child_process";
|
|
8440
|
-
import { createReadStream, readFileSync, statSync as statSync2 } from "fs";
|
|
8441
|
+
import { createReadStream, mkdtempSync, readFileSync, rmSync, statSync as statSync2 } from "fs";
|
|
8441
8442
|
import { StringDecoder as StringDecoder2 } from "string_decoder";
|
|
8442
|
-
import {
|
|
8443
|
+
import { tmpdir as tmpdir2 } from "os";
|
|
8444
|
+
import { basename, join as join5 } from "path";
|
|
8443
8445
|
|
|
8444
8446
|
// ../engine/src/utils/urlInput.ts
|
|
8445
8447
|
import { existsSync as existsSync4 } from "fs";
|
|
@@ -8915,6 +8917,49 @@ function parseFrameRate(frameRateStr) {
|
|
|
8915
8917
|
if (!Number.isFinite(rounded)) return 0;
|
|
8916
8918
|
return rounded > 0 ? rounded : 0.01;
|
|
8917
8919
|
}
|
|
8920
|
+
async function probeDecodedAlphaPlane(filePath, decoder) {
|
|
8921
|
+
let probeDir;
|
|
8922
|
+
try {
|
|
8923
|
+
probeDir = mkdtempSync(join5(tmpdir2(), "hf-decoded-alpha-"));
|
|
8924
|
+
const framePath = join5(probeDir, "frame.nut");
|
|
8925
|
+
const decoded = await runFfmpeg(
|
|
8926
|
+
[
|
|
8927
|
+
"-v",
|
|
8928
|
+
"error",
|
|
8929
|
+
...urlInputArgs(filePath),
|
|
8930
|
+
"-c:v",
|
|
8931
|
+
decoder,
|
|
8932
|
+
"-i",
|
|
8933
|
+
filePath,
|
|
8934
|
+
"-frames:v",
|
|
8935
|
+
"1",
|
|
8936
|
+
"-vf",
|
|
8937
|
+
"scale=8:8",
|
|
8938
|
+
"-c:v",
|
|
8939
|
+
"rawvideo",
|
|
8940
|
+
"-f",
|
|
8941
|
+
"nut",
|
|
8942
|
+
framePath
|
|
8943
|
+
],
|
|
8944
|
+
{ timeout: 3e4 }
|
|
8945
|
+
);
|
|
8946
|
+
if (!decoded.success) return void 0;
|
|
8947
|
+
const stdout = await runFfprobe(framePath, [
|
|
8948
|
+
"-select_streams",
|
|
8949
|
+
"v:0",
|
|
8950
|
+
"-show_entries",
|
|
8951
|
+
"stream=pix_fmt",
|
|
8952
|
+
"-of",
|
|
8953
|
+
"json"
|
|
8954
|
+
]);
|
|
8955
|
+
const pixFmt = JSON.parse(stdout).streams?.[0]?.pix_fmt;
|
|
8956
|
+
return pixFmt ? pixelFormatHasAlpha(pixFmt) : void 0;
|
|
8957
|
+
} catch {
|
|
8958
|
+
return void 0;
|
|
8959
|
+
} finally {
|
|
8960
|
+
if (probeDir) rmSync(probeDir, { recursive: true, force: true });
|
|
8961
|
+
}
|
|
8962
|
+
}
|
|
8918
8963
|
async function extractMediaMetadata(filePath) {
|
|
8919
8964
|
const identity = mediaFileIdentity(filePath);
|
|
8920
8965
|
const cached = readMetadataCache(videoMetadataCache, filePath, identity);
|
|
@@ -8969,6 +9014,8 @@ async function extractMediaMetadata(filePath) {
|
|
|
8969
9014
|
const colorSpace = merged.colorTransfer || merged.colorPrimaries || merged.colorSpace ? merged : null;
|
|
8970
9015
|
const pixelFormat = videoStream.pix_fmt || "";
|
|
8971
9016
|
const hasAlpha = videoStreamHasAlpha(videoStream);
|
|
9017
|
+
const alphaDecoder = hasAlpha ? null : alphaDecoderFor(videoStream.codec_name);
|
|
9018
|
+
const alphaPlaneDecoded = alphaDecoder ? await probeDecodedAlphaPlane(filePath, alphaDecoder) : void 0;
|
|
8972
9019
|
const containerDuration = output?.format.duration ? parseFloat(output.format.duration) : 0;
|
|
8973
9020
|
const streamDuration = videoStream.duration ? parseFloat(videoStream.duration) : 0;
|
|
8974
9021
|
const parsedStreamStart = videoStream.start_time ? parseFloat(videoStream.start_time) : 0;
|
|
@@ -8996,6 +9043,7 @@ async function extractMediaMetadata(filePath) {
|
|
|
8996
9043
|
hasAudio: output?.streams.some((s) => s.codec_type === "audio") ?? false,
|
|
8997
9044
|
isVFR,
|
|
8998
9045
|
hasAlpha,
|
|
9046
|
+
...alphaPlaneDecoded === void 0 ? {} : { alphaPlaneDecoded },
|
|
8999
9047
|
colorSpace,
|
|
9000
9048
|
colorRange: videoStream.color_range,
|
|
9001
9049
|
pixelFormat,
|
|
@@ -9293,7 +9341,7 @@ function appendSoftwareEncoderThreadsArg(args, encoder, parallelism = availableP
|
|
|
9293
9341
|
|
|
9294
9342
|
// ../engine/src/utils/renderProvenance.ts
|
|
9295
9343
|
import { readFileSync as readFileSync2 } from "fs";
|
|
9296
|
-
import { dirname, join as
|
|
9344
|
+
import { dirname, join as join6 } from "path";
|
|
9297
9345
|
import { fileURLToPath } from "url";
|
|
9298
9346
|
var PROVENANCE_RENDERER_TAG = "hyperframes_renderer";
|
|
9299
9347
|
var PROVENANCE_VERSION_TAG = "hyperframes_version";
|
|
@@ -9304,7 +9352,7 @@ var MAX_WALK_DEPTH = 12;
|
|
|
9304
9352
|
function resolveOwnVersionFrom(startDir) {
|
|
9305
9353
|
let dir = startDir;
|
|
9306
9354
|
for (let depth = 0; depth < MAX_WALK_DEPTH; depth++) {
|
|
9307
|
-
const candidate =
|
|
9355
|
+
const candidate = join6(dir, "package.json");
|
|
9308
9356
|
let pkg;
|
|
9309
9357
|
try {
|
|
9310
9358
|
pkg = JSON.parse(readFileSync2(candidate, "utf8"));
|
|
@@ -9710,7 +9758,7 @@ function buildConcatArgs(concatListPath, outputPath) {
|
|
|
9710
9758
|
var concatListSeq = 0;
|
|
9711
9759
|
function writeConcatList(dir, inputPaths) {
|
|
9712
9760
|
concatListSeq += 1;
|
|
9713
|
-
const listPath =
|
|
9761
|
+
const listPath = join7(dir, `concat-list-${process.pid}-${concatListSeq}.txt`);
|
|
9714
9762
|
const body = inputPaths.map((p) => `file '${resolve(p).replace(/'/g, "'\\''")}'`).join("\n");
|
|
9715
9763
|
writeFileSync2(listPath, body, "utf-8");
|
|
9716
9764
|
return listPath;
|
|
@@ -9754,7 +9802,7 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
|
|
|
9754
9802
|
const chunkSize = Math.max(30, Math.floor(chunkSizeFrames));
|
|
9755
9803
|
const chunkCount = Math.ceil(files.length / chunkSize);
|
|
9756
9804
|
mkdirSync2(dirname2(outputPath), { recursive: true });
|
|
9757
|
-
const chunkDir =
|
|
9805
|
+
const chunkDir = mkdtempSync2(join7(dirname2(outputPath), "chunk-encode-"));
|
|
9758
9806
|
const chunkPaths = [];
|
|
9759
9807
|
for (let i = 0; i < chunkCount; i++) {
|
|
9760
9808
|
if (signal?.aborted) {
|
|
@@ -9770,7 +9818,7 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
|
|
|
9770
9818
|
const startNumber = i * chunkSize;
|
|
9771
9819
|
const framesInChunk = Math.min(chunkSize, files.length - startNumber);
|
|
9772
9820
|
const ext = outputPath.endsWith(".webm") ? ".webm" : outputPath.endsWith(".mov") ? ".mov" : ".mp4";
|
|
9773
|
-
const chunkPath =
|
|
9821
|
+
const chunkPath = join7(chunkDir, `chunk_${String(i).padStart(4, "0")}${ext}`);
|
|
9774
9822
|
const inputPath = frameSequencePath(framesDir, framePattern);
|
|
9775
9823
|
const inputArgs = [
|
|
9776
9824
|
"-framerate",
|
|
@@ -9940,14 +9988,14 @@ async function packageHls(videoPath, audioPath, outputDir, options) {
|
|
|
9940
9988
|
"-master_pl_name",
|
|
9941
9989
|
HLS_MASTER_PLAYLIST,
|
|
9942
9990
|
"-hls_segment_filename",
|
|
9943
|
-
|
|
9991
|
+
join7(outputDir, "%v_%05d.ts"),
|
|
9944
9992
|
// Without these the mpegts muxer starts the stream at PTS 1.4 s.
|
|
9945
9993
|
"-muxdelay",
|
|
9946
9994
|
"0",
|
|
9947
9995
|
"-muxpreload",
|
|
9948
9996
|
"0"
|
|
9949
9997
|
);
|
|
9950
|
-
args.push("-y",
|
|
9998
|
+
args.push("-y", join7(outputDir, "%v.m3u8"));
|
|
9951
9999
|
const processTimeout = options.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
|
|
9952
10000
|
const result = await runFfmpeg(args, { signal, timeout: processTimeout });
|
|
9953
10001
|
if (signal?.aborted) {
|
|
@@ -9959,7 +10007,7 @@ async function packageHls(videoPath, audioPath, outputDir, options) {
|
|
|
9959
10007
|
};
|
|
9960
10008
|
}
|
|
9961
10009
|
if (result.success && hasAudio) {
|
|
9962
|
-
const masterPath =
|
|
10010
|
+
const masterPath = join7(outputDir, HLS_MASTER_PLAYLIST);
|
|
9963
10011
|
let master;
|
|
9964
10012
|
try {
|
|
9965
10013
|
master = openSync(masterPath, "r+", 384);
|
|
@@ -10536,8 +10584,8 @@ function isMemberGroupHidden(groupsById, el) {
|
|
|
10536
10584
|
}
|
|
10537
10585
|
|
|
10538
10586
|
// ../engine/src/services/videoFrameExtractor.ts
|
|
10539
|
-
import { copyFileSync as copyFileSync2, existsSync as existsSync9, linkSync as linkSync2, mkdirSync as mkdirSync6, rmSync as
|
|
10540
|
-
import { join as
|
|
10587
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync9, linkSync as linkSync2, mkdirSync as mkdirSync6, rmSync as rmSync5 } from "fs";
|
|
10588
|
+
import { join as join11 } from "path";
|
|
10541
10589
|
import { cpus } from "os";
|
|
10542
10590
|
|
|
10543
10591
|
// ../engine/src/utils/concurrencyLimit.ts
|
|
@@ -10579,9 +10627,9 @@ function isKnownInactiveTimelineWindow(element, resolvedStart) {
|
|
|
10579
10627
|
}
|
|
10580
10628
|
|
|
10581
10629
|
// ../engine/src/utils/alphaPlaneProbe.ts
|
|
10582
|
-
import { mkdtempSync as
|
|
10583
|
-
import { tmpdir as
|
|
10584
|
-
import { join as
|
|
10630
|
+
import { mkdtempSync as mkdtempSync3, readFileSync as readFileSync4, rmSync as rmSync2 } from "fs";
|
|
10631
|
+
import { tmpdir as tmpdir3 } from "os";
|
|
10632
|
+
import { join as join8 } from "path";
|
|
10585
10633
|
var BYTES_PER_SAMPLE_FRAME = 8 * 8 * 4;
|
|
10586
10634
|
var MAX_SAMPLE_BYTES = BYTES_PER_SAMPLE_FRAME * 3;
|
|
10587
10635
|
function sampledRgbaAlphaIsFullyOpaque(buf) {
|
|
@@ -10596,8 +10644,8 @@ function sampledRgbaAlphaIsFullyOpaque(buf) {
|
|
|
10596
10644
|
async function probeInputAlphaPlane(videoPath, decoder, signal) {
|
|
10597
10645
|
let probeDir;
|
|
10598
10646
|
try {
|
|
10599
|
-
probeDir =
|
|
10600
|
-
const samplePath =
|
|
10647
|
+
probeDir = mkdtempSync3(join8(tmpdir3(), "hf-alpha-probe-"));
|
|
10648
|
+
const samplePath = join8(probeDir, "alpha.raw");
|
|
10601
10649
|
const result = await runFfmpeg(
|
|
10602
10650
|
[
|
|
10603
10651
|
"-v",
|
|
@@ -10623,7 +10671,7 @@ async function probeInputAlphaPlane(videoPath, decoder, signal) {
|
|
|
10623
10671
|
} catch {
|
|
10624
10672
|
return void 0;
|
|
10625
10673
|
} finally {
|
|
10626
|
-
if (probeDir)
|
|
10674
|
+
if (probeDir) rmSync2(probeDir, { recursive: true, force: true });
|
|
10627
10675
|
}
|
|
10628
10676
|
}
|
|
10629
10677
|
function inputAlphaOpaqueWarning(src) {
|
|
@@ -10639,19 +10687,19 @@ import {
|
|
|
10639
10687
|
existsSync as existsSync7,
|
|
10640
10688
|
fsyncSync,
|
|
10641
10689
|
linkSync,
|
|
10642
|
-
mkdtempSync as
|
|
10690
|
+
mkdtempSync as mkdtempSync4,
|
|
10643
10691
|
mkdirSync as mkdirSync4,
|
|
10644
10692
|
lstatSync,
|
|
10645
10693
|
openSync as openSync2,
|
|
10646
10694
|
readdirSync as readdirSync4,
|
|
10647
10695
|
rmdirSync,
|
|
10648
|
-
rmSync as
|
|
10696
|
+
rmSync as rmSync3,
|
|
10649
10697
|
statSync as statSync5,
|
|
10650
10698
|
unlinkSync
|
|
10651
10699
|
} from "fs";
|
|
10652
10700
|
import { createHash, randomUUID as randomUUID2 } from "crypto";
|
|
10653
10701
|
import { BlockList, isIP } from "net";
|
|
10654
|
-
import { dirname as dirname4, extname as extname2, join as
|
|
10702
|
+
import { dirname as dirname4, extname as extname2, join as join9 } from "path";
|
|
10655
10703
|
import { Readable, Transform } from "stream";
|
|
10656
10704
|
import { pipeline } from "stream/promises";
|
|
10657
10705
|
var inFlightDownloads = /* @__PURE__ */ new Map();
|
|
@@ -10843,7 +10891,7 @@ function removeCacheLockDirectoryIfEmpty(lockPath) {
|
|
|
10843
10891
|
}
|
|
10844
10892
|
function releaseOwnedCachePathLock(lockPath, owner) {
|
|
10845
10893
|
try {
|
|
10846
|
-
rmdirSync(
|
|
10894
|
+
rmdirSync(join9(lockPath, owner));
|
|
10847
10895
|
} catch (error) {
|
|
10848
10896
|
if (error.code === "ENOENT") return;
|
|
10849
10897
|
throw error;
|
|
@@ -10884,12 +10932,12 @@ async function acquireCachePathLock(localPath, timeoutMs, signal) {
|
|
|
10884
10932
|
if (createdLock) {
|
|
10885
10933
|
const owner = `${CACHE_LOCK_OWNER_PREFIX}${randomUUID2()}`;
|
|
10886
10934
|
try {
|
|
10887
|
-
mkdirSync4(
|
|
10935
|
+
mkdirSync4(join9(lockPath, owner));
|
|
10888
10936
|
const entries = readdirSync4(lockPath);
|
|
10889
10937
|
if (entries.length === 1 && entries[0] === owner) {
|
|
10890
10938
|
return () => releaseOwnedCachePathLock(lockPath, owner);
|
|
10891
10939
|
}
|
|
10892
|
-
rmdirSync(
|
|
10940
|
+
rmdirSync(join9(lockPath, owner));
|
|
10893
10941
|
removeCacheLockDirectoryIfEmpty(lockPath);
|
|
10894
10942
|
continue;
|
|
10895
10943
|
} catch (error) {
|
|
@@ -10907,7 +10955,7 @@ async function acquireCachePathLock(localPath, timeoutMs, signal) {
|
|
|
10907
10955
|
if (Date.now() - observedLock.stats.mtimeMs > CACHE_LOCK_STALE_MS) {
|
|
10908
10956
|
if (observedLock.owner) {
|
|
10909
10957
|
try {
|
|
10910
|
-
rmdirSync(
|
|
10958
|
+
rmdirSync(join9(lockPath, observedLock.owner));
|
|
10911
10959
|
} catch (error) {
|
|
10912
10960
|
if (error.code === "ENOENT") continue;
|
|
10913
10961
|
throw error;
|
|
@@ -10915,7 +10963,7 @@ async function acquireCachePathLock(localPath, timeoutMs, signal) {
|
|
|
10915
10963
|
removeCacheLockDirectoryIfEmpty(lockPath);
|
|
10916
10964
|
continue;
|
|
10917
10965
|
}
|
|
10918
|
-
const reclaimPath =
|
|
10966
|
+
const reclaimPath = join9(lockPath, CACHE_LOCK_RECLAIM_NAME);
|
|
10919
10967
|
try {
|
|
10920
10968
|
mkdirSync4(reclaimPath);
|
|
10921
10969
|
} catch (error) {
|
|
@@ -11355,8 +11403,8 @@ function emitDownloadTelemetry(options, event) {
|
|
|
11355
11403
|
}
|
|
11356
11404
|
}
|
|
11357
11405
|
async function runDownloadAttempt(url, localPath, timeoutMs, attempt, options, signal) {
|
|
11358
|
-
const attemptDir =
|
|
11359
|
-
const partialPath =
|
|
11406
|
+
const attemptDir = mkdtempSync4(join9(dirname4(localPath), ".hf-download-"));
|
|
11407
|
+
const partialPath = join9(attemptDir, "payload");
|
|
11360
11408
|
const controller = new AbortController();
|
|
11361
11409
|
let timedOut = false;
|
|
11362
11410
|
let callerAborted = signal?.aborted ?? false;
|
|
@@ -11458,7 +11506,7 @@ async function runDownloadAttempt(url, localPath, timeoutMs, attempt, options, s
|
|
|
11458
11506
|
clearTimeout(timeoutId);
|
|
11459
11507
|
signal?.removeEventListener("abort", onCallerAbort);
|
|
11460
11508
|
controller.abort();
|
|
11461
|
-
|
|
11509
|
+
rmSync3(attemptDir, { recursive: true, force: true });
|
|
11462
11510
|
}
|
|
11463
11511
|
}
|
|
11464
11512
|
async function downloadWithRetry(url, localPath, timeoutMs, signal, onTransientRetry, options = {}) {
|
|
@@ -11537,7 +11585,7 @@ async function reuseOrInvalidateCachedFile(url, localPath, timeoutMs, signal, op
|
|
|
11537
11585
|
throw error;
|
|
11538
11586
|
}
|
|
11539
11587
|
if (!before.isFile() || before.size === 0) {
|
|
11540
|
-
|
|
11588
|
+
rmSync3(localPath, { recursive: before.isDirectory(), force: true });
|
|
11541
11589
|
return false;
|
|
11542
11590
|
}
|
|
11543
11591
|
let inspection;
|
|
@@ -11569,7 +11617,7 @@ async function reuseOrInvalidateCachedFile(url, localPath, timeoutMs, signal, op
|
|
|
11569
11617
|
});
|
|
11570
11618
|
return true;
|
|
11571
11619
|
}
|
|
11572
|
-
|
|
11620
|
+
rmSync3(localPath, { force: true });
|
|
11573
11621
|
return false;
|
|
11574
11622
|
}
|
|
11575
11623
|
return false;
|
|
@@ -11592,7 +11640,7 @@ async function downloadToTemp(url, destDir, timeoutMs = 3e5, signal, onTransient
|
|
|
11592
11640
|
mkdirSync4(destDir, { recursive: true });
|
|
11593
11641
|
}
|
|
11594
11642
|
const filename = getFilenameFromUrl(url, validationScope);
|
|
11595
|
-
const localPath =
|
|
11643
|
+
const localPath = join9(destDir, filename);
|
|
11596
11644
|
const downloadPromise = (async () => {
|
|
11597
11645
|
const cacheStartedAt = Date.now();
|
|
11598
11646
|
const reused = await reuseOrInvalidateCachedFile(
|
|
@@ -11669,7 +11717,7 @@ import {
|
|
|
11669
11717
|
lstatSync as lstatSync2,
|
|
11670
11718
|
mkdirSync as mkdirSync5,
|
|
11671
11719
|
readdirSync as readdirSync5,
|
|
11672
|
-
rmSync as
|
|
11720
|
+
rmSync as rmSync4,
|
|
11673
11721
|
statSync as statSync6,
|
|
11674
11722
|
utimesSync,
|
|
11675
11723
|
writeFileSync as writeFileSync3
|
|
@@ -11715,7 +11763,7 @@ async function renameWithRetryAsync(from, to, options = {}) {
|
|
|
11715
11763
|
}
|
|
11716
11764
|
|
|
11717
11765
|
// ../engine/src/services/extractionCache.ts
|
|
11718
|
-
import { join as
|
|
11766
|
+
import { join as join10 } from "path";
|
|
11719
11767
|
var COMPLETE_SENTINEL = ".hf-complete";
|
|
11720
11768
|
var GC_MARKER = ".hf-last-gc";
|
|
11721
11769
|
var SCHEMA_PREFIX = "hfcache-v8-";
|
|
@@ -11766,8 +11814,8 @@ function hasFrameFiles(dir) {
|
|
|
11766
11814
|
}
|
|
11767
11815
|
function lookupCacheEntry(rootDir, input) {
|
|
11768
11816
|
const keyHash = computeCacheKey(input);
|
|
11769
|
-
const dir =
|
|
11770
|
-
const complete = existsSync8(
|
|
11817
|
+
const dir = join10(rootDir, cacheEntryDirName(keyHash));
|
|
11818
|
+
const complete = existsSync8(join10(dir, COMPLETE_SENTINEL)) && hasFrameFiles(dir);
|
|
11771
11819
|
return { entry: { dir, keyHash }, hit: complete };
|
|
11772
11820
|
}
|
|
11773
11821
|
function partialCacheEntryDir(entry) {
|
|
@@ -11778,13 +11826,13 @@ function isTargetExistsRenameError(err) {
|
|
|
11778
11826
|
return code === "EEXIST" || code === "ENOTEMPTY" || code === "EPERM";
|
|
11779
11827
|
}
|
|
11780
11828
|
function adoptPublishedWinner(entry, partialDir) {
|
|
11781
|
-
if (!existsSync8(
|
|
11829
|
+
if (!existsSync8(join10(entry.dir, COMPLETE_SENTINEL)) || !hasFrameFiles(entry.dir)) return null;
|
|
11782
11830
|
removeDir(partialDir);
|
|
11783
11831
|
return { dir: entry.dir, published: true };
|
|
11784
11832
|
}
|
|
11785
11833
|
function publishCacheEntry(entry, partialDir) {
|
|
11786
11834
|
try {
|
|
11787
|
-
writeFileSync3(
|
|
11835
|
+
writeFileSync3(join10(partialDir, COMPLETE_SENTINEL), "", "utf-8");
|
|
11788
11836
|
} catch {
|
|
11789
11837
|
return { dir: partialDir, published: false };
|
|
11790
11838
|
}
|
|
@@ -11797,7 +11845,7 @@ function publishCacheEntry(entry, partialDir) {
|
|
|
11797
11845
|
const winner = adoptPublishedWinner(entry, partialDir);
|
|
11798
11846
|
if (winner) return winner;
|
|
11799
11847
|
try {
|
|
11800
|
-
|
|
11848
|
+
rmSync4(entry.dir, { recursive: true, force: true });
|
|
11801
11849
|
} catch {
|
|
11802
11850
|
return { dir: partialDir, published: false };
|
|
11803
11851
|
}
|
|
@@ -11815,7 +11863,7 @@ function touchCacheDir(dir) {
|
|
|
11815
11863
|
} catch {
|
|
11816
11864
|
}
|
|
11817
11865
|
try {
|
|
11818
|
-
utimesSync(
|
|
11866
|
+
utimesSync(join10(dir, COMPLETE_SENTINEL), now, now);
|
|
11819
11867
|
} catch {
|
|
11820
11868
|
}
|
|
11821
11869
|
}
|
|
@@ -11844,7 +11892,7 @@ function directorySizeBytes(path) {
|
|
|
11844
11892
|
return 0;
|
|
11845
11893
|
}
|
|
11846
11894
|
for (const child of children) {
|
|
11847
|
-
const childPath =
|
|
11895
|
+
const childPath = join10(path, child);
|
|
11848
11896
|
try {
|
|
11849
11897
|
const stat = lstatSync2(childPath);
|
|
11850
11898
|
if (stat.isDirectory()) {
|
|
@@ -11859,7 +11907,7 @@ function directorySizeBytes(path) {
|
|
|
11859
11907
|
}
|
|
11860
11908
|
function removeDir(path) {
|
|
11861
11909
|
try {
|
|
11862
|
-
|
|
11910
|
+
rmSync4(path, { recursive: true, force: true });
|
|
11863
11911
|
} catch {
|
|
11864
11912
|
}
|
|
11865
11913
|
}
|
|
@@ -11873,7 +11921,7 @@ function collectGcEntry(dir, name, now, minAgeMs, stats, remove) {
|
|
|
11873
11921
|
}
|
|
11874
11922
|
let lastUseMs = dirStat.mtimeMs;
|
|
11875
11923
|
try {
|
|
11876
|
-
lastUseMs = statSync6(
|
|
11924
|
+
lastUseMs = statSync6(join10(dir, COMPLETE_SENTINEL)).mtimeMs;
|
|
11877
11925
|
} catch {
|
|
11878
11926
|
}
|
|
11879
11927
|
return { dir, size: directorySizeBytes(dir), lastUseMs, ageMs: now - lastUseMs };
|
|
@@ -11883,14 +11931,14 @@ function collectGcEntry(dir, name, now, minAgeMs, stats, remove) {
|
|
|
11883
11931
|
}
|
|
11884
11932
|
function gcSweepDue(rootDir, maxAgeMs) {
|
|
11885
11933
|
try {
|
|
11886
|
-
return Date.now() - statSync6(
|
|
11934
|
+
return Date.now() - statSync6(join10(rootDir, GC_MARKER)).mtimeMs > maxAgeMs;
|
|
11887
11935
|
} catch {
|
|
11888
11936
|
return true;
|
|
11889
11937
|
}
|
|
11890
11938
|
}
|
|
11891
11939
|
function markGcSweep(rootDir) {
|
|
11892
11940
|
try {
|
|
11893
|
-
writeFileSync3(
|
|
11941
|
+
writeFileSync3(join10(rootDir, GC_MARKER), "", "utf-8");
|
|
11894
11942
|
} catch {
|
|
11895
11943
|
}
|
|
11896
11944
|
}
|
|
@@ -11905,7 +11953,7 @@ function gcExtractionCache(rootDir, opts) {
|
|
|
11905
11953
|
for (const child of readdirSync5(rootDir, { withFileTypes: true })) {
|
|
11906
11954
|
if (!child.isDirectory() || !isCacheLikeChild(child.name)) continue;
|
|
11907
11955
|
const entry = collectGcEntry(
|
|
11908
|
-
|
|
11956
|
+
join10(rootDir, child.name),
|
|
11909
11957
|
child.name,
|
|
11910
11958
|
now,
|
|
11911
11959
|
opts.minAgeMs,
|
|
@@ -12460,7 +12508,7 @@ async function extractVideoFramesRangeUnredacted(videoPath, videoId, startTime,
|
|
|
12460
12508
|
const normalizedFps = toFps(options.fps);
|
|
12461
12509
|
const fps = fpsToNumber(normalizedFps);
|
|
12462
12510
|
const ffmpegFps = fpsToFfmpegArg(normalizedFps);
|
|
12463
|
-
const videoOutputDir = outputDirOverride ??
|
|
12511
|
+
const videoOutputDir = outputDirOverride ?? join11(outputDir, videoId);
|
|
12464
12512
|
if (!existsSync9(videoOutputDir)) mkdirSync6(videoOutputDir, { recursive: true });
|
|
12465
12513
|
let metadata;
|
|
12466
12514
|
try {
|
|
@@ -12838,8 +12886,8 @@ function decoderForCodec(codec) {
|
|
|
12838
12886
|
return alphaDecoderFor(codec) ?? (codec ?? "").toLowerCase();
|
|
12839
12887
|
}
|
|
12840
12888
|
function resolveFrameFormat(metadata, requested) {
|
|
12841
|
-
|
|
12842
|
-
|
|
12889
|
+
const sidecar = SIDECAR_ALPHA_CODECS.has((metadata.videoCodec ?? "").toLowerCase());
|
|
12890
|
+
if (metadata.hasAlpha || sidecar && metadata.alphaPlaneDecoded !== false) return "png";
|
|
12843
12891
|
if (requested === "png" || requested === "jpg") return requested;
|
|
12844
12892
|
return "jpg";
|
|
12845
12893
|
}
|
|
@@ -12954,7 +13002,7 @@ function planSupersetGroups(misses, fps) {
|
|
|
12954
13002
|
}
|
|
12955
13003
|
function sliceSupersetMember(member, superset, outputDir, fps, configuredFps) {
|
|
12956
13004
|
const { work } = member.miss;
|
|
12957
|
-
|
|
13005
|
+
rmSync5(outputDir, { recursive: true, force: true });
|
|
12958
13006
|
mkdirSync6(outputDir, { recursive: true });
|
|
12959
13007
|
const requestedFrames = extractionFrameCountForDuration(
|
|
12960
13008
|
work.videoDuration,
|
|
@@ -12966,7 +13014,7 @@ function sliceSupersetMember(member, superset, outputDir, fps, configuredFps) {
|
|
|
12966
13014
|
for (let i = 0; i < frameCount; i += 1) {
|
|
12967
13015
|
const sourceFrame = superset.framePaths.get(member.offsetFrames + i);
|
|
12968
13016
|
if (!sourceFrame) throw new Error(`superset frame ${member.offsetFrames + i} missing`);
|
|
12969
|
-
linkOrCopyFrame(sourceFrame,
|
|
13017
|
+
linkOrCopyFrame(sourceFrame, join11(outputDir, frameFileName(i + 1, work.format)));
|
|
12970
13018
|
}
|
|
12971
13019
|
return extractedFramesFromDirectory(work, outputDir, work.videoPath, fps);
|
|
12972
13020
|
}
|
|
@@ -13022,7 +13070,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13022
13070
|
continue;
|
|
13023
13071
|
}
|
|
13024
13072
|
if (isHttpUrl(videoPath)) {
|
|
13025
|
-
const downloadDir =
|
|
13073
|
+
const downloadDir = join11(options.outputDir, DOWNLOAD_SUBDIR);
|
|
13026
13074
|
mkdirSync6(downloadDir, { recursive: true });
|
|
13027
13075
|
videoPath = await downloadToTemp(
|
|
13028
13076
|
videoPath,
|
|
@@ -13063,7 +13111,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13063
13111
|
}
|
|
13064
13112
|
breakdown.resolveMs = Date.now() - phase1Start;
|
|
13065
13113
|
const contentKeyedDirs = [
|
|
13066
|
-
|
|
13114
|
+
join11(options.outputDir, DOWNLOAD_SUBDIR),
|
|
13067
13115
|
...options.contentKeyedDirs ?? []
|
|
13068
13116
|
];
|
|
13069
13117
|
const cacheKeyInputs = resolvedVideos.map(({ video, videoPath }) => {
|
|
@@ -13270,7 +13318,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13270
13318
|
async function extractDirectMiss(miss, maxTransientRetries = options.maxTransientRetries ?? 0) {
|
|
13271
13319
|
const { work, cacheTarget } = miss;
|
|
13272
13320
|
if (!cacheTarget) {
|
|
13273
|
-
const outputDir =
|
|
13321
|
+
const outputDir = join11(options.outputDir, work.video.id);
|
|
13274
13322
|
const attempted2 = await runVideoExtractionWithRetry(
|
|
13275
13323
|
() => extractVideoFramesRange(
|
|
13276
13324
|
work.videoPath,
|
|
@@ -13286,14 +13334,14 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13286
13334
|
maxTransientRetries,
|
|
13287
13335
|
onRetry: () => {
|
|
13288
13336
|
recordTransientRetries(1);
|
|
13289
|
-
|
|
13337
|
+
rmSync5(outputDir, { recursive: true, force: true });
|
|
13290
13338
|
}
|
|
13291
13339
|
}
|
|
13292
13340
|
);
|
|
13293
13341
|
return attempted2.result;
|
|
13294
13342
|
}
|
|
13295
13343
|
const partialDir = partialCacheEntryDir(cacheTarget.entry);
|
|
13296
|
-
|
|
13344
|
+
rmSync5(partialDir, { recursive: true, force: true });
|
|
13297
13345
|
mkdirSync6(partialDir, { recursive: true });
|
|
13298
13346
|
const attempted = await runVideoExtractionWithRetry(
|
|
13299
13347
|
() => extractVideoFramesRange(
|
|
@@ -13311,7 +13359,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13311
13359
|
maxTransientRetries,
|
|
13312
13360
|
onRetry: () => {
|
|
13313
13361
|
recordTransientRetries(1);
|
|
13314
|
-
|
|
13362
|
+
rmSync5(partialDir, { recursive: true, force: true });
|
|
13315
13363
|
mkdirSync6(partialDir, { recursive: true });
|
|
13316
13364
|
}
|
|
13317
13365
|
}
|
|
@@ -13336,7 +13384,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13336
13384
|
const tailFrames = Math.min(expectedFrames, Math.ceil(fps));
|
|
13337
13385
|
if (expectedFrames <= tailFrames) return null;
|
|
13338
13386
|
const deferred = (totalFrames) => {
|
|
13339
|
-
const outputDir =
|
|
13387
|
+
const outputDir = join11(options.outputDir, work.video.id);
|
|
13340
13388
|
mkdirSync6(outputDir, { recursive: true });
|
|
13341
13389
|
return {
|
|
13342
13390
|
videoId: work.video.id,
|
|
@@ -13373,7 +13421,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13373
13421
|
const totalFrames = firstTailFrame + storedTailFrames;
|
|
13374
13422
|
return totalFrames <= expectedFrames * 0.6 ? null : deferred(totalFrames);
|
|
13375
13423
|
}
|
|
13376
|
-
const probeDir =
|
|
13424
|
+
const probeDir = join11(options.outputDir, `${work.video.id}.tail-probe`);
|
|
13377
13425
|
try {
|
|
13378
13426
|
const tail = await extractVideoFramesRange(
|
|
13379
13427
|
work.videoPath,
|
|
@@ -13395,7 +13443,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13395
13443
|
} catch {
|
|
13396
13444
|
return null;
|
|
13397
13445
|
} finally {
|
|
13398
|
-
|
|
13446
|
+
rmSync5(probeDir, { recursive: true, force: true });
|
|
13399
13447
|
}
|
|
13400
13448
|
}
|
|
13401
13449
|
async function executeDirectMiss(miss, maxTransientRetries = options.maxTransientRetries ?? 0) {
|
|
@@ -13412,7 +13460,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13412
13460
|
return sliceSupersetMember(
|
|
13413
13461
|
member,
|
|
13414
13462
|
superset,
|
|
13415
|
-
|
|
13463
|
+
join11(options.outputDir, work.video.id),
|
|
13416
13464
|
fps,
|
|
13417
13465
|
configuredFps
|
|
13418
13466
|
);
|
|
@@ -13429,9 +13477,9 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13429
13477
|
async function executeSupersetGroup(group) {
|
|
13430
13478
|
const first = group.members[0]?.miss.work;
|
|
13431
13479
|
if (!first) return [];
|
|
13432
|
-
const tempDir = cacheRootDir ?
|
|
13480
|
+
const tempDir = cacheRootDir ? join11(cacheRootDir, `${group.groupId}.partial-${process.pid}`) : join11(options.outputDir, group.groupId);
|
|
13433
13481
|
try {
|
|
13434
|
-
|
|
13482
|
+
rmSync5(tempDir, { recursive: true, force: true });
|
|
13435
13483
|
const superset = await extractVideoFramesRange(
|
|
13436
13484
|
first.videoPath,
|
|
13437
13485
|
group.groupId,
|
|
@@ -13464,7 +13512,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
13464
13512
|
);
|
|
13465
13513
|
return fallback;
|
|
13466
13514
|
} finally {
|
|
13467
|
-
|
|
13515
|
+
rmSync5(tempDir, { recursive: true, force: true });
|
|
13468
13516
|
}
|
|
13469
13517
|
}
|
|
13470
13518
|
const preparedExtractions = await Promise.all(
|
|
@@ -13772,7 +13820,7 @@ var FrameLookupTable = class {
|
|
|
13772
13820
|
for (const video of this.videos.values()) {
|
|
13773
13821
|
if (video.extracted.ownedByLookup) continue;
|
|
13774
13822
|
if (existsSync9(video.extracted.outputDir)) {
|
|
13775
|
-
|
|
13823
|
+
rmSync5(video.extracted.outputDir, { recursive: true, force: true });
|
|
13776
13824
|
}
|
|
13777
13825
|
}
|
|
13778
13826
|
this.videos.clear();
|
|
@@ -14270,8 +14318,8 @@ async function queryElementStacking(page, nativeHdrIds) {
|
|
|
14270
14318
|
}
|
|
14271
14319
|
|
|
14272
14320
|
// ../engine/src/services/audioMixer.ts
|
|
14273
|
-
import { closeSync as closeSync4, existsSync as existsSync11, mkdirSync as mkdirSync7, mkdtempSync as
|
|
14274
|
-
import { join as
|
|
14321
|
+
import { closeSync as closeSync4, existsSync as existsSync11, mkdirSync as mkdirSync7, mkdtempSync as mkdtempSync8, openSync as openSync4, rmSync as rmSync9, writeFileSync as writeFileSync7 } from "fs";
|
|
14322
|
+
import { join as join15, dirname as dirname7, isAbsolute, relative } from "path";
|
|
14275
14323
|
|
|
14276
14324
|
// ../engine/src/utils/notMediaPayload.ts
|
|
14277
14325
|
import { createHash as createHash3 } from "crypto";
|
|
@@ -14390,8 +14438,8 @@ import { cpus as cpus2 } from "os";
|
|
|
14390
14438
|
|
|
14391
14439
|
// ../engine/src/services/aacEncode.ts
|
|
14392
14440
|
import { execFile as execFile3 } from "child_process";
|
|
14393
|
-
import { mkdtempSync as
|
|
14394
|
-
import { dirname as dirname5, join as
|
|
14441
|
+
import { mkdtempSync as mkdtempSync5, readFileSync as readFileSync5, rmSync as rmSync6, writeFileSync as writeFileSync4 } from "fs";
|
|
14442
|
+
import { dirname as dirname5, join as join12 } from "path";
|
|
14395
14443
|
var SAMPLE_RATE = 48e3;
|
|
14396
14444
|
var FRAME_SAMPLES = 1024;
|
|
14397
14445
|
var MIN_SEGMENT_SECONDS = 60;
|
|
@@ -14454,11 +14502,11 @@ async function encodeAac(input, outputPath, totalDuration, {
|
|
|
14454
14502
|
if (!await supportsSettsDuration()) {
|
|
14455
14503
|
return encodeInOnePass(input, outputPath, { signal, timeout, filter });
|
|
14456
14504
|
}
|
|
14457
|
-
const dir =
|
|
14505
|
+
const dir = mkdtempSync5(join12(dirname5(outputPath), ".aac-segments-"));
|
|
14458
14506
|
try {
|
|
14459
14507
|
const segments = planSegments(totalDuration, count).map((segment, k) => ({
|
|
14460
14508
|
...segment,
|
|
14461
|
-
path:
|
|
14509
|
+
path: join12(dir, `${k}.aac`)
|
|
14462
14510
|
}));
|
|
14463
14511
|
const results = await Promise.all(
|
|
14464
14512
|
segments.map(
|
|
@@ -14485,7 +14533,7 @@ async function encodeAac(input, outputPath, totalDuration, {
|
|
|
14485
14533
|
);
|
|
14486
14534
|
const failed = results.find((result) => !result.success);
|
|
14487
14535
|
if (failed) return failed;
|
|
14488
|
-
const joined =
|
|
14536
|
+
const joined = join12(dir, "joined.aac");
|
|
14489
14537
|
const frames = segments.flatMap(({ path, keepFrom, keepTo }) => {
|
|
14490
14538
|
const segmentFrames = splitAdtsFrames(readFileSync5(path));
|
|
14491
14539
|
if (segmentFrames.length < keepTo) {
|
|
@@ -14516,7 +14564,7 @@ async function encodeAac(input, outputPath, totalDuration, {
|
|
|
14516
14564
|
const slowest = Math.max(...results.map((result) => result.durationMs));
|
|
14517
14565
|
return { ...muxed, durationMs: slowest + muxed.durationMs };
|
|
14518
14566
|
} finally {
|
|
14519
|
-
|
|
14567
|
+
rmSync6(dir, { recursive: true, force: true });
|
|
14520
14568
|
}
|
|
14521
14569
|
}
|
|
14522
14570
|
|
|
@@ -14619,8 +14667,8 @@ function audioFailureDiagnostics(values) {
|
|
|
14619
14667
|
}
|
|
14620
14668
|
|
|
14621
14669
|
// ../engine/src/services/audioVolumeEnvelope.ts
|
|
14622
|
-
import { mkdtempSync as
|
|
14623
|
-
import { dirname as dirname6, join as
|
|
14670
|
+
import { mkdtempSync as mkdtempSync6, readFileSync as readFileSync6, rmSync as rmSync7, writeFileSync as writeFileSync5 } from "fs";
|
|
14671
|
+
import { dirname as dirname6, join as join13 } from "path";
|
|
14624
14672
|
|
|
14625
14673
|
// ../core/dist/runtime/mediaVolumeEnvelope.js
|
|
14626
14674
|
function normaliseEnvelope(keyframes, trackStart, baseVolume) {
|
|
@@ -14746,8 +14794,8 @@ function applyVolumeEnvelopeToWav(wavPath, keyframes, trackStart, baseVolume) {
|
|
|
14746
14794
|
const layout = parseWavLayout(buffer);
|
|
14747
14795
|
if (!layout) return false;
|
|
14748
14796
|
scaleSamples(buffer, layout, gainAt);
|
|
14749
|
-
stagingDir =
|
|
14750
|
-
const tempPath =
|
|
14797
|
+
stagingDir = mkdtempSync6(join13(dirname6(wavPath), ".hf-volume-"));
|
|
14798
|
+
const tempPath = join13(stagingDir, "audio.wav");
|
|
14751
14799
|
writeFileSync5(tempPath, buffer, { flag: "wx" });
|
|
14752
14800
|
renameWithRetry(tempPath, wavPath);
|
|
14753
14801
|
return true;
|
|
@@ -14756,7 +14804,7 @@ function applyVolumeEnvelopeToWav(wavPath, keyframes, trackStart, baseVolume) {
|
|
|
14756
14804
|
} finally {
|
|
14757
14805
|
if (stagingDir) {
|
|
14758
14806
|
try {
|
|
14759
|
-
|
|
14807
|
+
rmSync7(stagingDir, { recursive: true, force: true });
|
|
14760
14808
|
} catch {
|
|
14761
14809
|
}
|
|
14762
14810
|
}
|
|
@@ -14977,17 +15025,17 @@ function chainTailSeconds(chain, automation) {
|
|
|
14977
15025
|
import {
|
|
14978
15026
|
closeSync as closeSync3,
|
|
14979
15027
|
existsSync as existsSync10,
|
|
14980
|
-
mkdtempSync as
|
|
15028
|
+
mkdtempSync as mkdtempSync7,
|
|
14981
15029
|
openSync as openSync3,
|
|
14982
15030
|
readFileSync as readFileSync7,
|
|
14983
15031
|
readSync,
|
|
14984
|
-
rmSync as
|
|
15032
|
+
rmSync as rmSync8,
|
|
14985
15033
|
statSync as statSync7,
|
|
14986
15034
|
writeFileSync as writeFileSync6,
|
|
14987
15035
|
writeSync as writeSync2
|
|
14988
15036
|
} from "fs";
|
|
14989
|
-
import { tmpdir as
|
|
14990
|
-
import { join as
|
|
15037
|
+
import { tmpdir as tmpdir4 } from "os";
|
|
15038
|
+
import { join as join14 } from "path";
|
|
14991
15039
|
import { pathToFileURL } from "url";
|
|
14992
15040
|
|
|
14993
15041
|
// ../core/dist/generated/audio-fx-runtime-inline.js
|
|
@@ -15339,7 +15387,7 @@ async function applyAudioFxChain(inputWav, chain, outputWav, options) {
|
|
|
15339
15387
|
});
|
|
15340
15388
|
}
|
|
15341
15389
|
async function withFxBrowser(options, body) {
|
|
15342
|
-
const hostDir =
|
|
15390
|
+
const hostDir = mkdtempSync7(join14(tmpdir4(), "hf-fx-host-"));
|
|
15343
15391
|
let lease = null;
|
|
15344
15392
|
try {
|
|
15345
15393
|
if (options.signal?.aborted) {
|
|
@@ -15354,14 +15402,14 @@ async function withFxBrowser(options, body) {
|
|
|
15354
15402
|
`Audio FX failed for track ${options.trackId}: ${err.message}`
|
|
15355
15403
|
);
|
|
15356
15404
|
} finally {
|
|
15357
|
-
|
|
15405
|
+
rmSync8(hostDir, { recursive: true, force: true });
|
|
15358
15406
|
await lease?.release().catch(() => void 0);
|
|
15359
15407
|
}
|
|
15360
15408
|
}
|
|
15361
15409
|
async function openFxPage(browser, hostDir) {
|
|
15362
15410
|
const page = await browser.newPage();
|
|
15363
15411
|
try {
|
|
15364
|
-
const hostPage =
|
|
15412
|
+
const hostPage = join14(hostDir, "audio-fx.html");
|
|
15365
15413
|
writeFileSync6(hostPage, "<!doctype html><meta charset=utf-8><title>audio fx</title>");
|
|
15366
15414
|
await page.goto(pathToFileURL(hostPage).href, {
|
|
15367
15415
|
waitUntil: "domcontentloaded"
|
|
@@ -15826,8 +15874,8 @@ async function extractAudioSegment(srcPath, outputPath, stage, mediaStart, durat
|
|
|
15826
15874
|
});
|
|
15827
15875
|
const loopDuration = (metadata?.durationSeconds ?? 0) - mediaStart;
|
|
15828
15876
|
if (options?.loop && loopDuration > 0 && sourceDuration > loopDuration) {
|
|
15829
|
-
const cycleDir =
|
|
15830
|
-
const cyclePath =
|
|
15877
|
+
const cycleDir = mkdtempSync8(join15(outputDir, ".audio-loop-"));
|
|
15878
|
+
const cyclePath = join15(cycleDir, "cycle.wav");
|
|
15831
15879
|
try {
|
|
15832
15880
|
const cycle = await extractAudioSegment(
|
|
15833
15881
|
srcPath,
|
|
@@ -15873,7 +15921,7 @@ async function extractAudioSegment(srcPath, outputPath, stage, mediaStart, durat
|
|
|
15873
15921
|
failure: failure2
|
|
15874
15922
|
};
|
|
15875
15923
|
} finally {
|
|
15876
|
-
|
|
15924
|
+
rmSync9(cycleDir, { recursive: true, force: true });
|
|
15877
15925
|
}
|
|
15878
15926
|
}
|
|
15879
15927
|
const inputSeek = mediaStart >= (metadata?.latestStreamLeadSeconds ?? 0);
|
|
@@ -16020,8 +16068,8 @@ async function mixAudioTracksFlat(tracks, outputPath, totalDuration, signal, con
|
|
|
16020
16068
|
const runMix = async (ignoreAutomation, useNormalize2) => {
|
|
16021
16069
|
const inputs = [];
|
|
16022
16070
|
tracks.forEach((track) => inputs.push("-i", track.srcPath));
|
|
16023
|
-
const scriptDir =
|
|
16024
|
-
const scriptPath =
|
|
16071
|
+
const scriptDir = mkdtempSync8(join15(outputDir, ".filter-complex-"));
|
|
16072
|
+
const scriptPath = join15(scriptDir, "graph.txt");
|
|
16025
16073
|
const fd = openSync4(scriptPath, "wx", 384);
|
|
16026
16074
|
try {
|
|
16027
16075
|
writeFileSync7(fd, buildFilterComplex(ignoreAutomation, useNormalize2));
|
|
@@ -16052,7 +16100,7 @@ async function mixAudioTracksFlat(tracks, outputPath, totalDuration, signal, con
|
|
|
16052
16100
|
currentArgs[currentArgs.indexOf("-filter_complex_script")] = "-/filter_complex";
|
|
16053
16101
|
return await runFfmpeg(currentArgs, { signal, timeout: ffmpegProcessTimeout });
|
|
16054
16102
|
} finally {
|
|
16055
|
-
|
|
16103
|
+
rmSync9(scriptDir, { recursive: true, force: true });
|
|
16056
16104
|
}
|
|
16057
16105
|
};
|
|
16058
16106
|
let useNormalize = true;
|
|
@@ -16131,8 +16179,8 @@ async function mixGroupMembersFlat(memberTracks, outputPath, totalDuration, sign
|
|
|
16131
16179
|
`${mixInputs}amix=inputs=${memberTracks.length}:duration=longest:dropout_transition=0[mixed];[mixed]volume=${formatFilterNumber(memberTracks.length)}[out]`
|
|
16132
16180
|
);
|
|
16133
16181
|
const filterComplex = [...inputFilters, mixFilter].join(";");
|
|
16134
|
-
const scriptDir =
|
|
16135
|
-
const scriptPath =
|
|
16182
|
+
const scriptDir = mkdtempSync8(join15(outputDir, ".group-filter-complex-"));
|
|
16183
|
+
const scriptPath = join15(scriptDir, "graph.txt");
|
|
16136
16184
|
const fd = openSync4(scriptPath, "wx", 384);
|
|
16137
16185
|
try {
|
|
16138
16186
|
writeFileSync7(fd, filterComplex);
|
|
@@ -16172,7 +16220,7 @@ async function mixGroupMembersFlat(memberTracks, outputPath, totalDuration, sign
|
|
|
16172
16220
|
currentArgs[currentArgs.indexOf("-filter_complex_script")] = "-/filter_complex";
|
|
16173
16221
|
return await runFfmpeg(currentArgs, { signal, timeout: ffmpegProcessTimeout });
|
|
16174
16222
|
} finally {
|
|
16175
|
-
|
|
16223
|
+
rmSync9(scriptDir, { recursive: true, force: true });
|
|
16176
16224
|
}
|
|
16177
16225
|
};
|
|
16178
16226
|
let useNormalize = true;
|
|
@@ -16211,7 +16259,7 @@ async function sumInSlices(tracks, scratchDir, totalDuration, signal, config) {
|
|
|
16211
16259
|
let degradedAutomation = false;
|
|
16212
16260
|
for (let at = 0; at < tracks.length; at += MAX_MIX_INPUTS) {
|
|
16213
16261
|
const id = `sum-${at / MAX_MIX_INPUTS}`;
|
|
16214
|
-
const slicePath =
|
|
16262
|
+
const slicePath = join15(scratchDir, `${id}-slice.wav`);
|
|
16215
16263
|
const slice = await mixGroupMembersFlat(
|
|
16216
16264
|
tracks.slice(at, at + MAX_MIX_INPUTS),
|
|
16217
16265
|
slicePath,
|
|
@@ -16225,7 +16273,7 @@ async function sumInSlices(tracks, scratchDir, totalDuration, signal, config) {
|
|
|
16225
16273
|
running = wavTrack(id, slicePath);
|
|
16226
16274
|
continue;
|
|
16227
16275
|
}
|
|
16228
|
-
const foldedPath =
|
|
16276
|
+
const foldedPath = join15(scratchDir, `${id}.wav`);
|
|
16229
16277
|
const folded = await mixGroupMembersFlat(
|
|
16230
16278
|
[running, wavTrack(`${id}-slice`, slicePath)],
|
|
16231
16279
|
foldedPath,
|
|
@@ -16233,8 +16281,8 @@ async function sumInSlices(tracks, scratchDir, totalDuration, signal, config) {
|
|
|
16233
16281
|
signal,
|
|
16234
16282
|
config
|
|
16235
16283
|
);
|
|
16236
|
-
|
|
16237
|
-
|
|
16284
|
+
rmSync9(running.srcPath, { force: true });
|
|
16285
|
+
rmSync9(slicePath, { force: true });
|
|
16238
16286
|
if (!folded.success) return folded;
|
|
16239
16287
|
running = wavTrack(id, foldedPath);
|
|
16240
16288
|
}
|
|
@@ -16246,14 +16294,14 @@ async function mixGroupMembers(memberTracks, outputPath, totalDuration, signal,
|
|
|
16246
16294
|
return mixGroupMembersFlat(memberTracks, outputPath, totalDuration, signal, config);
|
|
16247
16295
|
}
|
|
16248
16296
|
mkdirSync7(dirname7(outputPath), { recursive: true });
|
|
16249
|
-
const scratchDir =
|
|
16297
|
+
const scratchDir = mkdtempSync8(join15(dirname7(outputPath), ".mix-batches-"));
|
|
16250
16298
|
try {
|
|
16251
16299
|
const summed = await sumInSlices(memberTracks, scratchDir, totalDuration, signal, config);
|
|
16252
16300
|
if (!summed.success) return summed;
|
|
16253
16301
|
renameWithRetry(summed.track.srcPath, outputPath);
|
|
16254
16302
|
return { success: true, degradedAutomation: summed.degradedAutomation };
|
|
16255
16303
|
} finally {
|
|
16256
|
-
|
|
16304
|
+
rmSync9(scratchDir, { recursive: true, force: true });
|
|
16257
16305
|
}
|
|
16258
16306
|
}
|
|
16259
16307
|
async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config) {
|
|
@@ -16261,7 +16309,7 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config)
|
|
|
16261
16309
|
return mixAudioTracksFlat(tracks, outputPath, totalDuration, signal, config);
|
|
16262
16310
|
}
|
|
16263
16311
|
mkdirSync7(dirname7(outputPath), { recursive: true });
|
|
16264
|
-
const scratchDir =
|
|
16312
|
+
const scratchDir = mkdtempSync8(join15(dirname7(outputPath), ".mix-batches-"));
|
|
16265
16313
|
try {
|
|
16266
16314
|
const summed = await sumInSlices(tracks, scratchDir, totalDuration, signal, config);
|
|
16267
16315
|
if (!summed.success) {
|
|
@@ -16287,16 +16335,16 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config)
|
|
|
16287
16335
|
error: summed.degradedAutomation ? "Volume automation exceeded this ffmpeg build's expression limits; rendered at base volume" : mixed.error
|
|
16288
16336
|
} : mixed;
|
|
16289
16337
|
} finally {
|
|
16290
|
-
|
|
16338
|
+
rmSync9(scratchDir, { recursive: true, force: true });
|
|
16291
16339
|
}
|
|
16292
16340
|
}
|
|
16293
16341
|
async function mixThroughFloatSum(tracks, masterChain, outputPath, workDir, totalDuration, signal, config) {
|
|
16294
|
-
const sumPath =
|
|
16342
|
+
const sumPath = join15(workDir, "master-sum.wav");
|
|
16295
16343
|
const mixStart = Date.now();
|
|
16296
16344
|
const sum = await mixAudioTracks(tracks, sumPath, totalDuration, signal, config);
|
|
16297
16345
|
if (!sum.success) return { ...sum, outputPath };
|
|
16298
16346
|
const masterStart = Date.now();
|
|
16299
|
-
const encoderInput = masterChain ? (await applyAudioFxChain(sumPath, masterChain,
|
|
16347
|
+
const encoderInput = masterChain ? (await applyAudioFxChain(sumPath, masterChain, join15(workDir, "master-fx.wav"), {
|
|
16300
16348
|
trackId: "master",
|
|
16301
16349
|
signal
|
|
16302
16350
|
})).path : sumPath;
|
|
@@ -16440,7 +16488,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
16440
16488
|
}
|
|
16441
16489
|
let audioSrcPath = srcPath;
|
|
16442
16490
|
if (element.type === "video") {
|
|
16443
|
-
const extractedPath =
|
|
16491
|
+
const extractedPath = join15(workDir, `${element.id}-extracted.wav`);
|
|
16444
16492
|
const extractResult = await extractAudioSegment(
|
|
16445
16493
|
srcPath,
|
|
16446
16494
|
extractedPath,
|
|
@@ -16468,7 +16516,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
16468
16516
|
}
|
|
16469
16517
|
audioSrcPath = extractedPath;
|
|
16470
16518
|
} else {
|
|
16471
|
-
const trimmedPath =
|
|
16519
|
+
const trimmedPath = join15(workDir, `${element.id}-trimmed.wav`);
|
|
16472
16520
|
const prepResult = await extractAudioSegment(
|
|
16473
16521
|
srcPath,
|
|
16474
16522
|
trimmedPath,
|
|
@@ -16520,7 +16568,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
16520
16568
|
const fxResult = await applyAudioFxChain(
|
|
16521
16569
|
audioSrcPath,
|
|
16522
16570
|
chain,
|
|
16523
|
-
|
|
16571
|
+
join15(workDir, `${element.id}-fx.wav`),
|
|
16524
16572
|
{
|
|
16525
16573
|
trackId: element.id,
|
|
16526
16574
|
signal: effectiveSignal,
|
|
@@ -16573,7 +16621,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
16573
16621
|
).catch((err) => {
|
|
16574
16622
|
internalController.abort();
|
|
16575
16623
|
try {
|
|
16576
|
-
|
|
16624
|
+
rmSync9(workDir, { recursive: true, force: true });
|
|
16577
16625
|
} catch {
|
|
16578
16626
|
}
|
|
16579
16627
|
throw err;
|
|
@@ -16598,7 +16646,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
16598
16646
|
});
|
|
16599
16647
|
const removeWorkDir = () => {
|
|
16600
16648
|
try {
|
|
16601
|
-
|
|
16649
|
+
rmSync9(workDir, { recursive: true, force: true });
|
|
16602
16650
|
} catch {
|
|
16603
16651
|
}
|
|
16604
16652
|
};
|
|
@@ -16643,7 +16691,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
16643
16691
|
const meta = groupMeta.get(groupId);
|
|
16644
16692
|
if (!meta) continue;
|
|
16645
16693
|
const pathId = safePathSegment(groupId, groupIndex);
|
|
16646
|
-
const groupWavPath =
|
|
16694
|
+
const groupWavPath = join15(workDir, `group-${pathId}.wav`);
|
|
16647
16695
|
try {
|
|
16648
16696
|
const subMix = await mixGroupMembers(
|
|
16649
16697
|
memberTracks,
|
|
@@ -16676,7 +16724,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
16676
16724
|
const fxResult = await applyAudioFxChain(
|
|
16677
16725
|
groupSrcPath,
|
|
16678
16726
|
chain,
|
|
16679
|
-
|
|
16727
|
+
join15(workDir, `group-${pathId}-fx.wav`),
|
|
16680
16728
|
{
|
|
16681
16729
|
trackId: groupId,
|
|
16682
16730
|
signal: effectiveSignal,
|
|
@@ -16758,21 +16806,21 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
16758
16806
|
import { cpus as cpus3, freemem } from "os";
|
|
16759
16807
|
import { existsSync as existsSync12, mkdirSync as mkdirSync8, readdirSync as readdirSync6 } from "fs";
|
|
16760
16808
|
import { copyFile, readFile as readFile2 } from "fs/promises";
|
|
16761
|
-
import { join as
|
|
16809
|
+
import { join as join17 } from "path";
|
|
16762
16810
|
import { getHeapStatistics } from "v8";
|
|
16763
16811
|
|
|
16764
16812
|
// ../engine/src/utils/psnr.ts
|
|
16765
16813
|
import { execFile as execFile4 } from "child_process";
|
|
16766
16814
|
import { mkdtemp, rm, writeFile } from "fs/promises";
|
|
16767
|
-
import { tmpdir as
|
|
16768
|
-
import { join as
|
|
16815
|
+
import { tmpdir as tmpdir5 } from "os";
|
|
16816
|
+
import { join as join16 } from "path";
|
|
16769
16817
|
import { promisify as promisify3 } from "util";
|
|
16770
16818
|
async function psnrDb(a, b) {
|
|
16771
16819
|
const execFileP = promisify3(execFile4);
|
|
16772
|
-
const dir = await mkdtemp(
|
|
16820
|
+
const dir = await mkdtemp(join16(tmpdir5(), "hf-de-verify-"));
|
|
16773
16821
|
try {
|
|
16774
|
-
const pa =
|
|
16775
|
-
const pb =
|
|
16822
|
+
const pa = join16(dir, "a.jpg");
|
|
16823
|
+
const pb = join16(dir, "b.jpg");
|
|
16776
16824
|
await Promise.all([writeFile(pa, a), writeFile(pb, b)]);
|
|
16777
16825
|
const { stderr } = await execFileP(
|
|
16778
16826
|
getFfmpegBinary(),
|
|
@@ -16996,7 +17044,7 @@ function distributeFrames(totalFrames, workerCount, workDir, rangeStart = 0) {
|
|
|
16996
17044
|
workerId: i,
|
|
16997
17045
|
startFrame,
|
|
16998
17046
|
endFrame,
|
|
16999
|
-
outputDir:
|
|
17047
|
+
outputDir: join17(workDir, `worker-${i}`),
|
|
17000
17048
|
outputFrameOffset: rangeStart
|
|
17001
17049
|
});
|
|
17002
17050
|
}
|
|
@@ -17010,7 +17058,7 @@ function distributeFramesInterleaved(totalFrames, workerCount, workDir, rangeSta
|
|
|
17010
17058
|
startFrame: rangeStart + i,
|
|
17011
17059
|
endFrame: rangeStart + totalFrames,
|
|
17012
17060
|
frameStride: workerCount,
|
|
17013
|
-
outputDir:
|
|
17061
|
+
outputDir: join17(workDir, `worker-${i}`),
|
|
17014
17062
|
outputFrameOffset: rangeStart
|
|
17015
17063
|
});
|
|
17016
17064
|
}
|
|
@@ -17212,7 +17260,7 @@ async function verifyDiskDrawElementSamples(session, task, streaming) {
|
|
|
17212
17260
|
for (const idx of selectVerifySampleIndicesForTask(truths.keys(), task)) {
|
|
17213
17261
|
const truth = truths.get(idx);
|
|
17214
17262
|
if (!truth) continue;
|
|
17215
|
-
const framePath =
|
|
17263
|
+
const framePath = join17(task.outputDir, `frame_${String(idx - offset).padStart(6, "0")}.${ext}`);
|
|
17216
17264
|
const db = await psnrForDiskSample(framePath, truth, task.workerId, idx);
|
|
17217
17265
|
if (db === null) continue;
|
|
17218
17266
|
assertDiskSampleAboveFloor(db, verifyMinDb, idx, task.workerId);
|
|
@@ -17457,8 +17505,8 @@ async function mergeWorkerFrames(workDir, tasks, outputDir) {
|
|
|
17457
17505
|
}
|
|
17458
17506
|
const files = readdirSync6(task.outputDir).filter((f) => f.startsWith("frame_") && (f.endsWith(".jpg") || f.endsWith(".png"))).sort();
|
|
17459
17507
|
const copyTasks = files.map(async (file) => {
|
|
17460
|
-
const sourcePath =
|
|
17461
|
-
const targetPath =
|
|
17508
|
+
const sourcePath = join17(task.outputDir, file);
|
|
17509
|
+
const targetPath = join17(outputDir, file);
|
|
17462
17510
|
try {
|
|
17463
17511
|
await renameWithRetryAsync(sourcePath, targetPath);
|
|
17464
17512
|
} catch {
|
|
@@ -17483,7 +17531,7 @@ function getSystemResources() {
|
|
|
17483
17531
|
import { Hono } from "hono";
|
|
17484
17532
|
import { serve } from "@hono/node-server";
|
|
17485
17533
|
import { readFileSync as readFileSync8, openSync as openSync5, fstatSync, closeSync as closeSync5, statSync as statSync8, constants } from "fs";
|
|
17486
|
-
import { join as
|
|
17534
|
+
import { join as join18, extname as extname3 } from "path";
|
|
17487
17535
|
var MIME_TYPES = {
|
|
17488
17536
|
".html": "text/html; charset=utf-8",
|
|
17489
17537
|
".css": "text/css; charset=utf-8",
|
|
@@ -17530,10 +17578,10 @@ function readRegularFile(filePath) {
|
|
|
17530
17578
|
}
|
|
17531
17579
|
}
|
|
17532
17580
|
function resolveContainedPaths(projectDir, compiledDir, relativePath) {
|
|
17533
|
-
const projectPath =
|
|
17581
|
+
const projectPath = join18(projectDir, relativePath);
|
|
17534
17582
|
if (!isWithinProjectRoot(projectDir, projectPath)) return null;
|
|
17535
17583
|
if (!compiledDir) return { projectPath, compiledPath: null };
|
|
17536
|
-
const compiledPath =
|
|
17584
|
+
const compiledPath = join18(compiledDir, relativePath);
|
|
17537
17585
|
if (!isWithinProjectRoot(compiledDir, compiledPath)) return null;
|
|
17538
17586
|
return { projectPath, compiledPath };
|
|
17539
17587
|
}
|