@open-take/compositor 0.3.1 → 0.4.0
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/index.d.ts +60 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +83 -24
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/camera.ts +11 -1
- package/src/math.ts +11 -8
- package/src/plan.ts +24 -0
- package/src/render.ts +66 -36
- package/src/scene/scene.tsx +130 -4
- package/src/types.ts +53 -4
- package/src/validate.ts +65 -1
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,11 @@ type CaptureEventBase = {
|
|
|
26
26
|
/** selector / note, kept for editability */
|
|
27
27
|
sel?: string;
|
|
28
28
|
note?: string;
|
|
29
|
+
/** One-line viewer-facing caption from the plan step ("Applying the
|
|
30
|
+
* filter re-prices every row"). planComposition turns these into `captions`
|
|
31
|
+
* windows — the beat explains itself to a viewer who has never seen the
|
|
32
|
+
* app, which footage alone cannot do. */
|
|
33
|
+
caption?: string;
|
|
29
34
|
/** selective-zoom intent from the plan. Absent/"auto" ⇒ the camera director
|
|
30
35
|
* decides from the ground-truth log; "always"/"never" hard-override it (and
|
|
31
36
|
* cut the beat out of any cluster — an override is a segment boundary). */
|
|
@@ -94,6 +99,18 @@ type CaptureHover = CaptureEventBase & {
|
|
|
94
99
|
/** ms the dwell occupies on screen (ground-truth wall time) */
|
|
95
100
|
durationMs: number;
|
|
96
101
|
};
|
|
102
|
+
/** A look: a CAMERA-only beat. Nothing is done to the page and the cursor
|
|
103
|
+
* does not move — the camera frames the target element and holds for
|
|
104
|
+
* `durationMs`. This is the honest spelling of "show the viewer this
|
|
105
|
+
* region": before it existed, the only way to aim the camera was to hover
|
|
106
|
+
* a control you never meant to activate, which reads on screen as a
|
|
107
|
+
* promise ("about to click") the video then breaks. `x,y` is the target's
|
|
108
|
+
* center (zoom anchor); the cursor rests at its previous anchor. */
|
|
109
|
+
type CaptureLook = CaptureEventBase & {
|
|
110
|
+
kind: "look";
|
|
111
|
+
/** ms the framed hold occupies on screen */
|
|
112
|
+
durationMs: number;
|
|
113
|
+
};
|
|
97
114
|
/** A key press / shortcut: keyboard-driven, so the cursor holds (no travel).
|
|
98
115
|
* Holds for `durationMs` while the effect plays out; if a reveal element was
|
|
99
116
|
* located, `box` carries its bbox so the zoom can frame it. */
|
|
@@ -131,7 +148,7 @@ type CaptureDropFiles = CaptureEventBase & {
|
|
|
131
148
|
size?: number;
|
|
132
149
|
}[];
|
|
133
150
|
};
|
|
134
|
-
type CaptureEvent = CaptureClick | CaptureType | CaptureDrag | CaptureScroll | CaptureHover | CapturePress | CaptureDropFiles;
|
|
151
|
+
type CaptureEvent = CaptureClick | CaptureType | CaptureDrag | CaptureScroll | CaptureHover | CaptureLook | CapturePress | CaptureDropFiles;
|
|
135
152
|
type CaptureLog = {
|
|
136
153
|
video: {
|
|
137
154
|
width: number;
|
|
@@ -216,7 +233,7 @@ type GhostCardConfig = {
|
|
|
216
233
|
releaseMs?: number;
|
|
217
234
|
};
|
|
218
235
|
type CompEvent = {
|
|
219
|
-
kind: "click" | "type" | "drag" | "scroll" | "hover" | "press" | "dropFiles";
|
|
236
|
+
kind: "click" | "type" | "drag" | "scroll" | "hover" | "look" | "press" | "dropFiles";
|
|
220
237
|
tMs: number;
|
|
221
238
|
/** anchor point (click / focus / drag start / hover) in video-px. For a
|
|
222
239
|
* scroll/press the cursor does not move; this is its resting point. */
|
|
@@ -387,6 +404,29 @@ type ReviewBadge = {
|
|
|
387
404
|
toMs: number;
|
|
388
405
|
text: string;
|
|
389
406
|
};
|
|
407
|
+
/** One viewer-facing caption window on the DELIVERED video: `text` shows
|
|
408
|
+
* bottom-center from `fromMs` (inclusive) to `toMs` (exclusive) on the
|
|
409
|
+
* composition timeline. Unlike ReviewBadge this is a first-class, persisted
|
|
410
|
+
* composition field rendered on masters — footage alone shows WHAT happened;
|
|
411
|
+
* the caption says what it MEANS, which is the difference between a demo a
|
|
412
|
+
* stranger can follow and "the screen moves around". Absent ⇒ rendered
|
|
413
|
+
* output is byte-identical to a caption-less composition. */
|
|
414
|
+
type Caption = {
|
|
415
|
+
fromMs: number;
|
|
416
|
+
toMs: number;
|
|
417
|
+
text: string;
|
|
418
|
+
};
|
|
419
|
+
/** An opening title card: `title` (the app / the thesis) over a full-frame
|
|
420
|
+
* scrim on top of the establishing hold, gone by `untilMs` (300ms fade).
|
|
421
|
+
* Typographic and deterministic — rendered by the scene in the composition's
|
|
422
|
+
* own look, in whatever language the author wrote, deletable like any field
|
|
423
|
+
* — never generated imagery. The single cheapest "produced, not captured"
|
|
424
|
+
* signal a demo can send. */
|
|
425
|
+
type TitleCard = {
|
|
426
|
+
title: string;
|
|
427
|
+
subtitle?: string;
|
|
428
|
+
untilMs?: number;
|
|
429
|
+
};
|
|
390
430
|
/** Render-time decoration for review copies and A/B variant reels: burned-in
|
|
391
431
|
* beat badges, a REVIEW watermark, and a per-variant corner label. Drawn by the
|
|
392
432
|
* scene in SCREEN space (fixed, outside the composition camera) so the text is
|
|
@@ -471,11 +511,24 @@ type TakeComposition = {
|
|
|
471
511
|
* capture is the ground truth); only the delivered head moves. 0/absent =
|
|
472
512
|
* no trim. */
|
|
473
513
|
startMs?: number;
|
|
474
|
-
/**
|
|
514
|
+
/** Viewer-facing captions, drawn bottom-center in SCREEN space (outside the
|
|
515
|
+
* camera — legible at any zoom) on EVERY render including the master.
|
|
516
|
+
* Persisted and hand-editable like any composition field; times are on the
|
|
517
|
+
* untrimmed composition timeline (same convention as zoom.inAtMs — a
|
|
518
|
+
* caption entirely inside the startMs head trim is never seen, and the
|
|
519
|
+
* validator says so). Seeded from the plan steps' `caption` fields by
|
|
520
|
+
* planComposition. */
|
|
521
|
+
captions?: Caption[];
|
|
522
|
+
/** optional opening title card over the establishing hold (see TitleCard) */
|
|
523
|
+
titleCard?: TitleCard;
|
|
524
|
+
/** render-time review decoration (badges/watermark/label); never persisted
|
|
525
|
+
* (render strips exactly this field — `captions` above deliberately IS
|
|
526
|
+
* persisted; it is content, not review scaffolding) */
|
|
475
527
|
review?: ReviewDecor;
|
|
476
528
|
};
|
|
477
|
-
/** True when motion blur is configured to actually do something
|
|
478
|
-
*
|
|
529
|
+
/** True when motion blur is configured to actually do something — whether the
|
|
530
|
+
* delivery encode folds in the tmix shutter average (render.ts deliverMp4;
|
|
531
|
+
* OFF skips tmix but still runs the same single delivery encode). */
|
|
479
532
|
declare function motionBlurActive(mb: MotionBlurConfig | undefined): mb is MotionBlurConfig;
|
|
480
533
|
declare const DEFAULT_FRAMING: FramingConfig;
|
|
481
534
|
declare const DEFAULT_MOTION_BLUR: MotionBlurConfig;
|
|
@@ -542,7 +595,7 @@ declare function planComposition(log: CaptureLog, opts?: PlanOpts): TakeComposit
|
|
|
542
595
|
//# sourceMappingURL=plan.d.ts.map
|
|
543
596
|
/** One action, already mapped into video-px, handed to the director. */
|
|
544
597
|
type Beat = {
|
|
545
|
-
kind: "click" | "type" | "drag" | "scroll" | "hover" | "press" | "dropFiles";
|
|
598
|
+
kind: "click" | "type" | "drag" | "scroll" | "hover" | "look" | "press" | "dropFiles";
|
|
546
599
|
tMs: number;
|
|
547
600
|
durationMs: number;
|
|
548
601
|
/** element bbox (for a drag: the path's bbox), video-px — or undefined for a
|
|
@@ -794,5 +847,5 @@ declare function ghostCardLines(files: {
|
|
|
794
847
|
};
|
|
795
848
|
|
|
796
849
|
//#endregion
|
|
797
|
-
export { BBox, Beat, CLAMP_TOL_MS, CameraConfig, CaptureClick, CaptureDrag, CaptureDropFiles, CaptureEvent, CaptureEventBase, CaptureHover, CaptureLog, CapturePress, CaptureScroll, CaptureType, CompEvent, CompositionIssue, CursorConfig, DEFAULT_CAMERA, DEFAULT_CURSOR, DEFAULT_FRAMING, DEFAULT_MOTION_BLUR, FINISH, FinishName, Framing, FramingConfig, GhostCardConfig, LOOKS, LookName, LookPreset, MOTION, MotionBlurConfig, MotionName, MotionPreset, PlanOpts, Pt, RenderTakeOpts, RenderTakeResult, ReviewBadge, ReviewDecor, TakeComposition, ValidateOpts, ZOOM_LEVELS, ZoomDecision, ZoomIntent, ZoomLevelName, directCamera, finishName, formatIssues, lookName, math_d_exports as math, motionBlurActive, motionName, planComposition, renderTake, resolveFfmpeg, resolveFfprobe, validateComposition, zoomLevelName };
|
|
850
|
+
export { BBox, Beat, CLAMP_TOL_MS, CameraConfig, Caption, CaptureClick, CaptureDrag, CaptureDropFiles, CaptureEvent, CaptureEventBase, CaptureHover, CaptureLog, CaptureLook, CapturePress, CaptureScroll, CaptureType, CompEvent, CompositionIssue, CursorConfig, DEFAULT_CAMERA, DEFAULT_CURSOR, DEFAULT_FRAMING, DEFAULT_MOTION_BLUR, FINISH, FinishName, Framing, FramingConfig, GhostCardConfig, LOOKS, LookName, LookPreset, MOTION, MotionBlurConfig, MotionName, MotionPreset, PlanOpts, Pt, RenderTakeOpts, RenderTakeResult, ReviewBadge, ReviewDecor, TakeComposition, TitleCard, ValidateOpts, ZOOM_LEVELS, ZoomDecision, ZoomIntent, ZoomLevelName, directCamera, finishName, formatIssues, lookName, math_d_exports as math, motionBlurActive, motionName, planComposition, renderTake, resolveFfmpeg, resolveFfprobe, validateComposition, zoomLevelName };
|
|
798
851
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/presets.ts","../src/ffmpeg.ts","../src/plan.ts","../src/camera.ts","../src/validate.ts","../src/render.ts","../src/math.ts"],"sourcesContent":null,"mappings":";;;KAMY,EAAA;;;AAAZ,CAAA;AACY,KAAA,IAAA,GAAI;;EAKJ,CAAA,EAAA,MAAA;;;AAIZ,CAAA;;AAKQ,KATI,UAAA,GASJ,MAAA,GAAA,OAAA,GAAA,QAAA;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/presets.ts","../src/ffmpeg.ts","../src/plan.ts","../src/camera.ts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AAO;;iBOoRH,SAAA,OAAgB,kBAAkB;iBAoIlC,SAAA,kBAA2B,aAAa,kBAAkB;;iBAiC1D,UAAA,kBAA4B;;APjb5C;;;iBO2bgB,WAAA;;;SAER;;EPpbI,EAAA,EAAA,MAAA;;;iBO4bI,QAAA;;;;AP7ahB;AA8Ba,iBOyZG,cAAA,CPzZa,KAS5B,EAAA;EAEW,IAAA,EAAA,MAAA;EAAe,IAAA,CAAA,EAAA,MAAA;CAAA,EAAA,CAAA,EAAA;EAYH,KACd,EAAA,MAAA;EAAY,IAEP,EAAA,MAAA;CAAgB"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __export } from "./chunk-Cl8Af3a2.js";
|
|
2
2
|
import { spawn, spawnSync } from "node:child_process";
|
|
3
|
-
import { chmod,
|
|
3
|
+
import { chmod, mkdir, mkdtemp, readFile, readdir, rm, stat, symlink, unlink, writeFile } from "node:fs/promises";
|
|
4
4
|
import { existsSync, realpathSync } from "node:fs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { tmpdir } from "node:os";
|
|
@@ -19,8 +19,9 @@ const DEFAULT_CAMERA = {
|
|
|
19
19
|
travelThreshold: .18,
|
|
20
20
|
pullOutCoverage: .55
|
|
21
21
|
};
|
|
22
|
-
/** True when motion blur is configured to actually do something
|
|
23
|
-
*
|
|
22
|
+
/** True when motion blur is configured to actually do something — whether the
|
|
23
|
+
* delivery encode folds in the tmix shutter average (render.ts deliverMp4;
|
|
24
|
+
* OFF skips tmix but still runs the same single delivery encode). */
|
|
24
25
|
function motionBlurActive(mb) {
|
|
25
26
|
return !!mb && mb.samples > 1 && mb.shutter > 0;
|
|
26
27
|
}
|
|
@@ -813,7 +814,7 @@ function buildLegs(comp) {
|
|
|
813
814
|
return { sec: ms / 1e3 };
|
|
814
815
|
};
|
|
815
816
|
for (const [evIdx, e] of comp.events.entries()) {
|
|
816
|
-
if (e.kind === "scroll" || e.kind === "press") {
|
|
817
|
+
if (e.kind === "scroll" || e.kind === "press" || e.kind === "look") {
|
|
817
818
|
freeAt = Math.max(freeAt, (e.tMs + (e.durationMs ?? 0)) / 1e3);
|
|
818
819
|
continue;
|
|
819
820
|
}
|
|
@@ -967,6 +968,7 @@ function growDown(box, video) {
|
|
|
967
968
|
* kind trusts the captured effect region, else shapes one from the bbox. */
|
|
968
969
|
function roiForBeat(b, video) {
|
|
969
970
|
if (b.kind === "press" && b.intent === "always" && b.box) return b.box;
|
|
971
|
+
if (b.kind === "look" && b.box) return b.box;
|
|
970
972
|
if (b.kind === "type" && b.box) {
|
|
971
973
|
const capH = growDown(b.box, video).h;
|
|
972
974
|
if (b.effectBox) {
|
|
@@ -1114,6 +1116,7 @@ function directCamera(beats, video, out, cam, rest, endMs) {
|
|
|
1114
1116
|
}
|
|
1115
1117
|
segs.forEach((s, si) => {
|
|
1116
1118
|
if (s.kind !== "punch") return;
|
|
1119
|
+
if (s.idx.some((i) => beats[i].kind === "look")) return;
|
|
1117
1120
|
const firstT = beats[s.idx[0]].tMs;
|
|
1118
1121
|
const next = segs[si + 1];
|
|
1119
1122
|
const heldUntil = next ? beats[next.idx[0]].tMs : endMs;
|
|
@@ -1271,6 +1274,21 @@ function planComposition(log, opts = {}) {
|
|
|
1271
1274
|
y: vH * .9
|
|
1272
1275
|
};
|
|
1273
1276
|
const durationMs = Math.max(log.tEndMs ?? 0, lastEnd + cursor.holdMs + cursor.zoomOutMs + 400);
|
|
1277
|
+
const captions = [];
|
|
1278
|
+
log.events.forEach((c, i) => {
|
|
1279
|
+
const text = c.caption?.trim();
|
|
1280
|
+
if (!text) return;
|
|
1281
|
+
const e = events[i];
|
|
1282
|
+
const prevEnd = captions.length ? captions[captions.length - 1].toMs : 0;
|
|
1283
|
+
const fromMs = Math.max(e.tMs, prevEnd);
|
|
1284
|
+
const next = events[i + 1];
|
|
1285
|
+
const toMs = Math.max(fromMs + 300, next ? next.tMs : durationMs);
|
|
1286
|
+
captions.push({
|
|
1287
|
+
fromMs,
|
|
1288
|
+
toMs,
|
|
1289
|
+
text
|
|
1290
|
+
});
|
|
1291
|
+
});
|
|
1274
1292
|
return {
|
|
1275
1293
|
output: {
|
|
1276
1294
|
width: oW,
|
|
@@ -1288,7 +1306,8 @@ function planComposition(log, opts = {}) {
|
|
|
1288
1306
|
motionBlur: DEFAULT_MOTION_BLUR,
|
|
1289
1307
|
start,
|
|
1290
1308
|
events,
|
|
1291
|
-
durationMs
|
|
1309
|
+
durationMs,
|
|
1310
|
+
...captions.length ? { captions } : {}
|
|
1292
1311
|
};
|
|
1293
1312
|
}
|
|
1294
1313
|
function manualFraming(b, rest) {
|
|
@@ -1340,7 +1359,8 @@ const reqField = {
|
|
|
1340
1359
|
type: "text",
|
|
1341
1360
|
press: "keys",
|
|
1342
1361
|
drag: "to",
|
|
1343
|
-
dropFiles: "to"
|
|
1362
|
+
dropFiles: "to",
|
|
1363
|
+
look: "durationMs"
|
|
1344
1364
|
};
|
|
1345
1365
|
function validateComposition(comp, opts = {}) {
|
|
1346
1366
|
const issues = [];
|
|
@@ -1470,7 +1490,7 @@ function validateComposition(comp, opts = {}) {
|
|
|
1470
1490
|
const nominal = r.pullOut ? comp.cursor.zoomOutMs : comp.cursor.zoomInMs;
|
|
1471
1491
|
const handSet = Math.abs(e.zoom.inAtMs - Math.max(0, e.tMs - comp.cursor.zoomInMs)) >= 1;
|
|
1472
1492
|
if (handSet && nominal > 0 && rampMs > nominal * RAMP_SLACK) warn(`events[${i}].zoom.inAtMs`, `this beat's camera window runs ${Math.round(rampMs)}ms — ${(rampMs / nominal).toFixed(1)}× cursor.${r.pullOut ? "zoomOutMs" : "zoomInMs"} (${nominal}ms) — so the camera departs at ${Math.round(r.startMs)}ms and creeps to the action instead of moving at the take's pace`, `set inAtMs = ${Math.max(0, e.tMs - comp.cursor.zoomInMs)} (tMs − cursor.zoomInMs) and change cursor.${r.pullOut ? "zoomOutMs" : "zoomInMs"} if the RAMP itself should be slower`);
|
|
1473
|
-
if (e.kind === "press") continue;
|
|
1493
|
+
if (e.kind === "press" || e.kind === "look") continue;
|
|
1474
1494
|
const lateMs = Math.round(r.landMs - e.tMs);
|
|
1475
1495
|
if (lateMs <= MOVING_AT_ACTION_MS) continue;
|
|
1476
1496
|
if (!(rampMs > 0) || lateMs / rampMs <= MOVING_AT_ACTION_FRAC) continue;
|
|
@@ -1491,11 +1511,29 @@ function validateComposition(comp, opts = {}) {
|
|
|
1491
1511
|
}
|
|
1492
1512
|
if (motionEndS * 1e3 > comp.durationMs + 1) warn("durationMs", `the camera is still mid-motion at durationMs (dwell-delayed landing ends ~${Math.round(motionEndS * 1e3)}ms)`, `raise durationMs to ≥ ${Math.round(motionEndS * 1e3)}`);
|
|
1493
1513
|
} catch {}
|
|
1514
|
+
if (comp.events.length) {
|
|
1515
|
+
const firstVisible = comp.events[0].zoom.inAtMs;
|
|
1516
|
+
const deadHeadMs = firstVisible - (comp.startMs ?? 0);
|
|
1517
|
+
if (deadHeadMs > DEAD_TAIL_MS) warn("startMs", `${(deadHeadMs / 1e3).toFixed(1)}s of dead opening before the first beat's camera moves — the delivered video starts on a frozen screen`, `set startMs ≈ ${Math.max(0, firstVisible - 1200)} (leave ~1.2s of establishing hold, trim the rest of the load wait)`);
|
|
1518
|
+
}
|
|
1494
1519
|
const startMs = comp.startMs;
|
|
1495
1520
|
if (startMs != null) {
|
|
1496
1521
|
if (!(startMs >= 0) || startMs >= comp.durationMs) err("startMs", `startMs ${startMs} outside [0, durationMs ${comp.durationMs})`, "the head trim must leave a video");
|
|
1497
1522
|
else if (comp.events[0] && startMs > comp.events[0].zoom.inAtMs) warn("startMs", `startMs ${startMs} cuts into the first beat (camera/cursor already moving at ${comp.events[0].zoom.inAtMs}ms)`, `keep the trim ≤ ${comp.events[0].zoom.inAtMs} so the delivered video opens at rest`);
|
|
1498
1523
|
}
|
|
1524
|
+
for (const [i, cap] of (comp.captions ?? []).entries()) {
|
|
1525
|
+
if (!cap.text?.trim()) {
|
|
1526
|
+
err(`captions[${i}].text`, "empty caption text", "give the caption a line, or delete it");
|
|
1527
|
+
continue;
|
|
1528
|
+
}
|
|
1529
|
+
if (!(cap.toMs > cap.fromMs)) err(`captions[${i}].toMs`, `toMs ${cap.toMs} is not after fromMs ${cap.fromMs} — an inverted/empty window shows nothing`, "set toMs > fromMs (a readable line needs ~1500ms on screen)");
|
|
1530
|
+
if (!(cap.fromMs >= 0) || cap.fromMs >= comp.durationMs) err(`captions[${i}].fromMs`, `fromMs ${cap.fromMs} outside [0, durationMs ${comp.durationMs})`, "captions live on the composition timeline");
|
|
1531
|
+
const prev = comp.captions?.[i - 1];
|
|
1532
|
+
if (prev && cap.fromMs < prev.toMs) warn(`captions[${i}].fromMs`, `window [${cap.fromMs}, ${cap.toMs}) overlaps captions[${i - 1}] [${prev.fromMs}, ${prev.toMs}) — two pills stack in the same slot`, `start this caption at ${prev.toMs}, or end the previous one at ${cap.fromMs}`);
|
|
1533
|
+
if (comp.startMs != null && cap.toMs <= comp.startMs) warn(`captions[${i}]`, `window [${cap.fromMs}, ${cap.toMs}) sits entirely inside the startMs head trim (${comp.startMs}) — it is never seen`, "move the window past the trim, or delete the caption");
|
|
1534
|
+
if (cap.text.trim().length > 120) warn(`captions[${i}].text`, `${cap.text.trim().length} chars — a caption is one explanatory sentence, not a paragraph`, "cut to one sentence (~15-30 CJK chars / 8-14 words); move detail into the beat itself");
|
|
1535
|
+
}
|
|
1536
|
+
if (comp.titleCard && !comp.titleCard.title?.trim()) err("titleCard.title", "empty title on a title card", "give it the app/thesis line, or delete titleCard");
|
|
1499
1537
|
if (opts.captureLog) {
|
|
1500
1538
|
const log = opts.captureLog;
|
|
1501
1539
|
if (log.events.length !== events.length) warn("events", `composition has ${events.length} beats but the capture log has ${log.events.length} — added/removed actions need a re-capture`, "re-capture to change the choreography; edit only renders the existing recording");
|
|
@@ -1557,29 +1595,45 @@ async function toMp4(videoPath, outMp4, fps) {
|
|
|
1557
1595
|
outMp4
|
|
1558
1596
|
]);
|
|
1559
1597
|
}
|
|
1560
|
-
/**
|
|
1561
|
-
*
|
|
1562
|
-
*
|
|
1563
|
-
*
|
|
1564
|
-
*
|
|
1565
|
-
*
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1598
|
+
/** Delivery encode: the visually-lossless ProRes intermediate -> the postable
|
|
1599
|
+
* H.264. The ONLY lossy generation in the pipeline, so its CRF is the
|
|
1600
|
+
* master's quality — overlay text (captions/title card) used to look soft
|
|
1601
|
+
* because it took TWO generations before this fix: revideo's default wasm
|
|
1602
|
+
* exporter (WebCodecs H.264 at the browser's default bitrate, no knob, at
|
|
1603
|
+
* fps·samples) and then this re-encode on top.
|
|
1604
|
+
*
|
|
1605
|
+
* Motion blur folds in here (temporal supersampling: the scene was rendered
|
|
1606
|
+
* at fps·samples, project.ts): `tmix=frames=M` averages M consecutive
|
|
1607
|
+
* sub-frames; `fps=baseFps` then decimates ≈every `samples`-th, so each
|
|
1608
|
+
* output frame = the mean of the last M sub-frames of its interval (a
|
|
1609
|
+
* trailing shutter).
|
|
1610
|
+
*
|
|
1611
|
+
* The scale step is a REAL conversion, not a re-tag: the ProRes encode
|
|
1612
|
+
* converts the scene's RGB frames with swscale's default bt601 matrix, so
|
|
1613
|
+
* the intermediate is 601-coded. Convert to bt709 and tag it — verified by
|
|
1614
|
+
* round-tripping primaries (601-coded red merely tagged 709 decodes to
|
|
1615
|
+
* rgb(255,24,0); converted it decodes to rgb(252,0,0)). */
|
|
1616
|
+
async function deliverMp4(inMov, outMp4, baseFps, blur) {
|
|
1617
|
+
const vf = [];
|
|
1618
|
+
if (blur) {
|
|
1619
|
+
const M = Math.max(1, Math.min(blur.samples, Math.round(blur.shutter * blur.samples)));
|
|
1620
|
+
vf.push(`tmix=frames=${M}`, `fps=${baseFps}`);
|
|
1621
|
+
}
|
|
1622
|
+
vf.push("scale=in_color_matrix=bt601:out_color_matrix=bt709", "format=yuv420p", "setparams=range=tv:colorspace=bt709:color_primaries=bt709:color_trc=bt709");
|
|
1569
1623
|
await run(await resolveFfmpeg(), [
|
|
1570
1624
|
"-y",
|
|
1571
1625
|
"-loglevel",
|
|
1572
1626
|
"error",
|
|
1573
1627
|
"-i",
|
|
1574
|
-
resolve(
|
|
1628
|
+
resolve(inMov),
|
|
1575
1629
|
"-vf",
|
|
1576
|
-
vf,
|
|
1630
|
+
vf.join(","),
|
|
1577
1631
|
"-c:v",
|
|
1578
1632
|
"libx264",
|
|
1579
|
-
"-pix_fmt",
|
|
1580
|
-
"yuv420p",
|
|
1581
1633
|
"-crf",
|
|
1582
1634
|
"18",
|
|
1635
|
+
"-movflags",
|
|
1636
|
+
"+faststart",
|
|
1583
1637
|
"-r",
|
|
1584
1638
|
String(baseFps),
|
|
1585
1639
|
"-an",
|
|
@@ -1684,10 +1738,16 @@ async function renderTakeExclusive(opts) {
|
|
|
1684
1738
|
produced = await renderVideo({
|
|
1685
1739
|
projectFile: "/src/scene/project.ts",
|
|
1686
1740
|
settings: {
|
|
1687
|
-
outFile: "take.
|
|
1741
|
+
outFile: "take.mov",
|
|
1688
1742
|
outDir: RENDER_OUT,
|
|
1689
1743
|
workers: 1,
|
|
1690
|
-
|
|
1744
|
+
projectSettings: {
|
|
1745
|
+
exporter: {
|
|
1746
|
+
name: "@revideo/core/ffmpeg",
|
|
1747
|
+
options: { format: "proRes" }
|
|
1748
|
+
},
|
|
1749
|
+
...rangeSec ? { range: rangeSec } : {}
|
|
1750
|
+
},
|
|
1691
1751
|
logProgress: opts.logProgress ?? false,
|
|
1692
1752
|
...opts.onProgress ? { progressCallback: (_worker, progress) => opts.onProgress(progress) } : {},
|
|
1693
1753
|
viteConfig: { server: { fs: { allow: [scratch, ...deps ? [deps] : []] } } },
|
|
@@ -1707,8 +1767,7 @@ async function renderTakeExclusive(opts) {
|
|
|
1707
1767
|
}
|
|
1708
1768
|
await mkdir(dirname(resolve(opts.outPath)), { recursive: true });
|
|
1709
1769
|
const producedAbs = resolve(scratch, produced);
|
|
1710
|
-
|
|
1711
|
-
else await copyFile(producedAbs, resolve(opts.outPath));
|
|
1770
|
+
await deliverMp4(producedAbs, resolve(opts.outPath), composition.output.fps, motionBlurActive(composition.motionBlur) ? composition.motionBlur : null);
|
|
1712
1771
|
const compositionPath = opts.compositionPath ? resolve(opts.compositionPath) : `${resolve(opts.outPath).replace(/\.mp4$/i, "")}.composition.json`;
|
|
1713
1772
|
if (opts.writeCompositionSibling !== false) {
|
|
1714
1773
|
const { review: _review,...persisted } = composition;
|