0?20*Math.log10(o):Number.NEGATIVE_INFINITY}function Ne(e,t,n,r,a){if(e.length===0||r.duckDb<=0)return[];let o=Math.max(d,Math.ceil(e.length/X)),s=Math.round(a*n),i=[],u=[],l=[];for(let x=0;x =P;)m+=p*-m,v+=b,g.push({t:Number(v.toFixed(3)),v:m =F||k.push({t:F,v:0}),k}function Ce(e){let t=e.map(n=>({type:"peaking",enabled:!0,params:{...O("peaking"),frequency:n.freq,gain:n.gainDb,q:n.q}}));return{version:E,nodes:t}}import{isAbsolute as De,relative as Je,resolve as Qe,sep as Ze}from"node:path";function R(e){return e.normalize("NFKC").toUpperCase().toLowerCase().replace(/\p{Default_Ignorable_Code_Point}/gu,"").split(/[\\/]/).map(t=>Ee(t.split(":",1)[0]??""))}function Ee(e){let t=e.length;for(;t>0&&(e[t-1]==="."||e[t-1]===" ");)t--;return e.slice(0,t)}function He(e){return R(e).some(t=>t===".git"||t.startsWith(".env"))}var Se=new Set([".hyperframes/studio-motion.json",".hyperframes/studio-manual-edits.json"]),_e=[".hyperframes/prepared-assets",".hyperframes/requests"],Z=".hyperframes/prepared-assets/downloads",Me=new Set([".npmrc",".yarnrc",".yarnrc.yml",".pypirc","pip.conf","pip.ini",".netrc","_netrc",".git-credentials",".gitconfig",".mcp.json","credentials.json","serviceaccountkey.json","service-account.json","service_account.json"]),Pe=new Set([".ssh",".aws",".gnupg",".docker",".kube",".azure",".claude",".codex",".cursor",".agents",".gemini",".vscode",".idea"]),Ie=new Set(["gcloud","gh"]),Te=/^(?:id_(?:rsa|dsa|ecdsa|ed25519).*|.*\.(?:pem|key|p12|pfx|p8|ppk|jks|keystore|kdbx))$/,qe=/\.(?:tfstate(?:\.backup)?|tfvars(?:\.json)?)$/;function Oe(e){let t=R(e),n=t.at(-1)??"";return Me.has(n)||Te.test(n)||qe.test(n)||t.some((r,a)=>Pe.has(r)||r===".config"&&Ie.has(t[a+1]??""))}function Be(e){if(He(e)||Oe(e))return!0;let t=R(e),n=!De(e)&&!/^\.\.[. ]*$/.test(e.split(/[\\/]/,1)[0]??""),r=t.at(-1)??"",a=!r.startsWith(".")&&Ue.test(r);return t.some((o,s)=>{let i=t.slice(0,s).every(l=>l==="");if(o===".hyperframes")return!i||!Ve(t.slice(s).join("/"));if(Le.has(o))return n;let u=i&&o===Re;return n&&o.startsWith(".")&&!u&&!a})}var Re=".media",Le=new Set([".next",".nuxt",".output",".svelte-kit",".vercel",".netlify",".wrangler",".astro",".turbo"]),Ue=/.\.(?:png|jpe?g|gif|webp|avif|svg|ico|bmp|tiff?|heic|heif|mp4|m4v|mov|webm|mkv|mxf|avi|mp3|wav|m4a|aac|ogg|oga|opus|flac|woff2?|ttf|otf|css|m?js|cjs)$/;function Ve(e){return e===Z||e.startsWith(`${Z}/`)?!1:Se.has(e)||_e.some(t=>e===t||e.startsWith(`${t}/`))}export{we as analyseCarveBands,Ne as analyseCarveDuck,Fe as analyseCarveDynamics,Ce as carveBandsToChain,he as carveProfile,pe as classifyAudioName,be as clipsOverlap,O as defaultAudioFxParams,Be as isStudioPrivatePath,ae as mintAudioFxNodeId,ge as mixCarveSources,ne as parseAudioFxChain,re as serializeAudioFxChain};
diff --git a/skills/media-use/audio/scripts/lib/media-input.mjs b/skills/media-use/audio/scripts/lib/media-input.mjs
new file mode 100644
index 0000000000..8366b8750e
--- /dev/null
+++ b/skills/media-use/audio/scripts/lib/media-input.mjs
@@ -0,0 +1,58 @@
+// media-input.mjs — ffmpeg input that reads one local media file and opens nothing that file names.
+import "../../../scripts/lib/windows-exe-search.mjs";
+import { spawnSync } from "node:child_process";
+
+// Formats whose file is a list, playlist or script naming other media or programs, which ffmpeg would then
+// open. A media input must be the media itself, so these are refused.
+const INDIRECT_FORMATS = new Set([
+ "hls",
+ "applehttp",
+ "concat",
+ "dash",
+ "webm_dash_manifest",
+ "imf",
+ "sdp",
+ "rtp",
+ "rtsp",
+ "ffmetadata",
+ "image2",
+ "avisynth",
+ "vapoursynth",
+]);
+
+// The demuxer name for src, such as "mp3" or "mov,mp4,m4a,3gp,3g2,mj2"; null when it cannot tell. Some
+// Windows installs ship ffmpeg without ffprobe, so ffmpeg's input banner is the fallback.
+export function probeFormat(src) {
+ const r = spawnSync(
+ "ffprobe",
+ ["-v", "error", "-protocol_whitelist", "file", "-show_entries", "format=format_name"].concat([
+ "-of",
+ "default=nw=1:nk=1",
+ "--",
+ src,
+ ]),
+ { encoding: "utf8" },
+ );
+ if (r.error?.code === "ENOENT") {
+ const banner = spawnSync("ffmpeg", ["-hide_banner", "-protocol_whitelist", "file", "-i", src], {
+ encoding: "utf8",
+ });
+ return /^Input #0, (.+?), from /m.exec(banner.stderr ?? "")?.[1] ?? null;
+ }
+ const name = r.status === 0 ? String(r.stdout).trim() : "";
+ return name || null;
+}
+
+/** True when a probed format is a list, playlist or script that names other files. */
+export const isIndirectFormat = (format) =>
+ format.split(",").some((name) => INDIRECT_FORMATS.has(name));
+
+/** ffmpeg input arguments pinned to the probed format and the file protocol: only `src` is opened. */
+export const pinnedInput = (format, src) => [
+ "-format_whitelist",
+ format,
+ "-protocol_whitelist",
+ "file",
+ "-i",
+ src,
+];
diff --git a/skills/media-use/audio/scripts/lib/recording.mjs b/skills/media-use/audio/scripts/lib/recording.mjs
index 7470037bde..2eaa8b56b3 100644
--- a/skills/media-use/audio/scripts/lib/recording.mjs
+++ b/skills/media-use/audio/scripts/lib/recording.mjs
@@ -5,6 +5,7 @@ import { assertLiteralMediaPath } from "../../../scripts/lib/literal-media-input
import { spawnSync } from "node:child_process";
import { existsSync, mkdirSync, statSync } from "node:fs";
import { dirname } from "node:path";
+import { isIndirectFormat, pinnedInput, probeFormat } from "./media-input.mjs";
import { projectPath } from "./project-path.mjs";
// ffmpeg's atempo takes 0.5..2 per stage; chain stages for the rest of the 0.1..3 speed range.
@@ -32,47 +33,6 @@ export function recordingSource(hyperframesDir, audio) {
);
}
-// Formats whose file is a list, playlist or script naming other media or programs, which ffmpeg would then
-// open. A recording must be the audio itself, so these are refused.
-const INDIRECT_FORMATS = new Set([
- "hls",
- "applehttp",
- "concat",
- "dash",
- "webm_dash_manifest",
- "imf",
- "sdp",
- "rtp",
- "rtsp",
- "ffmetadata",
- "image2",
- "avisynth",
- "vapoursynth",
-]);
-
-// The demuxer name for src, such as "mp3" or "mov,mp4,m4a,3gp,3g2,mj2"; null when it cannot tell. Some
-// Windows installs ship ffmpeg without ffprobe, so ffmpeg's input banner is the fallback.
-function probeFormat(src) {
- const r = spawnSync(
- "ffprobe",
- ["-v", "error", "-protocol_whitelist", "file", "-show_entries", "format=format_name"].concat([
- "-of",
- "default=nw=1:nk=1",
- "--",
- src,
- ]),
- { encoding: "utf8" },
- );
- if (r.error?.code === "ENOENT") {
- const banner = spawnSync("ffmpeg", ["-hide_banner", "-protocol_whitelist", "file", "-i", src], {
- encoding: "utf8",
- });
- return /^Input #0, (.+?), from /m.exec(banner.stderr ?? "")?.[1] ?? null;
- }
- const name = r.status === 0 ? String(r.stdout).trim() : "";
- return name || null;
-}
-
/** src -> 44.1k mono wav at wavAbs, played `speed` times faster. Returns { ok, error? }. */
export function stretchToWav(src, wavAbs, speed = 1) {
try {
@@ -85,7 +45,7 @@ export function stretchToWav(src, wavAbs, speed = 1) {
if (!stat.isFile()) return { ok: false, error: `recording is not a file: ${src}` };
const format = probeFormat(src);
if (!format) return { ok: false, error: `ffmpeg cannot read ${src} as audio` };
- if (format.split(",").some((name) => INDIRECT_FORMATS.has(name))) {
+ if (isIndirectFormat(format)) {
return {
ok: false,
error: `${src} is a ${format} list that points at other files; give the audio file itself`,
@@ -94,7 +54,7 @@ export function stretchToWav(src, wavAbs, speed = 1) {
mkdirSync(dirname(wavAbs), { recursive: true });
const filter = speed === 1 ? [] : ["-af", atempoChain(speed)];
// The probed format pins the input: ffmpeg opens only that one local file, with no nested inputs.
- const input = ["-format_whitelist", format, "-protocol_whitelist", "file", "-i", src];
+ const input = pinnedInput(format, src);
const r = spawnSync(
"ffmpeg",
["-y", "-loglevel", "error", ...input, ...filter, "-ar", "44100", "-ac", "1", wavAbs],
diff --git a/skills/media-use/references/mixing.md b/skills/media-use/references/mixing.md
index 8557eca386..a4d6813377 100644
--- a/skills/media-use/references/mixing.md
+++ b/skills/media-use/references/mixing.md
@@ -65,7 +65,7 @@ A crossfade is two clips on different tracks that overlap, each with a fade.
## Music under a voice
-Duck the bed with a `volume` lane on the music: full level before the voice, down to about 0.3–0.4 while anyone speaks (word timings from `npx hyperframes transcribe` or the voiceover give the times), back up after. Then carve the bed, which dips only the bands the voice uses: `node