@open-take/compositor 0.5.0 → 0.5.2

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/src/render.ts CHANGED
@@ -31,8 +31,9 @@ import { dirname, join, resolve, sep } from "node:path";
31
31
  import { fileURLToPath } from "node:url";
32
32
  import { renderVideo } from "@open-take/revideo-renderer";
33
33
  import { isCaptureUndecodable } from "./decode-guard";
34
- import { ffmpegHasEncoder, repairBundledMediaPermissions, resolveFfmpeg } from "./ffmpeg";
34
+ import { ffmpegHasEncoder, resolveFfmpeg, resolveFfprobe } from "./ffmpeg";
35
35
  import { type PlanOpts, planComposition } from "./plan";
36
+ import { withRenderLock } from "./render-lock";
36
37
  import {
37
38
  type CaptureLog,
38
39
  type MotionBlurConfig,
@@ -40,7 +41,6 @@ import {
40
41
  type TakeComposition,
41
42
  } from "./types";
42
43
  import { type CompositionIssue, formatIssues, validateComposition } from "./validate";
43
- import { withRenderLock } from "./render-lock";
44
44
 
45
45
  // dist/index.js -> package root
46
46
  const PKG_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
@@ -350,10 +350,9 @@ async function renderTakeExclusive(opts: RenderTakeOpts): Promise<RenderTakeResu
350
350
  ? ([composition.startMs / 1000, composition.durationMs / 1000 + 120] as [number, number])
351
351
  : undefined);
352
352
 
353
- // Revideo spawns its bundled ffprobe directly. Repair installer permissions
354
- // here so published consumers are protected even though they do not run the
355
- // monorepo root's postinstall script.
356
- await repairBundledMediaPermissions();
353
+ // Revideo's exporter spawns ffmpeg/ffprobe itself and would default to the
354
+ // binaries its own dependency bundles (an old 4.x); point it at ours.
355
+ const ffmpeg = { ffmpegPath: await resolveFfmpeg(), ffprobePath: await resolveFfprobe() };
357
356
 
358
357
  // 1. lay out this render's own directory (scene + composition + capture).
359
358
  // The intermediate starts as H.264; the decode-guard retry below swaps
@@ -386,6 +385,7 @@ async function renderTakeExclusive(opts: RenderTakeOpts): Promise<RenderTakeResu
386
385
  outFile: "take.mov",
387
386
  outDir: RENDER_OUT,
388
387
  workers: 1,
388
+ ffmpeg,
389
389
  // ProRes 4444 intermediate, NOT revideo's default wasm exporter: the
390
390
  // wasm path encodes H.264 in-browser via WebCodecs at the browser's
391
391
  // default bitrate (mp4-wasm passes `bitrate: undefined`, and revideo
@@ -5,6 +5,8 @@ import {
5
5
  launchEase,
6
6
  launchSceneWindows,
7
7
  transitionOpacity,
8
+ frameCentreS,
9
+ quantizeToFrame,
8
10
  } from "../launch-evaluate";
9
11
  import comp from "./.launch-composition.json";
10
12
  import { createMotionLayers } from "./motion-layers";
@@ -164,8 +166,11 @@ export default makeScene2D("launch", function* (view) {
164
166
  <Video
165
167
  src={scene.asset}
166
168
  time={() =>
167
- (scene.trimStartS ?? 0) +
168
- Math.max(0, Math.min(scene.durationS - 1 / comp.output.fps, local()))
169
+ frameCentreS(
170
+ (scene.trimStartS ?? 0) +
171
+ Math.max(0, Math.min(scene.durationS - 1 / comp.output.fps, local())),
172
+ comp.output.fps,
173
+ )
169
174
  }
170
175
  alpha={() => (active() ? 1 : 0)}
171
176
  decoder="slow"
@@ -411,5 +416,11 @@ export default makeScene2D("launch", function* (view) {
411
416
  }
412
417
  view.add(root);
413
418
  }
414
- yield* tween(windows.at(-1).endS, (v) => t(v * windows.at(-1).endS), linear);
419
+ // Snap the accumulated clock to the output frame grid so keyframes authored on
420
+ // a frame are reached on that frame, not the next.
421
+ yield* tween(
422
+ windows.at(-1).endS,
423
+ (v) => t(quantizeToFrame(v * windows.at(-1).endS, comp.output.fps)),
424
+ linear,
425
+ );
415
426
  });
@@ -1,4 +1,5 @@
1
1
  import { Circle, Img, Line, Node, Rect, Txt, Video } from "@revideo/2d";
2
+ import { frameCentreS } from "../launch-evaluate";
2
3
  import { evaluateMotionScene } from "../motion-evaluate";
3
4
  import type { EvaluatedMotionLayer, MotionLayer, MotionScene } from "../motion-types";
4
5
 
@@ -216,7 +217,9 @@ export function createMotionLayers({
216
217
  time={() => {
217
218
  const layer = get();
218
219
  const lastSample = layer.trimStartS + Math.max(0, layer.durationS - 1 / output.fps);
219
- return Math.min(layer.mediaTimeS, lastSample);
220
+ // Prepared media runs at the output rate; seek to the centre of the
221
+ // intended frame so millisecond timestamps never select the previous one.
222
+ return frameCentreS(Math.min(layer.mediaTimeS, lastSample), output.fps);
220
223
  }}
221
224
  />
222
225
  ) as FittedVideo;
package/src/types.ts CHANGED
@@ -35,10 +35,13 @@ export type CaptureEventBase = {
35
35
  * cut the beat out of any cluster — an override is a segment boundary). */
36
36
  zoom?: ZoomIntent;
37
37
  /** CAPTURE-DERIVED (frame-diff / mutation pass — the `effectBox` seam): the
38
- * region that actually CHANGED after the action, viewport CSS px. The
39
- * director frames THIS over `box` when present — a `type`'s result region, or
40
- * a payoff that lands somewhere other than where you clicked. Absent ⇒ the
41
- * director shapes an ROI from `box`/kind instead. */
38
+ * region that actually CHANGED after the action, viewport CSS px — the
39
+ * DOMINANT one when the action changed several disjoint places (a control's
40
+ * own active state plus a hint line far away), never their union, whose
41
+ * centre would sit on nothing. The director frames THIS over `box` when
42
+ * present — a `type`'s result region, or a payoff that lands somewhere other
43
+ * than where you clicked. Absent ⇒ the director shapes an ROI from
44
+ * `box`/kind instead. */
42
45
  effectBox?: BBox;
43
46
  /** CAPTURE-DERIVED (same pass): fraction of the frame that changed after the
44
47
  * action, 0..1. ≥ camera.pullOutCoverage ⇒ the action repainted most of the