mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-25 08:32:45 +00:00
fix(media-use): carve decodes only media files inside the composition's folder (#8649)
* fix(media-use): carve decodes only media files inside the composition's folder carve.mjs resolved each media src from the composition and handed the result to ffmpeg, so an absolute, climbing, UNC or linked name reached a file outside the project, and a playlist inside the project was followed to the files it lists. Each src must now be a relative name that lands on a regular file inside the composition's folder after links are resolved, outside the files the project keeps private, and free of ffmpeg pattern characters. Every source is checked before any is decoded. ffmpeg then reads the one file, pinned to its probed format and the file protocol, and a list or playlist format is refused. The probe and the pinned input move from recording.mjs into lib/media-input.mjs so both scripts share them. The private-path rule and the image2 pattern guard are bundled into audio-carve.mjs from packages/parsers. * fix(media-use): media-input.mjs loads the Windows program guard first Every skill script that starts programs imports windows-exe-search.mjs before anything else, so ffprobe and ffmpeg are never looked up in the working directory on Windows.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
// Bundles the carve analysis carve.mjs uses (packages/core/src/audioCarve.ts and audioFx.ts) into a single
|
||||
// Bundles the carve analysis carve.mjs uses (packages/core/src/audioCarve.ts and audioFx.ts), and the private-path
|
||||
// rule it checks sources with (packages/parsers/src/privatePath.ts), into a single
|
||||
// import-free .mjs beside the skill, so the skill never loads @hyperframes/core from the project it edits.
|
||||
// Regenerate after editing the source: node scripts/generate-media-use-audio-carve.mjs
|
||||
import { writeFileSync } from "node:fs";
|
||||
@@ -29,11 +30,13 @@ export {
|
||||
parseAudioFxChain,
|
||||
serializeAudioFxChain,
|
||||
} from "./audioFx.ts";
|
||||
export { isStudioPrivatePath } from "../../parsers/src/privatePath.ts";
|
||||
`;
|
||||
|
||||
const HEADER = `// GENERATED: do not hand-edit. Source: packages/core/src/audioCarve.ts and audioFx.ts, bundled by
|
||||
// scripts/generate-media-use-audio-carve.mjs so carve.mjs runs the same analysis as Studio without
|
||||
// loading @hyperframes/core from the project. Regenerate: node scripts/generate-media-use-audio-carve.mjs
|
||||
const HEADER = `// GENERATED: do not hand-edit. Source: packages/core/src/audioCarve.ts and audioFx.ts, and
|
||||
// packages/parsers/src/privatePath.ts, bundled by scripts/generate-media-use-audio-carve.mjs so carve.mjs
|
||||
// runs the same analysis and private-path rule as Studio without loading @hyperframes/core from the project.
|
||||
// Regenerate: node scripts/generate-media-use-audio-carve.mjs
|
||||
`;
|
||||
|
||||
export async function generate() {
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
"files": 13
|
||||
},
|
||||
"media-use": {
|
||||
"hash": "277f0f64db23b1dd",
|
||||
"files": 132
|
||||
"hash": "c0276ffe1b181f43",
|
||||
"files": 133
|
||||
},
|
||||
"remotion-to-hyperframes": {
|
||||
"hash": "3a1dd4a513701ef6",
|
||||
|
||||
@@ -25,10 +25,12 @@
|
||||
|
||||
import "../../scripts/lib/windows-exe-search.mjs";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { readFileSync, writeFileSync } from "node:fs";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { readFileSync, realpathSync, statSync, writeFileSync } from "node:fs";
|
||||
import { dirname, relative, resolve, sep } from "node:path";
|
||||
import * as carveApi from "./lib/audio-carve.mjs";
|
||||
import { isMainModule } from "./lib/main-module.mjs";
|
||||
import { isIndirectFormat, pinnedInput, probeFormat } from "./lib/media-input.mjs";
|
||||
import { projectPath } from "./lib/project-path.mjs";
|
||||
import { assertLiteralMediaPath } from "../../scripts/lib/literal-media-input.mjs";
|
||||
|
||||
/** Sample rate the analysis runs at. Matches Studio's own decode rate, so the
|
||||
@@ -170,18 +172,48 @@ export function groupSourceRefusal(voices, bed, members) {
|
||||
return strays.length > 0 ? { group, reason: "mixed", ids: strays } : null;
|
||||
}
|
||||
|
||||
/** Mono float PCM for one media file, via ffmpeg. */
|
||||
// A URL scheme, or a Windows drive name such as `C:` that a relative-looking name can start with.
|
||||
const SCHEME_OR_DRIVE = /^[a-z][a-z0-9+.-]*:/i;
|
||||
|
||||
/**
|
||||
* The file a composition's media `src` names. Only a relative name that lands on a regular file inside the
|
||||
* composition's folder, with links resolved, is accepted. Absolute, UNC, drive, URL and climbing names, and
|
||||
* files the project keeps private, throw before anything opens them.
|
||||
*/
|
||||
export function mediaSource(compDir, src) {
|
||||
const shown = JSON.stringify(src);
|
||||
const path = SCHEME_OR_DRIVE.test(src) ? null : projectPath(compDir, src);
|
||||
if (!path) {
|
||||
throw new Error(
|
||||
`media ${shown} is outside the composition's folder; copy it into the project and name it from there`,
|
||||
);
|
||||
}
|
||||
const rel = relative(realpathSync(compDir), path).split(sep).join("/");
|
||||
if (carveApi.isStudioPrivatePath(src) || carveApi.isStudioPrivatePath(rel)) {
|
||||
throw new Error(`media ${shown} is a private project file, so carve does not read it`);
|
||||
}
|
||||
if (!statSync(path, { throwIfNoEntry: false })?.isFile()) {
|
||||
throw new Error(`media ${shown} is not a file in the project`);
|
||||
}
|
||||
assertLiteralMediaPath(path);
|
||||
return path;
|
||||
}
|
||||
|
||||
/** Mono float PCM for one media file, via ffmpeg reading that file alone. */
|
||||
function decode(path) {
|
||||
const format = probeFormat(path);
|
||||
if (!format) fail(`could not decode ${path}: ffmpeg cannot read it as media`);
|
||||
if (isIndirectFormat(format)) {
|
||||
fail(`${path} is a ${format} list that points at other files; give the media file itself`);
|
||||
}
|
||||
let raw;
|
||||
try {
|
||||
assertLiteralMediaPath(path);
|
||||
raw = execFileSync(
|
||||
"ffmpeg",
|
||||
[
|
||||
"-v",
|
||||
"error",
|
||||
"-i",
|
||||
path,
|
||||
...pinnedInput(format, path),
|
||||
"-vn",
|
||||
"-ac",
|
||||
"1",
|
||||
@@ -340,12 +372,21 @@ async function main() {
|
||||
);
|
||||
|
||||
const profile = carveApi.carveProfile(args.strength);
|
||||
// Every source is checked before any is decoded, so a refused name stops the carve with no ffmpeg run.
|
||||
let voicePaths;
|
||||
let bedPath = null;
|
||||
try {
|
||||
voicePaths = voices.map((v) => mediaSource(compDir, unescapeAttr(attrOf(v.tag, "src"))));
|
||||
if (profile.duckDb > 0) bedPath = mediaSource(compDir, unescapeAttr(bedSrc));
|
||||
} catch (error) {
|
||||
fail(error.message);
|
||||
}
|
||||
// Every voice summed onto the BED's clock before anything is measured. One
|
||||
// question — where and when is speech masking this bed — with one answer, even
|
||||
// when the answer comes from several people at different times.
|
||||
const voice = carveApi.mixCarveSources(
|
||||
voices.map((v) => ({
|
||||
samples: decode(resolve(compDir, unescapeAttr(attrOf(v.tag, "src")))),
|
||||
voices.map((v, i) => ({
|
||||
samples: decode(voicePaths[i]),
|
||||
offsetSeconds: startOf(v.tag) - startOf(bedTag),
|
||||
})),
|
||||
SAMPLE_RATE,
|
||||
@@ -356,7 +397,7 @@ async function main() {
|
||||
// The level half of the carve needs both sides: "how far over the speech is this
|
||||
// bed" cannot be answered by listening to one of them. No offset — the mix is
|
||||
// already on the bed's clock.
|
||||
const bed = profile.duckDb > 0 ? decode(resolve(compDir, unescapeAttr(bedSrc))) : null;
|
||||
const bed = bedPath ? decode(bedPath) : null;
|
||||
const duck = bed ? carveApi.analyseCarveDuck(voice, bed, SAMPLE_RATE, profile, 0) : [];
|
||||
|
||||
// Anything the author built by hand survives a carve; only the previous
|
||||
|
||||
@@ -1,19 +1,26 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { execFileSync, spawnSync } from "node:child_process";
|
||||
import {
|
||||
existsSync,
|
||||
mkdirSync,
|
||||
mkdtempSync,
|
||||
readFileSync,
|
||||
realpathSync,
|
||||
rmSync,
|
||||
symlinkSync,
|
||||
writeFileSync,
|
||||
} from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join } from "node:path";
|
||||
import { delimiter, dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { DEFAULT_STRENGTH, carveSources, groupSourceRefusal, parseArgs } from "./carve.mjs";
|
||||
import {
|
||||
DEFAULT_STRENGTH,
|
||||
carveSources,
|
||||
groupSourceRefusal,
|
||||
mediaSource,
|
||||
parseArgs,
|
||||
} from "./carve.mjs";
|
||||
|
||||
const SCRIPTS_DIR = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
@@ -280,3 +287,147 @@ test("the default strength is 0.8, and --strength still overrides it", () => {
|
||||
assert.equal(parseArgs(["--comp", "x.html"]).strength, 0.8);
|
||||
assert.equal(parseArgs(["--comp", "x.html", "--strength", "0.25"]).strength, 0.25);
|
||||
});
|
||||
|
||||
test("mediaSource accepts a regular file inside the composition's folder, by its real path", () =>
|
||||
inTempDir((dir) => {
|
||||
mkdirSync(join(dir, "assets"));
|
||||
writeFileSync(join(dir, "assets", "vo.wav"), "x");
|
||||
writeFileSync(join(dir, "bed.mp3"), "x");
|
||||
const real = realpathSync(dir);
|
||||
assert.equal(mediaSource(dir, "assets/vo.wav"), join(real, "assets", "vo.wav"));
|
||||
assert.equal(mediaSource(dir, "./bed.mp3"), join(real, "bed.mp3"));
|
||||
assert.equal(mediaSource(dir, "assets/../bed.mp3"), join(real, "bed.mp3"));
|
||||
}));
|
||||
|
||||
test("mediaSource refuses every name that leaves the folder, before opening it", () =>
|
||||
inTempDir((dir) => {
|
||||
const project = join(dir, "project");
|
||||
mkdirSync(project);
|
||||
const outside = join(dir, "secret.wav");
|
||||
writeFileSync(outside, "x");
|
||||
symlinkSync(outside, join(project, "linked.wav"));
|
||||
for (const src of [
|
||||
outside,
|
||||
"../secret.wav",
|
||||
"//attacker.example/share/x.mp3",
|
||||
"\\\\attacker.example\\share\\x.mp3",
|
||||
"C:secret.wav",
|
||||
"C:\\secret.wav",
|
||||
"file:///etc/hosts",
|
||||
"http://attacker.example/x.mp3",
|
||||
"linked.wav",
|
||||
]) {
|
||||
assert.throws(() => mediaSource(project, src), /outside the composition's folder/, src);
|
||||
}
|
||||
}));
|
||||
|
||||
test("mediaSource refuses private files, folders, missing files and ffmpeg patterns", () =>
|
||||
inTempDir((dir) => {
|
||||
mkdirSync(join(dir, ".git"));
|
||||
mkdirSync(join(dir, "folder.wav"));
|
||||
for (const name of [".env", ".git/config", "id_rsa.wav", "take%d.png"]) {
|
||||
writeFileSync(join(dir, name), "x");
|
||||
}
|
||||
assert.throws(() => mediaSource(dir, ".env"), /private project file/);
|
||||
assert.throws(() => mediaSource(dir, ".git/config"), /private project file/);
|
||||
assert.throws(() => mediaSource(dir, "folder.wav"), /not a file in the project/);
|
||||
assert.throws(() => mediaSource(dir, "missing.wav"), /not a file in the project/);
|
||||
assert.throws(() => mediaSource(dir, "take%d.png"), /pattern of other files/);
|
||||
}));
|
||||
|
||||
/** A composition with a music bed and one narration track, both named by `src`. */
|
||||
function writeComposition(dir, voiceSrc, bedSrc = "bed.wav") {
|
||||
writeFileSync(
|
||||
join(dir, "index.html"),
|
||||
`<audio id="music-bed" src="${bedSrc}" data-start="0"></audio>\n` +
|
||||
`<audio id="narration" src="${voiceSrc}" data-start="0"></audio>\n`,
|
||||
);
|
||||
}
|
||||
|
||||
const runCarve = (cwd, env = process.env) =>
|
||||
spawnSync(process.execPath, [join(SCRIPTS_DIR, "carve.mjs"), "--comp", "index.html"], {
|
||||
cwd,
|
||||
env,
|
||||
encoding: "utf8",
|
||||
});
|
||||
|
||||
test(
|
||||
"a composition naming an outside file or a UNC host stops before any ffmpeg process starts",
|
||||
{ skip: process.platform === "win32" && "the stand-in ffmpeg is a shell script" },
|
||||
() =>
|
||||
inTempDir((dir) => {
|
||||
const bin = join(dir, "bin");
|
||||
const ran = join(dir, "ffmpeg-ran");
|
||||
mkdirSync(bin);
|
||||
for (const tool of ["ffmpeg", "ffprobe"]) {
|
||||
writeFileSync(join(bin, tool), `#!/bin/sh\necho "$0 $*" >> "${ran}"\nexit 1\n`, {
|
||||
mode: 0o755,
|
||||
});
|
||||
}
|
||||
const project = join(dir, "project");
|
||||
mkdirSync(project);
|
||||
writeFileSync(join(project, "bed.wav"), "x");
|
||||
writeFileSync(join(dir, "secret.wav"), "x");
|
||||
const env = { ...process.env, PATH: `${bin}${delimiter}${process.env.PATH}` };
|
||||
for (const src of ["../secret.wav", "//attacker.example/share/x.mp3"]) {
|
||||
writeComposition(project, src);
|
||||
const before = readFileSync(join(project, "index.html"), "utf8");
|
||||
const run = runCarve(project, env);
|
||||
assert.equal(run.status, 1, run.stderr);
|
||||
assert.match(run.stderr, /outside the composition's folder/);
|
||||
assert.equal(existsSync(ran), false, `ffmpeg ran for ${src}`);
|
||||
assert.equal(readFileSync(join(project, "index.html"), "utf8"), before);
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
const tone = (path, seconds = 2, frequency = 440) =>
|
||||
spawnSync(
|
||||
"ffmpeg",
|
||||
[
|
||||
"-y",
|
||||
"-loglevel",
|
||||
"error",
|
||||
"-f",
|
||||
"lavfi",
|
||||
"-i",
|
||||
`sine=frequency=${frequency}:duration=${seconds}`,
|
||||
].concat([path]),
|
||||
{ encoding: "utf8" },
|
||||
);
|
||||
|
||||
test("a playlist saved under a media name inside the project is refused and opens nothing it names", () =>
|
||||
inTempDir((dir) => {
|
||||
const project = join(dir, "project");
|
||||
mkdirSync(project);
|
||||
const outside = join(dir, "outside.ts");
|
||||
const made = spawnSync(
|
||||
"ffmpeg",
|
||||
["-y", "-loglevel", "error", "-f", "lavfi", "-i", "sine=duration=1", "-c:a", "aac", outside],
|
||||
{ encoding: "utf8" },
|
||||
);
|
||||
assert.equal(made.status, 0, made.stderr);
|
||||
assert.equal(tone(join(project, "bed.wav")).status, 0);
|
||||
writeFileSync(
|
||||
join(project, "narration.m3u8"),
|
||||
`#EXTM3U\n#EXT-X-TARGETDURATION:1\n#EXTINF:1,\n${outside}\n#EXT-X-ENDLIST\n`,
|
||||
);
|
||||
writeComposition(project, "narration.m3u8");
|
||||
const before = readFileSync(join(project, "index.html"), "utf8");
|
||||
const run = runCarve(project);
|
||||
assert.equal(run.status, 1, run.stderr);
|
||||
assert.match(run.stderr, /list that points at other files|cannot read it as media/);
|
||||
assert.equal(readFileSync(join(project, "index.html"), "utf8"), before);
|
||||
}));
|
||||
|
||||
test("a composition whose media are files in its folder still carves", () =>
|
||||
inTempDir((dir) => {
|
||||
mkdirSync(join(dir, "assets"));
|
||||
assert.equal(tone(join(dir, "bed.wav"), 3, 220).status, 0);
|
||||
assert.equal(tone(join(dir, "assets", "narration.m4a"), 3, 1000).status, 0);
|
||||
writeComposition(dir, "assets/narration.m4a");
|
||||
const run = runCarve(dir);
|
||||
assert.equal(run.status, 0, run.stderr);
|
||||
assert.match(run.stdout, /wrote index.html/);
|
||||
assert.match(readFileSync(join(dir, "index.html"), "utf8"), /data-fx-chain=/);
|
||||
}));
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -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,
|
||||
];
|
||||
@@ -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],
|
||||
|
||||
@@ -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 <SKILL_DIR>/audio/scripts/carve.mjs --comp index.html` (needs `ffmpeg`; `--dry-run` to see the plan). It is the same analysis as Studio's carve panel. It reads only double-quoted attributes (JSON quotes as `"`), so write the bed's chain and lanes that way or it overwrites them. Never put a carve on a voice track.
|
||||
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 <SKILL_DIR>/audio/scripts/carve.mjs --comp index.html` (needs `ffmpeg`; `--dry-run` to see the plan). It is the same analysis as Studio's carve panel. It decodes only media files inside the composition's folder, so copy an outside track into the project first. It reads only double-quoted attributes (JSON quotes as `"`), so write the bed's chain and lanes that way or it overwrites them. Never put a carve on a voice track.
|
||||
|
||||
## Group buses
|
||||
|
||||
|
||||
Reference in New Issue
Block a user