@open-take/runtime 0.2.8 → 0.2.10
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/cdp-capture-CIDrD1-t.js +3 -0
- package/dist/{cdp-capture-Coui4-Wt.js → cdp-capture-DiHFRxLw.js} +9 -9
- package/dist/cdp-capture-DiHFRxLw.js.map +1 -0
- package/dist/index.d.ts +48 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +127 -59
- package/dist/index.js.map +1 -1
- package/editor-dist/assets/{index-C8-bVp44.js → index-DxHkcxzf.js} +11 -11
- package/editor-dist/index.html +1 -1
- package/editor-dist/sample/capture.json +1 -1
- package/editor-dist/sample/composition.json +3 -13
- package/package.json +3 -3
- package/dist/cdp-capture-Coui4-Wt.js.map +0 -1
- package/dist/cdp-capture-nGRiRSVD.js +0 -3
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/capture.ts","../src/cdp-capture.ts","../src/nav.ts","../src/auth.ts","../src/frame-diff.ts","../src/cdp.ts","../src/edit-server.ts","../src/take.ts","../src/notes.ts","../src/review.ts","../src/frames.ts","../src/index.ts"],"sourcesContent":null,"mappings":";;;;;KAcY,SAAA;;;AAAZ,CAAA;;;AAIY,KAAA,UAAA,GAAU,MAAA,GAAA,OAAA,GAAA,QAAA;AAMV,KAAA,QAAA,GAAQ;EAAA,MAAA,EAAA,OAAA;EAAA,QAOP,CAAA,EAAA,MAAA;EAAU,IAqBV,CAAA,EAAA,MAAA;EAAU,IAYV,CAAA,EAAA,MAAA;EAAS,QAIX,CAAA,EAAA,MAAA;EAAS,IAEP,CAAA,EAvCA,UAuCA;CAAS,GAAA;EAKC,MAmBZ,EAAA,MAAA;EAAS,QAEP,CAAA,EAAA,MAAA;EAAS,IAET,CAAA,EAAA,MAAA;EAAS;EAKC,KA+BV,EAAA,MAAA;EAAU;;AAmDH;EAMR,KAAA,CAAA,EAAA,OAAQ;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/capture.ts","../src/cdp-capture.ts","../src/nav.ts","../src/auth.ts","../src/frame-diff.ts","../src/cdp.ts","../src/edit-server.ts","../src/take.ts","../src/notes.ts","../src/review.ts","../src/frames.ts","../src/index.ts"],"sourcesContent":null,"mappings":";;;;;KAcY,SAAA;;;AAAZ,CAAA;;;AAIY,KAAA,UAAA,GAAU,MAAA,GAAA,OAAA,GAAA,QAAA;AAMV,KAAA,QAAA,GAAQ;EAAA,MAAA,EAAA,OAAA;EAAA,QAOP,CAAA,EAAA,MAAA;EAAU,IAqBV,CAAA,EAAA,MAAA;EAAU,IAYV,CAAA,EAAA,MAAA;EAAS,QAIX,CAAA,EAAA,MAAA;EAAS,IAEP,CAAA,EAvCA,UAuCA;CAAS,GAAA;EAKC,MAmBZ,EAAA,MAAA;EAAS,QAEP,CAAA,EAAA,MAAA;EAAS,IAET,CAAA,EAAA,MAAA;EAAS;EAKC,KA+BV,EAAA,MAAA;EAAU;;AAmDH;EAMR,KAAA,CAAA,EAAA,OAAQ;;;;EC+IR,SAAA,CAAA,EAAA,MAAW;;EA6CD,QAAA,CAAA,EAAA,MAAW;EAAA,IAAA,CAAA,EDvUpB,UCuUoB;CAAA,GAAA;EAAe,MAAQ,EAAA,MAAA;EAAW,QAAW,CAAA,EAAA,MAAA;EAAU,IAAlB,CAAA,EAAA,MAAA;EAAO,IAAA,CAAA,ED3ThE,SC2TgE;EAOjE,UAAA,CAAA,EAAA,MAAc;EAYd,MAAA,CAAA,EAAA,MAAA;EA6BA,EAAA,CAAA,EDvWD,SCuWY;;SDrWV;;ECmXS,UAAA,CAAA,EAAA,MAAW;EAAA,IAAA,CAAA,EAAA,MAAA;EAAA,QAAoB,CAAA,EAAA,MAAA;EAAgB,IAAW,CAAA,ED9WnE,UC8WmE;CAAa,GAAA;EAAd,MAAA,EAAA,WAAA;;;;;ECtLzD,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;;EAAU,OAAA,EUlHrE,WVkHqE,CUlHzD,UVkHyD,CAAA,SAAA,CAAA,CAAA;;;;ACvPhF;;eS2Ie,YAAY;;;;;;;ATpH3B;YS4HY;;;;;;ARvII,cQ8IH,iBR9Ia,EAAA,CAAA,WAAA,EAAA,MAAA,EAAA,GAAA,MAAA;AAQ1B;AAWA;;iBQiIsB,qBAAA,uBAA4C,QAAQ;iBASpD,QAAA,OAAe,gBAAgB,eAAe,QAAQ;KAmFhE,qBAAA;;ERtNU,WAAA,EQwNP,eRxNkB;EAAA;EAAA,WAAO,EAAA,MAAA;EAAQ;EAAqB,OAAlB,EAAA,MAAA;EAAO;;eQ+N3C;;EPxNH;;;;;;;;;;;;;;iBOyOU,iBAAA,OACd,wBACL;;;YAA8D;;APjMjE;;;;;AAMG,iBOmNmB,qBAAA,CPnNnB,IAAA,EAAA;EAAe,eAAA,EAAA,MAAA;EA0FN,WAAA,EAAA,MAAY;;;;;;;AAYxB,CAAA,CAAA,EOsHI,OPtHkB,CAAA;EAAkB,OAAA,EAAA,MAAA;EAAA,eACjC,EAAA,MAAA;EAAU,QAET,EOmH0D,kBPnH1D,EAAA;CAAiB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { captureTake, captureTakeCDP, ensureChrome, inspectPage, resolveChrome, resolveNavigateUrl } from "./cdp-capture-
|
|
1
|
+
import { captureTake, captureTakeCDP, ensureChrome, inspectPage, resolveChrome, resolveNavigateUrl } from "./cdp-capture-DiHFRxLw.js";
|
|
2
2
|
import { appendFile, copyFile, mkdir, mkdtemp, readFile, readdir, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
|
|
3
3
|
import { homedir, tmpdir } from "node:os";
|
|
4
4
|
import { basename, dirname, extname, join, normalize, resolve } from "node:path";
|
|
@@ -217,63 +217,104 @@ async function annotateCaptureLog(log, videoPath, opts = {}) {
|
|
|
217
217
|
|
|
218
218
|
//#endregion
|
|
219
219
|
//#region src/take.ts
|
|
220
|
+
/** working-directory suffix: `demo.mp4` → `demo.take/` */
|
|
221
|
+
const TAKE_DIR_SUFFIX = ".take";
|
|
220
222
|
async function isFile(p) {
|
|
221
223
|
return (await stat(p).catch(() => null))?.isFile() ?? false;
|
|
222
224
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
p = join(p, pick);
|
|
240
|
-
}
|
|
241
|
-
const base = p.replace(/\.dossier\.md$/i, "").replace(/\.notes\.cursor$/i, "").replace(/\.notes\.md$/i, "").replace(/\.prev\.composition\.json$/i, "").replace(/\.composition\.json$/i, "").replace(/\.capture\.json$/i, "").replace(/\.capture\.mp4$/i, "").replace(/\.review\.mp4$/i, "").replace(/\.draft\.mp4$/i, "").replace(/\.ab\.mp4$/i, "").replace(/\.prev\.mp4$/i, "").replace(/\.mp4$/i, "");
|
|
225
|
+
const stripDirSuffix = (p) => p.slice(0, -TAKE_DIR_SUFFIX.length);
|
|
226
|
+
/** Every member the flat layout used to write beside the master. A path that
|
|
227
|
+
* matches one AND EXISTS is a pre-`.take/` take (or a path from an old doc):
|
|
228
|
+
* worth an explanation rather than a resolve to a take called "demo.capture".
|
|
229
|
+
* Existence is what keeps this from stealing a legitimate name — `--out
|
|
230
|
+
* foo.draft.mp4` is a fine thing to call a video nobody has written yet. */
|
|
231
|
+
const LEGACY_MEMBER = /\.(composition\.json|capture\.mp4|capture\.json|review\.mp4|draft\.mp4|ab\.mp4|prev\.mp4|frames(\.beat\d+)?\.png|dossier\.md|notes\.md|notes\.cursor)$/i;
|
|
232
|
+
function legacyLayout(base) {
|
|
233
|
+
const name = basename(base);
|
|
234
|
+
const dir = `${name}${TAKE_DIR_SUFFIX}`;
|
|
235
|
+
return `${base}.* is the old flat take layout — a take's working files now live in ${dir}/ beside the mp4.\nMigrate it:\n (cd ${JSON.stringify(dirname(base))} && mkdir -p ${JSON.stringify(dir)} && for f in ${JSON.stringify(name)}.*.*; do mv "$f" ${JSON.stringify(dir)}/"\${f#${name}.}"; done)\n— or just re-make the take.`;
|
|
236
|
+
}
|
|
237
|
+
function fromBase(base) {
|
|
238
|
+
const dir = `${base}${TAKE_DIR_SUFFIX}`;
|
|
239
|
+
const inDir = (n) => join(dir, n);
|
|
242
240
|
return {
|
|
243
241
|
base,
|
|
244
242
|
name: basename(base),
|
|
245
243
|
mp4Path: `${base}.mp4`,
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
244
|
+
dir,
|
|
245
|
+
compositionPath: inDir("composition.json"),
|
|
246
|
+
capturePath: inDir("capture.mp4"),
|
|
247
|
+
captureLogPath: inDir("capture.json"),
|
|
248
|
+
reviewPath: inDir("review.mp4"),
|
|
249
|
+
draftPath: inDir("draft.mp4"),
|
|
250
|
+
abPath: inDir("ab.mp4"),
|
|
251
|
+
prevPath: inDir("prev.mp4"),
|
|
252
|
+
prevCompositionPath: inDir("prev.composition.json"),
|
|
253
|
+
framesPath: inDir("frames.png"),
|
|
254
|
+
dossierPath: inDir("dossier.md"),
|
|
255
|
+
notesPath: inDir("notes.md"),
|
|
256
|
+
notesCursorPath: inDir("notes.cursor")
|
|
256
257
|
};
|
|
257
258
|
}
|
|
259
|
+
/** A path inside the take's working dir — the ffmpeg intermediates and the
|
|
260
|
+
* per-beat frame sheets, which are members by position, not by name. */
|
|
261
|
+
const takeFile = (take, name) => join(take.dir, name);
|
|
262
|
+
/** Point at any member and get the whole take. Resolution is a pure string
|
|
263
|
+
* transform except for a bare directory, which is scanned for `*.take/`.
|
|
264
|
+
* The master need not exist yet — `make --out` resolves before it writes. */
|
|
265
|
+
async function resolveTakePaths(input) {
|
|
266
|
+
const p = resolve(input);
|
|
267
|
+
const parent = dirname(p);
|
|
268
|
+
if (parent.endsWith(TAKE_DIR_SUFFIX)) return fromBase(stripDirSuffix(parent));
|
|
269
|
+
if (p.endsWith(TAKE_DIR_SUFFIX)) return fromBase(stripDirSuffix(p));
|
|
270
|
+
if (LEGACY_MEMBER.test(p) && await isFile(p)) throw new Error(legacyLayout(p.replace(LEGACY_MEMBER, "")));
|
|
271
|
+
if (/\.mp4$/i.test(p)) return fromBase(p.replace(/\.mp4$/i, ""));
|
|
272
|
+
const s = await stat(p).catch(() => null);
|
|
273
|
+
if (s?.isDirectory()) return fromBase(await pickTakeIn(p));
|
|
274
|
+
return fromBase(p);
|
|
275
|
+
}
|
|
276
|
+
/** A plain directory means "the take in here" — unambiguous only when it holds
|
|
277
|
+
* exactly one. Two takes in one folder is now visible (two `*.take/` dirs)
|
|
278
|
+
* instead of an alphabetical race between compositions. */
|
|
279
|
+
async function pickTakeIn(dir) {
|
|
280
|
+
const entries = await readdir(dir).catch(() => []);
|
|
281
|
+
const takes = entries.filter((e) => e.endsWith(TAKE_DIR_SUFFIX)).sort();
|
|
282
|
+
if (takes.length === 1) return join(dir, stripDirSuffix(takes[0]));
|
|
283
|
+
if (takes.length > 1) throw new Error(`${dir} holds ${takes.length} takes (${takes.map(stripDirSuffix).join(", ")}) — name the one you mean, e.g. ${stripDirSuffix(takes[0])}.mp4`);
|
|
284
|
+
const flat = entries.find((e) => /\.composition\.json$/i.test(e));
|
|
285
|
+
if (flat) throw new Error(legacyLayout(join(dir, flat.replace(/\.composition\.json$/i, ""))));
|
|
286
|
+
throw new Error(`no take in ${dir} — a take is an mp4 with a <name>${TAKE_DIR_SUFFIX}/ working dir beside it`);
|
|
287
|
+
}
|
|
288
|
+
/** Create the working dir (idempotent). Everything except the master is
|
|
289
|
+
* written inside it, so any verb that writes calls this first. */
|
|
290
|
+
async function ensureTakeDir(take) {
|
|
291
|
+
const s = await stat(take.dir).catch(() => null);
|
|
292
|
+
if (s && !s.isDirectory()) throw new Error(`${take.dir} exists but is not a directory — that is where this take's working files go; move it aside`);
|
|
293
|
+
await mkdir(take.dir, { recursive: true });
|
|
294
|
+
}
|
|
258
295
|
/** Friendly preflight: verbs die with a clear message instead of a raw ffmpeg
|
|
259
296
|
* ENOENT when a take is missing the files they need. Old takes (or cleaned
|
|
260
297
|
* ones) may have a composition + mp4 but no kept capture — those can be
|
|
261
298
|
* watched but not re-rendered. */
|
|
262
299
|
async function requireTakeFiles(take, opts = {}) {
|
|
263
|
-
if (!await isFile(take.compositionPath))
|
|
264
|
-
|
|
300
|
+
if (!await isFile(take.compositionPath)) {
|
|
301
|
+
if (await isFile(`${take.base}.composition.json`)) throw new Error(legacyLayout(take.base));
|
|
302
|
+
throw new Error(`missing ${take.compositionPath} — not a take produced by \`make\` (or the wrong path)`);
|
|
303
|
+
}
|
|
304
|
+
if (opts.capture && !await isFile(take.capturePath)) throw new Error(`this take has no kept capture (${take.capturePath}) — re-rendering needs the frozen recording.\nDelete the working dir and the master is all that is left; run \`make\` again for a refinable take.`);
|
|
265
305
|
}
|
|
266
|
-
/** Stage a copy of the current master so it becomes
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
306
|
+
/** Stage a copy of the current master so it becomes `prev.mp4` only AFTER the
|
|
307
|
+
* next render succeeds. A refused (validator) or crashed render must NOT
|
|
308
|
+
* clobber the existing revert point — that would make "keep the old one"
|
|
309
|
+
* replay the wrong version. No-op when there is no master yet. This is what
|
|
310
|
+
* makes "A" (keep the old one) a mechanical revert instead of a memory. */
|
|
271
311
|
async function stagePrev(mp4Path, prevPath) {
|
|
272
312
|
if (!await isFile(mp4Path)) return {
|
|
273
313
|
commit: async () => {},
|
|
274
314
|
abort: async () => {}
|
|
275
315
|
};
|
|
276
316
|
const pending = `${prevPath}.pending`;
|
|
317
|
+
await mkdir(dirname(pending), { recursive: true });
|
|
277
318
|
await copyFile(mp4Path, pending);
|
|
278
319
|
return {
|
|
279
320
|
commit: () => rename(pending, prevPath),
|
|
@@ -436,7 +477,7 @@ async function renderReview(take, opts = {}) {
|
|
|
436
477
|
warnings
|
|
437
478
|
};
|
|
438
479
|
}
|
|
439
|
-
/** Draft-quality re-render of the CURRENT composition to
|
|
480
|
+
/** Draft-quality re-render of the CURRENT composition to `draft.mp4` —
|
|
440
481
|
* no badges, no watermark, and never the master's path, so a mid-refine
|
|
441
482
|
* frame-check (edit → draft → `frames`) costs seconds without downgrading or
|
|
442
483
|
* clobbering the postable mp4. Disposable like the review copy. */
|
|
@@ -677,7 +718,7 @@ async function renderAbReel(take, opts) {
|
|
|
677
718
|
...base,
|
|
678
719
|
review: { label: `${v.letter} · ${v.desc}` }
|
|
679
720
|
};
|
|
680
|
-
const clip =
|
|
721
|
+
const clip = takeFile(take, `ab.${v.letter}.mp4`);
|
|
681
722
|
if (opts.logProgress !== false) process.stderr.write(`variant ${v.letter} · ${v.desc}${rangeSec ? ` · window ${rangeSec[0].toFixed(1)}–${rangeSec[1].toFixed(1)}s` : ""}\n`);
|
|
682
723
|
await renderTake({
|
|
683
724
|
composition: decorated,
|
|
@@ -735,8 +776,8 @@ async function renderBeforeAfter(take, opts = {}) {
|
|
|
735
776
|
args.push("-c:v", "libx264", "-crf", "18", "-pix_fmt", "yuv420p", "-an", out);
|
|
736
777
|
await ffmpeg(args);
|
|
737
778
|
};
|
|
738
|
-
const before =
|
|
739
|
-
const after =
|
|
779
|
+
const before = takeFile(take, "ab.before.mp4");
|
|
780
|
+
const after = takeFile(take, "ab.after.mp4");
|
|
740
781
|
await cut(take.prevPath, before);
|
|
741
782
|
await cut(take.mp4Path, after);
|
|
742
783
|
await concatWithGaps([
|
|
@@ -959,7 +1000,11 @@ const CONTENT_TYPE = {
|
|
|
959
1000
|
".ico": "image/x-icon",
|
|
960
1001
|
".woff2": "font/woff2",
|
|
961
1002
|
".woff": "font/woff",
|
|
962
|
-
".map": "application/json; charset=utf-8"
|
|
1003
|
+
".map": "application/json; charset=utf-8",
|
|
1004
|
+
".mp4": "video/mp4",
|
|
1005
|
+
".m4v": "video/mp4",
|
|
1006
|
+
".webm": "video/webm",
|
|
1007
|
+
".mov": "video/quicktime"
|
|
963
1008
|
};
|
|
964
1009
|
/** Locate the built editor SPA: prefer the live monorepo build during
|
|
965
1010
|
* development, then fall back to the bundled copy used by the published
|
|
@@ -998,7 +1043,10 @@ async function readBody(req, capBytes = 32 * 1024 * 1024) {
|
|
|
998
1043
|
}
|
|
999
1044
|
return Buffer.concat(chunks).toString("utf8");
|
|
1000
1045
|
}
|
|
1001
|
-
/** Stream a file with HTTP Range support (206) — required for <video> seeking.
|
|
1046
|
+
/** Stream a file with HTTP Range support (206) — required for <video> seeking.
|
|
1047
|
+
* Answers HEAD with the same headers and no body: a media element (or a proxy
|
|
1048
|
+
* in front of one) may probe with HEAD before it will range-GET, and the route
|
|
1049
|
+
* table used to let those fall through to the /api/ 404. */
|
|
1002
1050
|
async function serveFile(req, res, filePath) {
|
|
1003
1051
|
const st = await stat(filePath).catch(() => null);
|
|
1004
1052
|
if (!st?.isFile()) {
|
|
@@ -1006,6 +1054,15 @@ async function serveFile(req, res, filePath) {
|
|
|
1006
1054
|
return;
|
|
1007
1055
|
}
|
|
1008
1056
|
const type = CONTENT_TYPE[extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
1057
|
+
if (req.method === "HEAD") {
|
|
1058
|
+
res.writeHead(200, {
|
|
1059
|
+
"Content-Length": st.size,
|
|
1060
|
+
"Accept-Ranges": "bytes",
|
|
1061
|
+
"Content-Type": type
|
|
1062
|
+
});
|
|
1063
|
+
res.end();
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1009
1066
|
const range = req.headers.range;
|
|
1010
1067
|
if (range) {
|
|
1011
1068
|
const m = /bytes=(\d*)-(\d*)/.exec(range);
|
|
@@ -1150,7 +1207,7 @@ async function startEditServer(opts, deps = {}) {
|
|
|
1150
1207
|
});
|
|
1151
1208
|
return;
|
|
1152
1209
|
}
|
|
1153
|
-
if (path === "/api/take/video" && method === "GET") {
|
|
1210
|
+
if (path === "/api/take/video" && (method === "GET" || method === "HEAD")) {
|
|
1154
1211
|
await serveFile(req, res, take.capturePath);
|
|
1155
1212
|
return;
|
|
1156
1213
|
}
|
|
@@ -1173,7 +1230,7 @@ async function startEditServer(opts, deps = {}) {
|
|
|
1173
1230
|
sendJson(res, 200, { ok: true });
|
|
1174
1231
|
return;
|
|
1175
1232
|
}
|
|
1176
|
-
if (path === "/api/take/output" && method === "GET") {
|
|
1233
|
+
if (path === "/api/take/output" && (method === "GET" || method === "HEAD")) {
|
|
1177
1234
|
await serveFile(req, res, take.mp4Path);
|
|
1178
1235
|
return;
|
|
1179
1236
|
}
|
|
@@ -1294,6 +1351,7 @@ async function startEditServer(opts, deps = {}) {
|
|
|
1294
1351
|
}
|
|
1295
1352
|
});
|
|
1296
1353
|
async function runRender(j, comp, captureLog) {
|
|
1354
|
+
const staged = await stagePrev(take.mp4Path, take.prevPath);
|
|
1297
1355
|
try {
|
|
1298
1356
|
await (deps.renderComposition ?? renderComposition)({
|
|
1299
1357
|
composition: comp,
|
|
@@ -1307,6 +1365,7 @@ async function startEditServer(opts, deps = {}) {
|
|
|
1307
1365
|
for (const c of j.clients) emit(c, "progress", { progress: p });
|
|
1308
1366
|
}
|
|
1309
1367
|
});
|
|
1368
|
+
await staged.commit();
|
|
1310
1369
|
j.status = "done";
|
|
1311
1370
|
j.progress = 1;
|
|
1312
1371
|
j.mp4Url = `/api/take/output?v=${Date.now().toString(36)}`;
|
|
@@ -1315,6 +1374,7 @@ async function startEditServer(opts, deps = {}) {
|
|
|
1315
1374
|
c.end();
|
|
1316
1375
|
}
|
|
1317
1376
|
} catch (err) {
|
|
1377
|
+
await staged.abort();
|
|
1318
1378
|
j.status = "error";
|
|
1319
1379
|
j.error = err instanceof Error ? err.message : String(err);
|
|
1320
1380
|
for (const c of j.clients) {
|
|
@@ -1600,7 +1660,7 @@ async function renderFrames(take, opts = {}) {
|
|
|
1600
1660
|
const trim = comp.startMs ?? 0;
|
|
1601
1661
|
const durMs = await mp4Duration(src);
|
|
1602
1662
|
const ffmpeg$1 = await resolveFfmpeg();
|
|
1603
|
-
const framesPath = opts.beat != null ?
|
|
1663
|
+
const framesPath = opts.beat != null ? takeFile(take, `frames.beat${opts.beat}.png`) : take.framesPath;
|
|
1604
1664
|
const tileW = Math.round(opts.tileWidth ?? (opts.beat != null ? 720 : 480));
|
|
1605
1665
|
if (!Number.isFinite(tileW) || tileW < 120 || tileW > 1920) throw new Error(`frames: tile width ${tileW} out of range (120-1920)`);
|
|
1606
1666
|
const tileH = Math.round(tileW * comp.output.height / comp.output.width);
|
|
@@ -1653,12 +1713,10 @@ async function renderFrames(take, opts = {}) {
|
|
|
1653
1713
|
|
|
1654
1714
|
//#endregion
|
|
1655
1715
|
//#region src/index.ts
|
|
1656
|
-
/** `<
|
|
1657
|
-
*
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
* video. Deriving it by convention lets `render` find the ground-truth timing
|
|
1661
|
-
* from just the `--video` path. */
|
|
1716
|
+
/** `<video>.mp4` → `<video>.json` — the capture log sits beside its video
|
|
1717
|
+
* (`capture.mp4` → `capture.json` inside the take's working dir). Deriving it
|
|
1718
|
+
* by convention lets `render` find the ground-truth timing from just the
|
|
1719
|
+
* `--video` path. */
|
|
1662
1720
|
const captureLogPathFor = (capturePath) => resolve(capturePath).replace(/\.mp4$/i, ".json");
|
|
1663
1721
|
/** Load the capture log that sits beside a capture video, if present. Returns
|
|
1664
1722
|
* undefined when there's no sibling (e.g. an old capture, or a hand-supplied
|
|
@@ -1680,14 +1738,19 @@ async function makeTake(plan, opts) {
|
|
|
1680
1738
|
chromePath,
|
|
1681
1739
|
videoPath: tmpVideo
|
|
1682
1740
|
});
|
|
1683
|
-
const
|
|
1684
|
-
const captureLogPath =
|
|
1685
|
-
await mkdir(dirname(
|
|
1741
|
+
const take = await resolveTakePaths(opts.outPath);
|
|
1742
|
+
const { capturePath, captureLogPath } = take;
|
|
1743
|
+
await mkdir(dirname(take.mp4Path), { recursive: true });
|
|
1744
|
+
await ensureTakeDir(take);
|
|
1686
1745
|
await copyFile(tmpVideo, capturePath);
|
|
1687
1746
|
try {
|
|
1688
1747
|
opts.onCaptureReady?.(capturePath);
|
|
1689
1748
|
} catch {}
|
|
1690
|
-
const
|
|
1749
|
+
const annotated = opts.frameDiff === false ? raw : await annotateCaptureLog(raw, tmpVideo, { logProgress: opts.verbose === true });
|
|
1750
|
+
const log = {
|
|
1751
|
+
...annotated,
|
|
1752
|
+
url: plan.url
|
|
1753
|
+
};
|
|
1691
1754
|
await writeFile(captureLogPath, JSON.stringify(log, null, 2));
|
|
1692
1755
|
const captureFps = opts.capture?.fps ?? 60;
|
|
1693
1756
|
const planOpts = opts.planOpts?.output?.fps == null ? {
|
|
@@ -1701,7 +1764,8 @@ async function makeTake(plan, opts) {
|
|
|
1701
1764
|
const { mp4Path, compositionPath, warnings } = await renderTake({
|
|
1702
1765
|
composition: opts.draft ? toDraft(composition) : composition,
|
|
1703
1766
|
videoPath: capturePath,
|
|
1704
|
-
outPath:
|
|
1767
|
+
outPath: take.mp4Path,
|
|
1768
|
+
compositionPath: take.compositionPath,
|
|
1705
1769
|
logProgress: opts.logProgress ?? false,
|
|
1706
1770
|
chromePath,
|
|
1707
1771
|
captureLog: log,
|
|
@@ -1711,6 +1775,7 @@ async function makeTake(plan, opts) {
|
|
|
1711
1775
|
return {
|
|
1712
1776
|
mp4Path,
|
|
1713
1777
|
compositionPath,
|
|
1778
|
+
takeDir: take.dir,
|
|
1714
1779
|
capturePath,
|
|
1715
1780
|
captureLogPath,
|
|
1716
1781
|
composition,
|
|
@@ -1727,10 +1792,13 @@ async function makeTake(plan, opts) {
|
|
|
1727
1792
|
* capture-locked tMs drift when `captureLog` is supplied. */
|
|
1728
1793
|
async function renderComposition(opts) {
|
|
1729
1794
|
const chromePath = await ensureChrome(opts.chromePath);
|
|
1795
|
+
const take = await resolveTakePaths(opts.outPath);
|
|
1796
|
+
if (opts.writeCompositionSibling !== false) await ensureTakeDir(take);
|
|
1730
1797
|
return renderTake({
|
|
1731
1798
|
composition: opts.composition,
|
|
1732
1799
|
videoPath: resolve(opts.capturePath),
|
|
1733
|
-
outPath:
|
|
1800
|
+
outPath: take.mp4Path,
|
|
1801
|
+
compositionPath: take.compositionPath,
|
|
1734
1802
|
logProgress: opts.logProgress ?? false,
|
|
1735
1803
|
chromePath,
|
|
1736
1804
|
captureLog: opts.captureLog,
|
|
@@ -1759,5 +1827,5 @@ async function renderCompositionFile(opts) {
|
|
|
1759
1827
|
}
|
|
1760
1828
|
|
|
1761
1829
|
//#endregion
|
|
1762
|
-
export { SAY_IT_CARD, annotateCaptureLog, authProfile, beatLabel, buildBadges, buildBeatSheet, buildFramePlan, buildFrameSheet, captureLogPathFor, captureTake, captureTakeCDP, diffFrames, ensureChrome, formatIssues, formatNotes, inspectPage, loadCaptureLogSibling, makeTake, openPath, profileDir, readNotes, renderAbReel, renderBeforeAfter, renderComposition, renderCompositionFile, renderDraft, renderFrames, renderReview, requireTakeFiles, resolveChrome, resolveNavigateUrl, resolveTakePaths, revealPath, stagePrev, startEditServer, toDraft, validateComposition, waitForNotes };
|
|
1830
|
+
export { SAY_IT_CARD, TAKE_DIR_SUFFIX, annotateCaptureLog, authProfile, beatLabel, buildBadges, buildBeatSheet, buildFramePlan, buildFrameSheet, captureLogPathFor, captureTake, captureTakeCDP, diffFrames, ensureChrome, ensureTakeDir, formatIssues, formatNotes, inspectPage, loadCaptureLogSibling, makeTake, openPath, profileDir, readNotes, renderAbReel, renderBeforeAfter, renderComposition, renderCompositionFile, renderDraft, renderFrames, renderReview, requireTakeFiles, resolveChrome, resolveNavigateUrl, resolveTakePaths, revealPath, stagePrev, startEditServer, takeFile, toDraft, validateComposition, waitForNotes };
|
|
1763
1831
|
//# sourceMappingURL=index.js.map
|