@open-take/compositor 0.3.1 → 0.4.1
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 +64 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +211 -49
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/camera.ts +11 -1
- package/src/decode-guard.ts +35 -0
- package/src/ffmpeg.ts +41 -1
- package/src/math.ts +11 -8
- package/src/plan.ts +24 -0
- package/src/render.ts +193 -78
- package/src/scene/scene.tsx +170 -4
- package/src/types.ts +53 -4
- package/src/validate.ts +65 -1
package/src/scene/scene.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
carryWindow,
|
|
14
14
|
ghostCardLines,
|
|
15
15
|
} from "../math";
|
|
16
|
+
import { buildUndecodableMessage } from "../decode-guard";
|
|
16
17
|
import comp from "./.composition.json";
|
|
17
18
|
|
|
18
19
|
const vW = comp.source.videoWidth,
|
|
@@ -40,6 +41,45 @@ const CURSOR = [
|
|
|
40
41
|
].map(([x, y]) => [x * S, y * S]);
|
|
41
42
|
|
|
42
43
|
export default makeScene2D("take", function* (view) {
|
|
44
|
+
// Fail fast if this browser cannot decode the capture: revideo's <Video>
|
|
45
|
+
// waitForCanPlay resolves only on 'canplay' (its 'error' handler just
|
|
46
|
+
// logs), so an undecodable capture — H.264 on a codec-less Chromium —
|
|
47
|
+
// otherwise hangs the render forever. A rejection here propagates out as a
|
|
48
|
+
// renderVideo failure; its message starts with the shared sentinel
|
|
49
|
+
// (decode-guard.ts), which render.ts recognises to retry with a VP9
|
|
50
|
+
// intermediate.
|
|
51
|
+
if (comp.source.videoUrl) {
|
|
52
|
+
yield new Promise((res, rej) => {
|
|
53
|
+
const el = document.createElement("video");
|
|
54
|
+
el.muted = true;
|
|
55
|
+
el.preload = "auto";
|
|
56
|
+
let timer = 0;
|
|
57
|
+
const done = (err) => {
|
|
58
|
+
clearTimeout(timer);
|
|
59
|
+
el.removeEventListener("canplay", onCanPlay);
|
|
60
|
+
el.removeEventListener("error", onError);
|
|
61
|
+
el.removeAttribute("src");
|
|
62
|
+
el.load();
|
|
63
|
+
if (err) rej(err);
|
|
64
|
+
else res(undefined);
|
|
65
|
+
};
|
|
66
|
+
const onCanPlay = () => done(undefined);
|
|
67
|
+
const onError = () => {
|
|
68
|
+
const e = el.error;
|
|
69
|
+
const detail = `MediaError code ${e ? e.code : "?"}: ${e?.message ? e.message : "no detail"}`;
|
|
70
|
+
done(new Error(buildUndecodableMessage("media-error", detail, comp.source.videoUrl)));
|
|
71
|
+
};
|
|
72
|
+
el.addEventListener("canplay", onCanPlay, { once: true });
|
|
73
|
+
el.addEventListener("error", onError, { once: true });
|
|
74
|
+
timer = setTimeout(() => {
|
|
75
|
+
const detail = `readyState=${el.readyState}`;
|
|
76
|
+
done(new Error(buildUndecodableMessage("timeout", detail, comp.source.videoUrl)));
|
|
77
|
+
}, 30000);
|
|
78
|
+
el.src = comp.source.videoUrl;
|
|
79
|
+
el.load();
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
43
83
|
const t = createSignal(0);
|
|
44
84
|
|
|
45
85
|
// The camera: ONE eased viewport rect (centre + size in lockstep, targets
|
|
@@ -114,11 +154,13 @@ export default makeScene2D("take", function* (view) {
|
|
|
114
154
|
</Rect>
|
|
115
155
|
|
|
116
156
|
{/* click ripples — pointer-landing beats only (scroll/press have no
|
|
117
|
-
spatial click point
|
|
118
|
-
|
|
119
|
-
|
|
157
|
+
spatial click point; a look touches nothing, and a ripple at a point
|
|
158
|
+
the cursor never visited would invent a click that did not happen).
|
|
159
|
+
A dropFiles ripples at its DROP point on RELEASE — not at the
|
|
160
|
+
off-content carry entry — and stays on even when the ghost card is
|
|
161
|
+
disabled (parity with the editor preview). */}
|
|
120
162
|
{comp.events
|
|
121
|
-
.filter((e) => e.kind !== "scroll" && e.kind !== "press")
|
|
163
|
+
.filter((e) => e.kind !== "scroll" && e.kind !== "press" && e.kind !== "look")
|
|
122
164
|
.map((e, index) => {
|
|
123
165
|
const ms = comp.cursor.rippleMs / 1000;
|
|
124
166
|
const at =
|
|
@@ -303,5 +345,129 @@ export default makeScene2D("take", function* (view) {
|
|
|
303
345
|
if (review.label) view.add(pill(review.label, 1, true));
|
|
304
346
|
}
|
|
305
347
|
|
|
348
|
+
// Viewer-facing captions — SCREEN space like the review decor, but a
|
|
349
|
+
// first-class composition field drawn on EVERY render including the master.
|
|
350
|
+
// Bottom-CENTER (the subtitle slot), so review badges (bottom-left) never
|
|
351
|
+
// collide with it. Footage shows what happened; the caption says what it
|
|
352
|
+
// means — the difference between a demo a stranger can follow and "the
|
|
353
|
+
// screen moves around". 160ms fades: soft under motion blur, never a pop.
|
|
354
|
+
//
|
|
355
|
+
// Anchored INSIDE the framed card (above the at-rest backdrop band), never
|
|
356
|
+
// on the frame's edge: a pill straddling the card/backdrop seam has the
|
|
357
|
+
// zooming card boundary sweep THROUGH it, which reads as the caption itself
|
|
358
|
+
// moving — the field complaint that motivated this anchor. Sized for the
|
|
359
|
+
// couch, not the badge rail: 34px @1080 with a 600 weight (CJK at 500 reads
|
|
360
|
+
// thin), a hairline border and a soft drop shadow so it sits ON the video
|
|
361
|
+
// as a produced element instead of a debug overlay.
|
|
362
|
+
// CINEMA-style, not boxed: film subtitles earn their look from big
|
|
363
|
+
// confident type sitting on a soft bottom scrim — the pill/box treatment
|
|
364
|
+
// (two attempts, both rejected in the field) reads as a debug overlay no
|
|
365
|
+
// matter how it is dressed. The scrim is constant while captions exist
|
|
366
|
+
// (a pulsing scrim is worse than none) and the type carries a TIGHT
|
|
367
|
+
// shadow: at 1080p the footage is 4K-downsampled (supersampled-sharp)
|
|
368
|
+
// while overlays render native, so overlays must lean on stroke weight
|
|
369
|
+
// and contrast — a wide blur reads as smear next to that footage.
|
|
370
|
+
const k = oH / 1080;
|
|
371
|
+
const FONT = "system-ui, -apple-system, 'Segoe UI', 'Noto Sans', sans-serif";
|
|
372
|
+
if (comp.captions?.length) {
|
|
373
|
+
const cardBottom = (oH / 2) * comp.framing.insetFrac;
|
|
374
|
+
const scrimH = 190 * k;
|
|
375
|
+
view.add(
|
|
376
|
+
<Rect
|
|
377
|
+
width={oW}
|
|
378
|
+
height={scrimH}
|
|
379
|
+
position={[0, oH / 2]}
|
|
380
|
+
offset={[0, 1]}
|
|
381
|
+
fill={
|
|
382
|
+
new Gradient({
|
|
383
|
+
type: "linear",
|
|
384
|
+
from: { x: 0, y: -scrimH / 2 },
|
|
385
|
+
to: { x: 0, y: scrimH / 2 },
|
|
386
|
+
stops: [
|
|
387
|
+
{ offset: 0, color: "rgba(0,0,0,0)" },
|
|
388
|
+
{ offset: 1, color: "rgba(0,0,0,0.55)" },
|
|
389
|
+
],
|
|
390
|
+
})
|
|
391
|
+
}
|
|
392
|
+
/>,
|
|
393
|
+
);
|
|
394
|
+
for (const c of comp.captions) {
|
|
395
|
+
const op = () => {
|
|
396
|
+
const ms = t() * 1000;
|
|
397
|
+
if (ms < c.fromMs || ms >= c.toMs) return 0;
|
|
398
|
+
const inF = Math.min(1, (ms - c.fromMs) / 160);
|
|
399
|
+
const outF = Math.min(1, (c.toMs - ms) / 160);
|
|
400
|
+
return Math.min(inF, outF);
|
|
401
|
+
};
|
|
402
|
+
view.add(
|
|
403
|
+
<Txt
|
|
404
|
+
text={c.text}
|
|
405
|
+
fontFamily={FONT}
|
|
406
|
+
fontSize={36 * k}
|
|
407
|
+
fontWeight={600}
|
|
408
|
+
letterSpacing={0.8 * k}
|
|
409
|
+
fill={"rgba(255,255,255,0.98)"}
|
|
410
|
+
shadowColor={"rgba(0,0,0,0.9)"}
|
|
411
|
+
shadowBlur={6 * k}
|
|
412
|
+
shadowOffset={[0, 2 * k]}
|
|
413
|
+
maxWidth={oW * 0.82}
|
|
414
|
+
textWrap={true}
|
|
415
|
+
textAlign={"center"}
|
|
416
|
+
position={[0, cardBottom - 26 * k]}
|
|
417
|
+
offset={[0, 1]}
|
|
418
|
+
opacity={op}
|
|
419
|
+
/>,
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// Opening title card — full-frame scrim + the app/thesis in big type over
|
|
425
|
+
// the establishing hold, gone by untilMs. The cheapest "produced, not
|
|
426
|
+
// captured" signal; typographic and deterministic by design (no generated
|
|
427
|
+
// imagery — brand-safe, language follows the author, deletable field).
|
|
428
|
+
if (comp.titleCard?.title) {
|
|
429
|
+
const tc = comp.titleCard;
|
|
430
|
+
const untilMs = tc.untilMs ?? (comp.startMs ?? 0) + 1800;
|
|
431
|
+
const tcOp = () => {
|
|
432
|
+
const ms = t() * 1000;
|
|
433
|
+
if (ms >= untilMs) return 0;
|
|
434
|
+
return Math.min(1, (untilMs - ms) / 300);
|
|
435
|
+
};
|
|
436
|
+
view.add(
|
|
437
|
+
<Rect width={oW} height={oH} position={[0, 0]} fill={"rgba(6,7,14,0.55)"} opacity={tcOp} />,
|
|
438
|
+
);
|
|
439
|
+
view.add(
|
|
440
|
+
<Txt
|
|
441
|
+
text={tc.title}
|
|
442
|
+
fontFamily={FONT}
|
|
443
|
+
fontSize={72 * k}
|
|
444
|
+
fontWeight={800}
|
|
445
|
+
letterSpacing={2 * k}
|
|
446
|
+
fill={"rgba(255,255,255,0.98)"}
|
|
447
|
+
shadowColor={"rgba(0,0,0,0.8)"}
|
|
448
|
+
shadowBlur={10 * k}
|
|
449
|
+
shadowOffset={[0, 3 * k]}
|
|
450
|
+
position={[0, tc.subtitle ? -26 * k : 0]}
|
|
451
|
+
opacity={tcOp}
|
|
452
|
+
/>,
|
|
453
|
+
);
|
|
454
|
+
if (tc.subtitle)
|
|
455
|
+
view.add(
|
|
456
|
+
<Txt
|
|
457
|
+
text={tc.subtitle}
|
|
458
|
+
fontFamily={FONT}
|
|
459
|
+
fontSize={30 * k}
|
|
460
|
+
fontWeight={500}
|
|
461
|
+
letterSpacing={1 * k}
|
|
462
|
+
fill={"rgba(255,255,255,0.78)"}
|
|
463
|
+
shadowColor={"rgba(0,0,0,0.8)"}
|
|
464
|
+
shadowBlur={8 * k}
|
|
465
|
+
shadowOffset={[0, 2 * k]}
|
|
466
|
+
position={[0, 40 * k]}
|
|
467
|
+
opacity={tcOp}
|
|
468
|
+
/>,
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
|
|
306
472
|
yield* tween(cam.T, (v) => t(v * cam.T), linear);
|
|
307
473
|
});
|
package/src/types.ts
CHANGED
|
@@ -25,6 +25,11 @@ export type CaptureEventBase = {
|
|
|
25
25
|
/** selector / note, kept for editability */
|
|
26
26
|
sel?: string;
|
|
27
27
|
note?: string;
|
|
28
|
+
/** One-line viewer-facing caption from the plan step ("Applying the
|
|
29
|
+
* filter re-prices every row"). planComposition turns these into `captions`
|
|
30
|
+
* windows — the beat explains itself to a viewer who has never seen the
|
|
31
|
+
* app, which footage alone cannot do. */
|
|
32
|
+
caption?: string;
|
|
28
33
|
/** selective-zoom intent from the plan. Absent/"auto" ⇒ the camera director
|
|
29
34
|
* decides from the ground-truth log; "always"/"never" hard-override it (and
|
|
30
35
|
* cut the beat out of any cluster — an override is a segment boundary). */
|
|
@@ -91,6 +96,19 @@ export type CaptureHover = CaptureEventBase & {
|
|
|
91
96
|
durationMs: number;
|
|
92
97
|
};
|
|
93
98
|
|
|
99
|
+
/** A look: a CAMERA-only beat. Nothing is done to the page and the cursor
|
|
100
|
+
* does not move — the camera frames the target element and holds for
|
|
101
|
+
* `durationMs`. This is the honest spelling of "show the viewer this
|
|
102
|
+
* region": before it existed, the only way to aim the camera was to hover
|
|
103
|
+
* a control you never meant to activate, which reads on screen as a
|
|
104
|
+
* promise ("about to click") the video then breaks. `x,y` is the target's
|
|
105
|
+
* center (zoom anchor); the cursor rests at its previous anchor. */
|
|
106
|
+
export type CaptureLook = CaptureEventBase & {
|
|
107
|
+
kind: "look";
|
|
108
|
+
/** ms the framed hold occupies on screen */
|
|
109
|
+
durationMs: number;
|
|
110
|
+
};
|
|
111
|
+
|
|
94
112
|
/** A key press / shortcut: keyboard-driven, so the cursor holds (no travel).
|
|
95
113
|
* Holds for `durationMs` while the effect plays out; if a reveal element was
|
|
96
114
|
* located, `box` carries its bbox so the zoom can frame it. */
|
|
@@ -127,6 +145,7 @@ export type CaptureEvent =
|
|
|
127
145
|
| CaptureDrag
|
|
128
146
|
| CaptureScroll
|
|
129
147
|
| CaptureHover
|
|
148
|
+
| CaptureLook
|
|
130
149
|
| CapturePress
|
|
131
150
|
| CaptureDropFiles;
|
|
132
151
|
|
|
@@ -203,7 +222,7 @@ export type GhostCardConfig = {
|
|
|
203
222
|
};
|
|
204
223
|
|
|
205
224
|
export type CompEvent = {
|
|
206
|
-
kind: "click" | "type" | "drag" | "scroll" | "hover" | "press" | "dropFiles";
|
|
225
|
+
kind: "click" | "type" | "drag" | "scroll" | "hover" | "look" | "press" | "dropFiles";
|
|
207
226
|
tMs: number;
|
|
208
227
|
/** anchor point (click / focus / drag start / hover) in video-px. For a
|
|
209
228
|
* scroll/press the cursor does not move; this is its resting point. */
|
|
@@ -363,6 +382,23 @@ export type MotionBlurConfig = {
|
|
|
363
382
|
* (inclusive) to `toMs` (exclusive) on the composition timeline. */
|
|
364
383
|
export type ReviewBadge = { fromMs: number; toMs: number; text: string };
|
|
365
384
|
|
|
385
|
+
/** One viewer-facing caption window on the DELIVERED video: `text` shows
|
|
386
|
+
* bottom-center from `fromMs` (inclusive) to `toMs` (exclusive) on the
|
|
387
|
+
* composition timeline. Unlike ReviewBadge this is a first-class, persisted
|
|
388
|
+
* composition field rendered on masters — footage alone shows WHAT happened;
|
|
389
|
+
* the caption says what it MEANS, which is the difference between a demo a
|
|
390
|
+
* stranger can follow and "the screen moves around". Absent ⇒ rendered
|
|
391
|
+
* output is byte-identical to a caption-less composition. */
|
|
392
|
+
export type Caption = { fromMs: number; toMs: number; text: string };
|
|
393
|
+
|
|
394
|
+
/** An opening title card: `title` (the app / the thesis) over a full-frame
|
|
395
|
+
* scrim on top of the establishing hold, gone by `untilMs` (300ms fade).
|
|
396
|
+
* Typographic and deterministic — rendered by the scene in the composition's
|
|
397
|
+
* own look, in whatever language the author wrote, deletable like any field
|
|
398
|
+
* — never generated imagery. The single cheapest "produced, not captured"
|
|
399
|
+
* signal a demo can send. */
|
|
400
|
+
export type TitleCard = { title: string; subtitle?: string; untilMs?: number };
|
|
401
|
+
|
|
366
402
|
/** Render-time decoration for review copies and A/B variant reels: burned-in
|
|
367
403
|
* beat badges, a REVIEW watermark, and a per-variant corner label. Drawn by the
|
|
368
404
|
* scene in SCREEN space (fixed, outside the composition camera) so the text is
|
|
@@ -454,12 +490,25 @@ export type TakeComposition = {
|
|
|
454
490
|
* capture is the ground truth); only the delivered head moves. 0/absent =
|
|
455
491
|
* no trim. */
|
|
456
492
|
startMs?: number;
|
|
457
|
-
/**
|
|
493
|
+
/** Viewer-facing captions, drawn bottom-center in SCREEN space (outside the
|
|
494
|
+
* camera — legible at any zoom) on EVERY render including the master.
|
|
495
|
+
* Persisted and hand-editable like any composition field; times are on the
|
|
496
|
+
* untrimmed composition timeline (same convention as zoom.inAtMs — a
|
|
497
|
+
* caption entirely inside the startMs head trim is never seen, and the
|
|
498
|
+
* validator says so). Seeded from the plan steps' `caption` fields by
|
|
499
|
+
* planComposition. */
|
|
500
|
+
captions?: Caption[];
|
|
501
|
+
/** optional opening title card over the establishing hold (see TitleCard) */
|
|
502
|
+
titleCard?: TitleCard;
|
|
503
|
+
/** render-time review decoration (badges/watermark/label); never persisted
|
|
504
|
+
* (render strips exactly this field — `captions` above deliberately IS
|
|
505
|
+
* persisted; it is content, not review scaffolding) */
|
|
458
506
|
review?: ReviewDecor;
|
|
459
507
|
};
|
|
460
508
|
|
|
461
|
-
/** True when motion blur is configured to actually do something
|
|
462
|
-
*
|
|
509
|
+
/** True when motion blur is configured to actually do something — whether the
|
|
510
|
+
* delivery encode folds in the tmix shutter average (render.ts deliverMp4;
|
|
511
|
+
* OFF skips tmix but still runs the same single delivery encode). */
|
|
463
512
|
export function motionBlurActive(mb: MotionBlurConfig | undefined): mb is MotionBlurConfig {
|
|
464
513
|
return !!mb && mb.samples > 1 && mb.shutter > 0;
|
|
465
514
|
}
|
package/src/validate.ts
CHANGED
|
@@ -70,6 +70,8 @@ const reqField: Record<string, string> = {
|
|
|
70
70
|
press: "keys",
|
|
71
71
|
drag: "to",
|
|
72
72
|
dropFiles: "to",
|
|
73
|
+
// a look IS its hold — without a duration there is no beat to render
|
|
74
|
+
look: "durationMs",
|
|
73
75
|
};
|
|
74
76
|
|
|
75
77
|
export function validateComposition(
|
|
@@ -487,7 +489,10 @@ export function validateComposition(
|
|
|
487
489
|
`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`,
|
|
488
490
|
`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`,
|
|
489
491
|
);
|
|
490
|
-
|
|
492
|
+
// press: reveal-timed by construction. look: nothing fires at tMs —
|
|
493
|
+
// the camera arriving early in the DWELL is the beat working as
|
|
494
|
+
// designed, so "the frame slides out from under it" cannot happen.
|
|
495
|
+
if (e.kind === "press" || e.kind === "look") continue;
|
|
491
496
|
const lateMs = Math.round(r.landMs - e.tMs);
|
|
492
497
|
if (lateMs <= MOVING_AT_ACTION_MS) continue;
|
|
493
498
|
if (!(rampMs > 0) || lateMs / rampMs <= MOVING_AT_ACTION_FRAC) continue;
|
|
@@ -538,6 +543,22 @@ export function validateComposition(
|
|
|
538
543
|
}
|
|
539
544
|
}
|
|
540
545
|
|
|
546
|
+
// Dead HEAD — the mirror of the dead-tail check. A capture that had to wait
|
|
547
|
+
// out a cold load (map tiles, data fetch) ships that whole wait unless
|
|
548
|
+
// startMs trims it, and "8 seconds of nothing, then the cursor moves" is
|
|
549
|
+
// the first thing every viewer sees. The wait was necessary to SHOOT;
|
|
550
|
+
// shipping it is a choice, and the default choice should be no.
|
|
551
|
+
if (comp.events.length) {
|
|
552
|
+
const firstVisible = comp.events[0]!.zoom.inAtMs;
|
|
553
|
+
const deadHeadMs = firstVisible - (comp.startMs ?? 0);
|
|
554
|
+
if (deadHeadMs > DEAD_TAIL_MS)
|
|
555
|
+
warn(
|
|
556
|
+
"startMs",
|
|
557
|
+
`${(deadHeadMs / 1000).toFixed(1)}s of dead opening before the first beat's camera moves — the delivered video starts on a frozen screen`,
|
|
558
|
+
`set startMs ≈ ${Math.max(0, firstVisible - 1200)} (leave ~1.2s of establishing hold, trim the rest of the load wait)`,
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
|
|
541
562
|
// head trim: cut dead pre-paint frames, never a beat. The trim only moves
|
|
542
563
|
// the delivered head — tMs values stay on the capture timeline.
|
|
543
564
|
const startMs = comp.startMs;
|
|
@@ -556,6 +577,49 @@ export function validateComposition(
|
|
|
556
577
|
);
|
|
557
578
|
}
|
|
558
579
|
|
|
580
|
+
// --- captions: viewer-facing timeline overlays on the DELIVERED video ---
|
|
581
|
+
// Times are on the untrimmed composition timeline, like zoom.inAtMs.
|
|
582
|
+
for (const [i, cap] of (comp.captions ?? []).entries()) {
|
|
583
|
+
if (!cap.text?.trim()) {
|
|
584
|
+
err(`captions[${i}].text`, "empty caption text", "give the caption a line, or delete it");
|
|
585
|
+
continue;
|
|
586
|
+
}
|
|
587
|
+
if (!(cap.toMs > cap.fromMs))
|
|
588
|
+
err(
|
|
589
|
+
`captions[${i}].toMs`,
|
|
590
|
+
`toMs ${cap.toMs} is not after fromMs ${cap.fromMs} — an inverted/empty window shows nothing`,
|
|
591
|
+
"set toMs > fromMs (a readable line needs ~1500ms on screen)",
|
|
592
|
+
);
|
|
593
|
+
if (!(cap.fromMs >= 0) || cap.fromMs >= comp.durationMs)
|
|
594
|
+
err(
|
|
595
|
+
`captions[${i}].fromMs`,
|
|
596
|
+
`fromMs ${cap.fromMs} outside [0, durationMs ${comp.durationMs})`,
|
|
597
|
+
"captions live on the composition timeline",
|
|
598
|
+
);
|
|
599
|
+
const prev = comp.captions?.[i - 1];
|
|
600
|
+
if (prev && cap.fromMs < prev.toMs)
|
|
601
|
+
warn(
|
|
602
|
+
`captions[${i}].fromMs`,
|
|
603
|
+
`window [${cap.fromMs}, ${cap.toMs}) overlaps captions[${i - 1}] [${prev.fromMs}, ${prev.toMs}) — two pills stack in the same slot`,
|
|
604
|
+
`start this caption at ${prev.toMs}, or end the previous one at ${cap.fromMs}`,
|
|
605
|
+
);
|
|
606
|
+
if (comp.startMs != null && cap.toMs <= comp.startMs)
|
|
607
|
+
warn(
|
|
608
|
+
`captions[${i}]`,
|
|
609
|
+
`window [${cap.fromMs}, ${cap.toMs}) sits entirely inside the startMs head trim (${comp.startMs}) — it is never seen`,
|
|
610
|
+
"move the window past the trim, or delete the caption",
|
|
611
|
+
);
|
|
612
|
+
if (cap.text.trim().length > 120)
|
|
613
|
+
warn(
|
|
614
|
+
`captions[${i}].text`,
|
|
615
|
+
`${cap.text.trim().length} chars — a caption is one explanatory sentence, not a paragraph`,
|
|
616
|
+
"cut to one sentence (~15-30 CJK chars / 8-14 words); move detail into the beat itself",
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
if (comp.titleCard && !comp.titleCard.title?.trim())
|
|
621
|
+
err("titleCard.title", "empty title on a title card", "give it the app/thesis line, or delete titleCard");
|
|
622
|
+
|
|
559
623
|
// --- CAPTURE-LOCKED: action tMs must match the recording ---
|
|
560
624
|
// The video is temporal: a beat's tMs is WHEN it is visible in the capture.
|
|
561
625
|
// A render-only edit cannot move that, so a drifted tMs would fire the
|