@dantea/opencut 0.1.0 → 0.2.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.
Files changed (93) hide show
  1. package/dist/commands.d.ts +9 -1
  2. package/dist/commands.js +32 -5
  3. package/dist/index.js +1 -0
  4. package/dist/inspection.js +5 -0
  5. package/dist/mix-options.d.ts +59 -0
  6. package/dist/mix-options.js +23 -0
  7. package/dist/system-probe +0 -0
  8. package/dist/video.d.ts +1 -1
  9. package/dist/video.js +28 -3
  10. package/docs/AUDIO_MIX.md +132 -0
  11. package/docs/CLI.md +46 -6
  12. package/docs/INSTALL.md +13 -8
  13. package/docs/SDK.md +14 -3
  14. package/docs/VIDEO_DEFINITIONS.md +17 -8
  15. package/node_modules/@opencut/core/dist/index.d.ts +1 -0
  16. package/node_modules/@opencut/core/dist/index.js +1 -0
  17. package/node_modules/@opencut/core/dist/inspection.d.ts +115 -0
  18. package/node_modules/@opencut/core/dist/professional-mix.d.ts +129 -0
  19. package/node_modules/@opencut/core/dist/professional-mix.js +70 -0
  20. package/node_modules/@opencut/core/dist/project.d.ts +68 -0
  21. package/node_modules/@opencut/core/dist/project.js +15 -0
  22. package/node_modules/@opencut/core/dist/render-plan.d.ts +5 -1
  23. package/node_modules/@opencut/core/dist/render-plan.js +11 -4
  24. package/node_modules/@opencut/core/dist/render-sources.d.ts +4 -0
  25. package/node_modules/@opencut/core/dist/timeline-view.d.ts +1 -0
  26. package/node_modules/@opencut/core/dist/video-audio-mix.d.ts +25 -0
  27. package/node_modules/@opencut/core/dist/video-audio-mix.js +36 -0
  28. package/node_modules/@opencut/core/dist/video-build.js +2 -2
  29. package/node_modules/@opencut/core/dist/video-compiler.d.ts +3 -0
  30. package/node_modules/@opencut/core/dist/video-compiler.js +20 -1
  31. package/node_modules/@opencut/core/dist/video-definition.d.ts +121 -0
  32. package/node_modules/@opencut/core/dist/video-definition.js +6 -1
  33. package/node_modules/@opencut/core/dist/video-files.d.ts +55 -0
  34. package/node_modules/@opencut/core/dist/video-media-cache.d.ts +15 -0
  35. package/node_modules/@opencut/core/dist/{video-recipe-cache.js → video-media-cache.js} +7 -7
  36. package/node_modules/@opencut/core/dist/video-package-format.d.ts +53 -0
  37. package/node_modules/@opencut/core/dist/video-picture-cache.d.ts +3 -0
  38. package/node_modules/@opencut/core/dist/video-picture-cache.js +29 -0
  39. package/node_modules/@opencut/core/dist/video-preview.d.ts +56 -1
  40. package/node_modules/@opencut/core/dist/video-preview.js +7 -2
  41. package/node_modules/@opencut/core/dist/video-processing.js +2 -2
  42. package/node_modules/@opencut/core/dist/video-render.d.ts +14 -4
  43. package/node_modules/@opencut/core/dist/video-render.js +21 -3
  44. package/node_modules/@opencut/core/dist/video-watch.d.ts +5 -0
  45. package/node_modules/@opencut/core/dist/video-watch.js +18 -2
  46. package/node_modules/@opencut/core/dist/video.d.ts +5 -0
  47. package/node_modules/@opencut/core/dist/video.js +2 -0
  48. package/node_modules/@opencut/core/package.json +3 -3
  49. package/node_modules/@opencut/media/dist/audio-graph.d.ts +88 -0
  50. package/node_modules/@opencut/media/dist/audio-graph.js +292 -0
  51. package/node_modules/@opencut/media/dist/audio-mastering.d.ts +29 -0
  52. package/node_modules/@opencut/media/dist/audio-mastering.js +205 -0
  53. package/node_modules/@opencut/media/dist/deepfilter.d.ts +4 -0
  54. package/node_modules/@opencut/media/dist/deepfilter.js +76 -0
  55. package/node_modules/@opencut/media/dist/dialogue-analysis.d.ts +32 -0
  56. package/node_modules/@opencut/media/dist/dialogue-analysis.js +214 -0
  57. package/node_modules/@opencut/media/dist/enhance.js +11 -3
  58. package/node_modules/@opencut/media/dist/index.d.ts +4 -1
  59. package/node_modules/@opencut/media/dist/index.js +1 -1
  60. package/node_modules/@opencut/media/dist/picture-cache.d.ts +39 -0
  61. package/node_modules/@opencut/media/dist/picture-cache.js +169 -0
  62. package/node_modules/@opencut/media/dist/picture-seek.d.ts +4 -0
  63. package/node_modules/@opencut/media/dist/picture-seek.js +77 -0
  64. package/node_modules/@opencut/media/dist/process-memory +0 -0
  65. package/node_modules/@opencut/media/dist/process.d.ts +2 -1
  66. package/node_modules/@opencut/media/dist/process.js +13 -4
  67. package/node_modules/@opencut/media/dist/professional-mix.d.ts +34 -0
  68. package/node_modules/@opencut/media/dist/professional-mix.js +411 -0
  69. package/node_modules/@opencut/media/dist/render-budget.d.ts +1 -1
  70. package/node_modules/@opencut/media/dist/render-budget.js +7 -5
  71. package/node_modules/@opencut/media/dist/render.d.ts +33 -47
  72. package/node_modules/@opencut/media/dist/render.js +273 -333
  73. package/node_modules/@opencut/media/dist/transform-layer.d.ts +7 -1
  74. package/node_modules/@opencut/media/dist/transform-layer.js +32 -2
  75. package/node_modules/@opencut/media/dist/video-enhance +0 -0
  76. package/node_modules/@opencut/media/dist/video-filter.d.ts +2 -0
  77. package/node_modules/@opencut/media/dist/video-filter.js +4 -0
  78. package/node_modules/@opencut/media/dist/video-interpolate +0 -0
  79. package/node_modules/@opencut/media/package.json +2 -2
  80. package/node_modules/@opencut/sdk/dist/index.d.ts +2 -2
  81. package/node_modules/@opencut/sdk/dist/index.js +1 -1
  82. package/node_modules/@opencut/sdk/package.json +3 -3
  83. package/node_modules/@opencut/shared/dist/index.d.ts +1 -0
  84. package/node_modules/@opencut/shared/dist/index.js +1 -0
  85. package/node_modules/@opencut/shared/dist/professional-mix.d.ts +98 -0
  86. package/node_modules/@opencut/shared/dist/professional-mix.js +30 -0
  87. package/node_modules/@opencut/shared/package.json +1 -1
  88. package/package.json +5 -5
  89. package/skills/video-editor/SKILL.md +13 -1
  90. package/skills/video-editor/references/cli.md +14 -0
  91. package/skills/video-editor/references/sdk.md +9 -0
  92. package/skills/video-editor/references/video-definitions.md +7 -3
  93. package/node_modules/@opencut/core/dist/video-recipe-cache.d.ts +0 -16
@@ -1,4 +1,8 @@
1
1
  declare const commands: {
2
+ 'mix analyze': {
3
+ args: string;
4
+ options: string[];
5
+ };
2
6
  package: {
3
7
  args: string;
4
8
  options: string[];
@@ -103,6 +107,10 @@ declare const commands: {
103
107
  type Command = keyof typeof commands;
104
108
  export declare function parseCommandLine(args: string[]): {
105
109
  values: {
110
+ 'picture-cache'?: string;
111
+ 'mix-settings'?: string;
112
+ 'mix-comparison'?: string;
113
+ 'mix-cache'?: string;
106
114
  output?: string;
107
115
  root?: string;
108
116
  resource?: string[];
@@ -152,7 +160,7 @@ export declare function parseCommandLine(args: string[]): {
152
160
  export type CommandOptions = ReturnType<typeof parseCommandLine>['values'];
153
161
  export declare function commandUsage(command: Command): string;
154
162
  export declare function resolveCommand(positionals: string[], options: CommandOptions): {
155
- command: "package" | "package verify" | "build inspect" | "validate" | "inspect" | "recipes inspect" | "recipes validate" | "timeline inspect" | "render" | "batch" | "preview" | "preview frame" | "preview clip" | "preview contact-sheet" | "subtitles export" | "probe" | "extract-frame" | "separate-dialogue" | "online search" | "online download" | "doctor" | "models inspect" | "models install" | "models remove" | "system inspect";
163
+ command: "mix analyze" | "package" | "package verify" | "build inspect" | "validate" | "inspect" | "recipes inspect" | "recipes validate" | "timeline inspect" | "render" | "batch" | "preview" | "preview frame" | "preview clip" | "preview contact-sheet" | "subtitles export" | "probe" | "extract-frame" | "separate-dialogue" | "online search" | "online download" | "doctor" | "models inspect" | "models install" | "models remove" | "system inspect";
156
164
  file: string;
157
165
  };
158
166
  export declare function printHelp(positionals: string[], json: boolean | undefined): void;
package/dist/commands.js CHANGED
@@ -5,6 +5,10 @@ import { UsageError } from './usage.js';
5
5
  const optionTypes = {
6
6
  ...processingOptionTypes,
7
7
  ...renderOptionTypes,
8
+ 'picture-cache': { type: 'string' },
9
+ 'mix-settings': { type: 'string' },
10
+ 'mix-comparison': { type: 'string' },
11
+ 'mix-cache': { type: 'string' },
8
12
  output: { type: 'string', short: 'o' },
9
13
  root: { type: 'string' },
10
14
  resource: { type: 'string', multiple: true },
@@ -34,7 +38,20 @@ const definition = '<definition.video.ts>';
34
38
  const params = '[--params <params.json>]';
35
39
  const position = '(--frame <n> | --timestamp <time>)';
36
40
  const previewOptions = ['quality', ...Object.keys(processingOptionTypes)];
41
+ const mixOptions = ['mix-settings', 'mix-comparison', 'mix-cache'];
42
+ const mixUsage = '[--mix-settings <mix.json>] [--mix-comparison <before|after>] [--mix-cache <directory>]';
37
43
  const commands = {
44
+ 'mix analyze': {
45
+ args: `${definition} ${mixUsage} ${params}`,
46
+ options: [
47
+ 'params',
48
+ 'audio-rate',
49
+ 'audio-channels',
50
+ 'audio-bitrate',
51
+ ...mixOptions,
52
+ ...Object.keys(processingOptionTypes),
53
+ ],
54
+ },
38
55
  package: {
39
56
  args: `${definition} --output <new-directory> [--root <directory>] [--resource <path> ...] ${params}`,
40
57
  options: ['output', 'root', 'resource', 'params'],
@@ -65,10 +82,12 @@ const commands = {
65
82
  options: ['frame', 'timestamp', 'quality', 'params'],
66
83
  },
67
84
  render: {
68
- args: `${definition} --output <new.mp4> ${qualityOption} ${params}`,
85
+ args: `${definition} --output <new.mp4> [--picture-cache <directory>] ${qualityOption} ${mixUsage} ${params}`,
69
86
  options: [
70
87
  'output',
71
88
  'params',
89
+ 'picture-cache',
90
+ ...mixOptions,
72
91
  ...Object.keys(renderOptionTypes),
73
92
  ...Object.keys(processingOptionTypes),
74
93
  ],
@@ -88,8 +107,8 @@ const commands = {
88
107
  ],
89
108
  },
90
109
  preview: {
91
- args: `${definition} --watch [--size <64..1920>] ${qualityOption}`,
92
- options: ['watch', 'size', ...previewOptions],
110
+ args: `${definition} --watch [--size <64..1920>] ${qualityOption} ${mixUsage}`,
111
+ options: ['watch', 'size', ...previewOptions, ...mixOptions],
93
112
  },
94
113
  'preview frame': {
95
114
  args: `${definition} ${position} --output <new.png> [--size <64..1920>] ${qualityOption} ${params}`,
@@ -103,8 +122,16 @@ const commands = {
103
122
  ],
104
123
  },
105
124
  'preview clip': {
106
- args: `${definition} --from <n> --to <n> --output <new.mp4> [--size <64..1920>] ${qualityOption} ${params}`,
107
- options: ['from', 'to', 'output', 'size', 'params', ...previewOptions],
125
+ args: `${definition} --from <n> --to <n> --output <new.mp4> [--size <64..1920>] ${qualityOption} ${mixUsage} ${params}`,
126
+ options: [
127
+ 'from',
128
+ 'to',
129
+ 'output',
130
+ 'size',
131
+ 'params',
132
+ ...previewOptions,
133
+ ...mixOptions,
134
+ ],
108
135
  },
109
136
  'preview contact-sheet': {
110
137
  args: `${definition} --output <new.png> [--from <n>] [--to <n>] [--count <1..16>] [--columns <1..16>] [--size <64..640>] ${qualityOption} ${params}`,
package/dist/index.js CHANGED
@@ -28,6 +28,7 @@ async function run(args) {
28
28
  case 'recipes validate':
29
29
  case 'validate':
30
30
  case 'inspect':
31
+ case 'mix analyze':
31
32
  case 'render': {
32
33
  const { runVideoCommand } = await import('./video.js');
33
34
  return runVideoCommand(command, file, values);
@@ -5,6 +5,7 @@ import { commandUsage } from './commands.js';
5
5
  import { UsageError } from './usage.js';
6
6
  import { withCommandCancellation } from './cancellation.js';
7
7
  import { readParams } from './json-argument.js';
8
+ import { readMixControls } from './mix-options.js';
8
9
  import { loadVideo } from './video.js';
9
10
  function printWatchStatus({ current, ...event }, json) {
10
11
  if (json) {
@@ -46,6 +47,7 @@ export async function runInspectionCommand(command, file, values) {
46
47
  throw new UsageError('--size must be between 64 and 1920.');
47
48
  return withCommandCancellation(async (signal) => {
48
49
  const watcher = await watchVideo(file, {
50
+ ...(await readMixControls(values, signal)),
49
51
  maxDimension,
50
52
  quality,
51
53
  processing,
@@ -104,7 +106,9 @@ export async function runInspectionCommand(command, file, values) {
104
106
  : undefined;
105
107
  const requestedTo = command === 'preview clip' ? integer('to') : undefined;
106
108
  await withCommandCancellation(async (signal) => {
109
+ const { audioMixEdit, ...mixControls } = await readMixControls(values, signal);
107
110
  const video = await loadVideo(file, {
111
+ audioMixEdit,
108
112
  signal,
109
113
  preview: true,
110
114
  quality,
@@ -131,6 +135,7 @@ export async function runInspectionCommand(command, file, values) {
131
135
  })
132
136
  : await tools.clip({ startFrame, endFrame }, values.output, {
133
137
  ...options,
138
+ ...mixControls,
134
139
  onProgress: (progress) => process.stderr.write(values.json
135
140
  ? `${JSON.stringify(progress)}\n`
136
141
  : `${progress.phase}: ${progress.percent.toFixed(1)}%\n`),
@@ -0,0 +1,59 @@
1
+ import type { CommandOptions } from './commands.js';
2
+ export declare function readMixControls(values: CommandOptions, signal: AbortSignal): Promise<{
3
+ audioMixEdit: {
4
+ mix: {
5
+ preset: "natural-cinematic" | "clear-voiceover";
6
+ enabled?: boolean | undefined;
7
+ cleanup?: number | undefined;
8
+ warmth?: number | undefined;
9
+ clarity?: number | undefined;
10
+ consistency?: number | undefined;
11
+ dialogueLufs?: number | undefined;
12
+ highPassHz?: number | undefined;
13
+ eq?: {
14
+ frequency: number;
15
+ q: number;
16
+ db: number;
17
+ }[] | undefined;
18
+ deEsser?: number | undefined;
19
+ compressor?: {
20
+ thresholdDb: number;
21
+ ratio: number;
22
+ attackMs: number;
23
+ releaseMs: number;
24
+ } | undefined;
25
+ ai?: "deepfilternet" | undefined;
26
+ dereverb?: number | undefined;
27
+ matching?: {
28
+ amount: number;
29
+ referenceClip?: string | undefined;
30
+ } | undefined;
31
+ crossfadeMs?: number | undefined;
32
+ ducking?: {
33
+ depthDb?: number | undefined;
34
+ attackMs?: number | undefined;
35
+ holdMs?: number | undefined;
36
+ releaseMs?: number | undefined;
37
+ } | undefined;
38
+ delivery?: {
39
+ preset: "web" | "broadcast" | "film";
40
+ integratedLufs?: number | undefined;
41
+ truePeakDbtp?: number | undefined;
42
+ loudnessRange?: number | undefined;
43
+ } | undefined;
44
+ automation?: {
45
+ dialogue?: Record<string, {
46
+ sample: number;
47
+ db: number;
48
+ }[]> | undefined;
49
+ music?: {
50
+ sample: number;
51
+ db: number;
52
+ }[] | undefined;
53
+ } | undefined;
54
+ } | null;
55
+ roles?: Record<string, "dialogue" | "music" | "other"> | undefined;
56
+ } | undefined;
57
+ audioComparison: "before" | "after" | undefined;
58
+ audioMixCacheDirectory: string | undefined;
59
+ }>;
@@ -0,0 +1,23 @@
1
+ import { videoMixEditSchema } from '@opencut/core/video';
2
+ import { readJsonArgument } from './json-argument.js';
3
+ import { UsageError } from './usage.js';
4
+ export async function readMixControls(values, signal) {
5
+ const comparison = values['mix-comparison'];
6
+ if (comparison !== undefined &&
7
+ comparison !== 'before' &&
8
+ comparison !== 'after')
9
+ throw new UsageError('--mix-comparison must be before or after.');
10
+ const audioMixCacheDirectory = values['mix-cache'];
11
+ if (audioMixCacheDirectory !== undefined && !audioMixCacheDirectory.trim())
12
+ throw new UsageError('--mix-cache requires a directory.');
13
+ const path = values['mix-settings'];
14
+ const audioMixEdit = path === undefined
15
+ ? undefined
16
+ : videoMixEditSchema.parse(await readJsonArgument('mix-settings', path, signal));
17
+ return {
18
+ audioMixEdit,
19
+ audioComparison: comparison,
20
+ audioMixCacheDirectory,
21
+ };
22
+ }
23
+ //# sourceMappingURL=mix-options.js.map
package/dist/system-probe CHANGED
Binary file
package/dist/video.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { compileVideo } from '@opencut/core/video';
2
2
  import { type CommandOptions } from './commands.js';
3
- type VideoCommand = 'validate' | 'inspect' | 'render' | 'recipes inspect' | 'recipes validate';
3
+ type VideoCommand = 'validate' | 'inspect' | 'render' | 'mix analyze' | 'recipes inspect' | 'recipes validate';
4
4
  /** Route console output from trusted TypeScript to stderr during CLI compilation. */
5
5
  export declare function loadVideo(file: string, options: Parameters<typeof compileVideo>[1]): Promise<import("@opencut/core/video").CompiledVideo>;
6
6
  export declare function withDefinitionConsole<T>(run: () => Promise<T>): Promise<T>;
package/dist/video.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import { Console } from 'node:console';
2
- import { compileVideo, inspectProject, inspectVideoRecipes, isVideoDefinitionPath, renderCompiledVideo, } from '@opencut/core/video';
2
+ import { analyzeVideoMix, compileVideo, inspectProject, inspectVideoRecipes, isVideoDefinitionPath, renderCompiledVideo, } from '@opencut/core/video';
3
3
  import { withCommandCancellation } from './cancellation.js';
4
4
  import { commandUsage } from './commands.js';
5
5
  import { parseProcessingControls } from './recipe-options.js';
6
6
  import { UsageError } from './usage.js';
7
7
  import { readParams } from './json-argument.js';
8
8
  import { parseRenderControls, parseRenderQuality } from './render-options.js';
9
+ import { readMixControls } from './mix-options.js';
9
10
  /** Route console output from trusted TypeScript to stderr during CLI compilation. */
10
11
  export function loadVideo(file, options) {
11
12
  return withDefinitionConsole(() => compileVideo(file, options));
@@ -26,7 +27,12 @@ export async function runVideoCommand(command, file, values) {
26
27
  const { output } = values;
27
28
  if (command === 'render' && !output?.toLowerCase().endsWith('.mp4'))
28
29
  throw new UsageError(`Usage: ${commandUsage(command)}`);
29
- const controls = command === 'render' ? parseRenderControls(values) : {};
30
+ const pictureCacheDirectory = values['picture-cache'];
31
+ if (pictureCacheDirectory !== undefined && !pictureCacheDirectory.trim())
32
+ throw new UsageError('--picture-cache requires a directory.');
33
+ const controls = command === 'render' || command === 'mix analyze'
34
+ ? parseRenderControls(values)
35
+ : {};
30
36
  await withCommandCancellation(async (signal) => {
31
37
  const params = await readParams(values.params, signal);
32
38
  if (command === 'recipes inspect' || command === 'recipes validate') {
@@ -55,14 +61,24 @@ export async function runVideoCommand(command, file, values) {
55
61
  process.stderr.write(`recipe ${event.assetId} step ${event.step + 1}: ${event.status}${time}\n`);
56
62
  }
57
63
  };
64
+ const { audioMixEdit, ...mixControls } = await readMixControls(values, signal);
58
65
  const video = await loadVideo(file, {
59
66
  signal,
60
67
  params,
61
68
  preview: controls.burnSubtitles === false,
62
69
  quality: controls.quality,
63
70
  processing,
71
+ audioMixEdit,
64
72
  });
65
- if (command === 'validate') {
73
+ if (command === 'mix analyze') {
74
+ const report = await analyzeVideoMix(video, {
75
+ ...controls,
76
+ ...mixControls,
77
+ signal,
78
+ });
79
+ console.log(JSON.stringify(report, null, 2));
80
+ }
81
+ else if (command === 'validate') {
66
82
  const result = {
67
83
  ok: true,
68
84
  path: video.path,
@@ -81,6 +97,8 @@ export async function runVideoCommand(command, file, values) {
81
97
  else {
82
98
  const result = await renderCompiledVideo(video, output, {
83
99
  ...controls,
100
+ pictureCacheDirectory,
101
+ ...mixControls,
84
102
  signal,
85
103
  ...(!values.json && {
86
104
  onProgress: (event) => {
@@ -97,6 +115,13 @@ export async function runVideoCommand(command, file, values) {
97
115
  else {
98
116
  for (const warning of result.warnings ?? [])
99
117
  process.stderr.write(`Warning: ${warning}\n`);
118
+ for (const { startFrame, endFrame, status } of result.pictureRanges ??
119
+ [])
120
+ console.log(`Picture [${startFrame}, ${endFrame}): ${status}`);
121
+ if (result.audioMix) {
122
+ const { integratedLufs, truePeakDbtp } = result.audioMix.output;
123
+ console.log(`Audio ${integratedLufs ?? 'unmeasurable'} LUFS / ${truePeakDbtp ?? 'unmeasurable'} dBTP`);
124
+ }
100
125
  console.log(`Saved ${result.frameCount} frames to ${result.path}`);
101
126
  }
102
127
  }
@@ -0,0 +1,132 @@
1
+ # Professional Dialogue Mix
2
+
3
+ Enable the mixer by adding `professionalMix` to a `.video.ts` definition. Assign `audioRole: 'dialogue'` to spoken tracks and `audioRole: 'music'` to music tracks. Audio and video tracks both support roles. Unassigned tracks and tracks marked `other` retain their original mix routing. Authored mute, gain, fades, effects and playback speed still apply.
4
+
5
+ **Natural Cinematic Dialogue** uses lighter cleanup and dynamics processing suitable for interviews and narrative work. **Clear Professional Voiceover** uses stronger cleanup, presence, consistency and music ducking.
6
+
7
+ In OpenCut Review, select **Create dialogue mix** to choose dialogue recordings,
8
+ optional music and an optional picture. The import writes a new definition
9
+ that references your original files. Open **Professional Dialogue Mix** to
10
+ adjust routing and settings, then select **Apply to preview**.
11
+
12
+ **Compare before** targets the last applied mix’s measured loudness when
13
+ playing the original mix and honors the delivery true-peak ceiling.
14
+ **Compare after** returns to the applied mix. Both preserve your draft edits. **Export MP4** renders the
15
+ applied mix even while **Compare before** is playing.
16
+
17
+ Switch off **Enable mix** and apply to bypass processing. **Reset to definition**
18
+ restores the settings from the authored file. **Save mix settings** writes the
19
+ current draft to JSON. Use **Load mix settings** followed by **Apply to preview**
20
+ to use it in OpenCut Review, or pass the JSON to the CLI or SDK.
21
+
22
+ ## Definition
23
+
24
+ ```ts
25
+ import { defineVideo } from '@dantea/opencut/sdk';
26
+
27
+ export default defineVideo({
28
+ canvas: { width: 1920, height: 1080, frameRate: 30, durationFrames: 300 },
29
+ assets: {
30
+ spoken: { path: 'voice.wav', kind: 'audio' },
31
+ score: { path: 'music.flac', kind: 'audio' },
32
+ },
33
+ tracks: [
34
+ {
35
+ id: 'speech',
36
+ type: 'audio',
37
+ audioRole: 'dialogue',
38
+ clips: [{ id: 'voice-take', asset: 'spoken', at: 30, sourceOut: 210 }],
39
+ },
40
+ {
41
+ id: 'music',
42
+ type: 'audio',
43
+ audioRole: 'music',
44
+ volume: 0.5,
45
+ clips: [{ asset: 'score', at: 0, sourceOut: 300 }],
46
+ },
47
+ ],
48
+ professionalMix: {
49
+ preset: 'natural-cinematic',
50
+ cleanup: 0.45,
51
+ clarity: 0.35,
52
+ ducking: { depthDb: 12, attackMs: 180, holdMs: 300, releaseMs: 700 },
53
+ delivery: { preset: 'broadcast' },
54
+ },
55
+ });
56
+ ```
57
+
58
+ ## Advanced settings
59
+
60
+ | Field | Behavior |
61
+ | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
62
+ | `preset`, `enabled` | Choose `natural-cinematic` or `clear-voiceover`. Use `enabled: false` to bypass the mixer and delivery processing. |
63
+ | `cleanup`, `warmth`, `clarity`, `consistency` | Intensities from 0 to 1. Cleanup adapts spectral reduction to estimated floor and applies gentle downward expansion. The leveling intensity scales gain corrections in detected phrases. |
64
+ | `highPassHz`, `eq`, `deEsser` | High-pass cutoff in Hz (0–250, 0 disables it), up to eight parametric EQ bands (`frequency`, `q`, `db`), and de-essing intensity (0–1). |
65
+ | `compressor` | Set `thresholdDb`, `ratio`, `attackMs`, `releaseMs`. A ratio of 1 bypasses compression. Limiting and delivery headroom remain active. |
66
+ | `dialogueLufs`, `matching` | Set the internal phrase target or let the preset choose. `matching.amount` (0–1) scales tonal matching. Set `matching.referenceClip` to the ID of an audible dialogue clip to use its tone and inform the default leveling target. |
67
+ | `crossfadeMs` | Range 0–250 ms. Adjacent same-track dialogue clips use available source handles for equal-power overlap. OpenCut keeps the incoming dialogue in sync with its picture. When handles are unavailable it uses short edge fades. Authored fades take precedence. |
68
+ | `ducking` | `depthDb` (0–36), `attackMs` (20–2000), `holdMs` (0–5000) and `releaseMs` (50–5000). The music bus starts fading ahead of detected speech and stays down through short pauses. |
69
+ | `ai`, `dereverb` | `ai: 'deepfilternet'` selects local speech enhancement in place of spectral noise reduction. `dereverb` (0–1) attenuates low-level tails and can reduce light room sound. Strong reflections overlapping speech may remain. |
70
+ | `delivery` | Choose a delivery preset and optionally override `integratedLufs` (−40 to −8), `truePeakDbtp` (−8 to −0.1) and `loudnessRange` (1–50 LU). |
71
+ | `automation` | Save or edit the generated `dialogue` and `music` curves. |
72
+
73
+ Detection uses short K-weighted energy windows on tracks assigned to dialogue.
74
+ A brief phrase that rises clearly above steady room tone can trigger ducking
75
+ even when most of the clip is quiet. Overlapping speech from multiple dialogue
76
+ tracks contributes to the shared music curve. For whispers or other sounds near
77
+ the estimated noise floor, fine-tune the generated curves or author them directly.
78
+
79
+ The mixer reports `automation.dialogue` by clip ID and `automation.music` for the
80
+ whole music bus. Each point is `{ sample, db }` on a 48 kHz clock. Dialogue
81
+ samples are relative to the clip’s authored timeline start. Music samples are
82
+ relative to the start of the project. Keys interpolate in dB and hold the
83
+ closest value outside the key range. Supply a curve to replace automatic
84
+ analysis for that clip or bus. Supply `[]` to disable that curve. Omit the entry
85
+ to regenerate it. The mixer combines these curves with the original fades and
86
+ gain keys.
87
+
88
+ To reuse the generated curves, copy the report’s `automation` object into
89
+ `professionalMix.automation` in the definition or `mix.automation` in a mix
90
+ settings file. In OpenCut Review, select **Use analyzed curves** under
91
+ **Advanced settings and automation** to copy the curves into the draft.
92
+
93
+ ## Delivery and inspection
94
+
95
+ | Delivery | Integrated target | True-peak ceiling | Loudness range target |
96
+ | --------- | ----------------: | ----------------: | --------------------: |
97
+ | Web | −16 LUFS | −1.5 dBTP | 12 LU |
98
+ | Broadcast | −23 LUFS | −1 dBTP | 15 LU |
99
+ | Film | −24 LUFS | −2 dBTP | 20 LU |
100
+
101
+ OpenCut measures integrated loudness, loudness range and true peak, applies gain or second-pass dynamic normalization as needed, then checks true peak on decoded AAC. The render report contains the measured input and output, targets, normalization mode and any loudness deviations. Very short or silent mixes may lack a measurable integrated value. The peak ceiling takes precedence when the configured goals compete. Composition and delivery use the same full timeline in preview and export. A range preview trims the normalized audio to the requested interval. AAC output supports mono or stereo, 44.1 or 48 kHz, using FFmpeg’s normal channel conversion for other input layouts.
102
+
103
+ ```sh
104
+ opencut mix analyze lesson.video.ts --json
105
+ opencut render lesson.video.ts --output lesson.mp4 --json
106
+ opencut render lesson.video.ts --output comparison.mp4 --mix-comparison before
107
+ opencut preview clip lesson.video.ts --from 30 --to 150 --output preview.mp4
108
+ opencut render lesson.video.ts --output revision.mp4 --mix-settings mix.json
109
+ ```
110
+
111
+ `mix analyze` reports the same data as `render --json` without composing or encoding picture. `--mix-settings` accepts `{ "mix": { "preset": "natural-cinematic" }, "roles": { "speech": "dialogue" } }`. Set `mix` to `null` to render through the standard audio path. The settings file does not change the source definition. `--mix-comparison before` produces the loudness-matched original mix. The same controls apply to `preview --watch` and `preview clip`.
112
+
113
+ ```ts
114
+ import {
115
+ analyzeVideoMix,
116
+ compileVideo,
117
+ renderCompiledVideo,
118
+ } from '@dantea/opencut/sdk';
119
+
120
+ const video = await compileVideo('lesson.video.ts');
121
+ const report = await analyzeVideoMix(video);
122
+ const rendered = await renderCompiledVideo(video, 'lesson.mp4');
123
+ console.log(report.automation, rendered.audioMix?.output);
124
+ ```
125
+
126
+ Pass `audioMixEdit` to `compileVideo` or `renderVideo` for the same JSON override. Set `audioComparison: 'before'` on analysis, render or clip preview for A/B playback.
127
+
128
+ ## Local enhancement and caching
129
+
130
+ The two presets require only OpenCut’s existing FFmpeg installation. To enable [DeepFilterNet](https://github.com/Rikorose/DeepFilterNet), install its native `deep-filter` executable separately. OpenCut uses it on local 48 kHz audio with compensation for its model delay. The executable can be on PATH or set via the absolute `OPENCUT_DEEPFILTER` path. Set `OPENCUT_DEEPFILTER_MODEL` to use a compatible local model archive when the executable lacks a built-in model or when choosing a different one. The mixer runs without network access. An explicitly selected backend that cannot run produces an error so the same settings do not silently render with a different backend.
131
+
132
+ OpenCut reuses analyzed clip profiles within a process. For persistent AI-enhanced stems, pass `--mix-cache <directory>` to CLI commands or `audioMixCacheDirectory` to SDK analysis, render and video preview. Desktop previews reuse enhanced stems during an open review session. Cached stems contain processed audio. Keep the cache private when working with private recordings and remove it when it is no longer needed.
package/docs/CLI.md CHANGED
@@ -17,8 +17,40 @@ opencut subtitles export edit.video.ts --output captions.srt
17
17
 
18
18
  Use `opencut render --help` for quality, resolution, codec, frame rate and
19
19
  audio settings. Outputs are new files unless a supported render explicitly
20
- requests `--overwrite`. Use `--json` for machine output and SIGINT or SIGTERM
21
- to cancel foreground work. Render runs in the CLI with FFmpeg subprocesses.
20
+ requests `--overwrite`. OpenCut protects source files and their aliases,
21
+ including when picture is cached. Use `--json` for machine output and SIGINT
22
+ or SIGTERM to cancel foreground work. Render runs in the CLI with FFmpeg
23
+ subprocesses.
24
+
25
+ ## Reuse picture between exports
26
+
27
+ ```sh
28
+ opencut render edit.video.ts --picture-cache ./render-cache -o first.mp4
29
+ # Edit the definition, then pass the same cache directory.
30
+ opencut render edit.video.ts --picture-cache ./render-cache -o revision.mp4
31
+ ```
32
+
33
+ The picture cache uses the FFV1 encoder in FFmpeg to store lossless composited
34
+ picture on the project frame grid. Shots, overlays, subtitles and transitions
35
+ set the range boundaries. A range can move to a different timeline frame and
36
+ reuse its picture if its source samples and visual layers stay the same.
37
+ Edits to visual sources, framing, grades, captions and transitions rebuild
38
+ the ranges they affect. Edits to audio tracks and mix settings reuse
39
+ unchanged picture. Each export mixes audio on the current timeline and
40
+ encodes a new MP4 at the requested output frame rate. The [recipe cache](#media-recipes)
41
+ stores upstream processing such as frame interpolation.
42
+
43
+ Render prints `Picture [start, end): reused` or `rendered` for each range.
44
+ With `--json`, `pictureRanges` contains `startFrame`, `endFrame` and `status`.
45
+ Ranges use zero-based project frames with an exclusive end, even when the
46
+ output frame rate differs.
47
+
48
+ Use a private local cache directory with room for lossless video. Cache files
49
+ are kept under `picture-v1` until removed. Stop active renders before clearing
50
+ the cache. The first render can take longer while it populates the cache.
51
+ For eligible MP4 and MOV footage, cache misses can seek into the source.
52
+ OpenCut falls back to sequential decoding when a seek cannot preserve frame
53
+ selection.
22
54
 
23
55
  ## Check the installation
24
56
 
@@ -114,8 +146,9 @@ recipes.
114
146
 
115
147
  Processing limits apply to fresh recipe work. Cached media and composition
116
148
  outputs have their own disk usage. Matching inputs, effective AI profiles,
117
- algorithm settings, and backend versions reuse completed entries. A backend version change rebuilds affected
118
- steps and their dependents on the next run. Older entries stay on disk until
149
+ algorithm settings, and backend fingerprints reuse completed entries. A change
150
+ to the worker, encoder settings or system version can rebuild affected steps
151
+ and their dependents on the next run. Older entries stay on disk until
119
152
  removed. Stop active builds before clearing the cache directory.
120
153
 
121
154
  Foreground rendering reports step starts, media time, completions, and cache
@@ -217,8 +250,9 @@ Caches, native models, system frameworks and third-party Node packages
217
250
  are not copied. Choose a compatible OpenCut build and FFmpeg
218
251
  installation. VideoToolbox recipes still require supported Apple Silicon
219
252
  hardware and macOS; Apple does not expose a separate model version, so
220
- results can vary with the OS. OpenCut requires the recorded backend
221
- version and does not substitute another algorithm.
253
+ results can vary with the OS. The recorded backend version identifies the
254
+ required processing behavior. A compatible worker or encoder update can
255
+ invalidate cached media while preserving compatibility with existing packages.
222
256
 
223
257
  Packaging needs space for the listed payload once, plus small manifest
224
258
  and filesystem overhead. Sources shared by clips are copied once per path;
@@ -274,6 +308,8 @@ the batch budgets evenly across active slots. Recipe overrides may lower a
274
308
  slot's limits. The temporary budget covers staging for recipes and renders,
275
309
  including copied sources, layer intermediates, and the unfinished MP4.
276
310
  Published outputs and completed cache entries consume persistent disk space.
311
+ For Professional Dialogue Mix, DeepFilterNet counts toward the slot’s native RSS
312
+ budget, and the temporary file-size limit applies while it writes its staged WAV.
277
313
  OpenCut samples native child-process RSS with its bundled, unprivileged
278
314
  sampler on macOS and with `/bin/ps` on Linux. It also caps FFmpeg
279
315
  allocation sizes. If sampling fails, the render or recipe stops and
@@ -328,3 +364,7 @@ temporal comparison scores differences between consecutive pictures against
328
364
  the same differences in the reference. Review the MP4s for motion artifacts.
329
365
  Check each case's `exitCode` in `benchmark.json`. The harness records diagnostics
330
366
  for unsuccessful cases and runs the rest of the matrix.
367
+
368
+ ## Professional Dialogue Mix
369
+
370
+ Use `opencut mix analyze <definition.video.ts> --json` to obtain editable automation and measured loudness without rendering picture. `render`, `preview --watch` and `preview clip` use the mix authored in the definition. See [mix settings, overrides and comparison options](AUDIO_MIX.md#delivery-and-inspection).
package/docs/INSTALL.md CHANGED
@@ -4,7 +4,9 @@ The first distribution target is Apple Silicon with macOS 15 or later. The CLI n
4
4
 
5
5
  ## pnpm
6
6
 
7
- Install the CLI from the npm registry or run it on demand.
7
+ Install the CLI from the npm registry or run it on demand. If pnpm's global
8
+ bin directory is missing from `PATH`, run `pnpm setup` and open a new shell
9
+ before using `pnpm add -g`.
8
10
 
9
11
  ```sh
10
12
  pnpm add -g @dantea/opencut
@@ -15,7 +17,7 @@ pnpm dlx @dantea/opencut --help
15
17
  You can also install the packed archive directly.
16
18
 
17
19
  ```sh
18
- pnpm add -g ./opencut-cli-0.1.0-macos-arm64.tgz
20
+ pnpm add -g ./opencut-cli-0.2.0-macos-arm64.tgz
19
21
  ```
20
22
 
21
23
  Run the CLI from any directory. A definition can import `@opencut/sdk` and
@@ -25,8 +27,8 @@ reports the import error. Repair or reinstall the project's SDK. Third-party
25
27
  imports resolve from the definition's project as usual.
26
28
 
27
29
  For editor type checking or SDK use from a separate Node program, install
28
- `@dantea/opencut` locally and import from `@dantea/opencut/sdk`. Use ESM and
29
- TypeScript syntax supported by Node's type stripping.
30
+ locally with `pnpm add @dantea/opencut` and import from `@dantea/opencut/sdk`.
31
+ Use ESM and TypeScript syntax supported by Node's type stripping.
30
32
 
31
33
  The package includes the official [Agent Skill](../skills/video-editor/SKILL.md),
32
34
  its references, the CLI and SDK guides, and the authoring examples. In a
@@ -109,9 +111,12 @@ add Apple-issued timestamps and a stapled ticket to the distribution app.
109
111
  Before cutting a release, synchronize the version in the root and workspace
110
112
  package manifests. Run the manually dispatched [release workflow](https://github.com/dante-teo/opencut/actions/workflows/release.yml)
111
113
  on the matching `vMAJOR.MINOR.PATCH` tag with `publish` off to generate
112
- test artifacts. The workflow tests the CLI archive in isolated npm installs,
113
- a temporary Homebrew tap and an unpacked review app. A Homebrew upgrade
114
- test uses the same archive under a simulated older keg version for the first release.
114
+ test artifacts. The workflow tests the CLI with pnpm, a temporary Homebrew
115
+ tap and an unpacked review app. The pnpm smoke test installs the tarball
116
+ offline, then serves the same archive from a local test registry to exercise
117
+ global install, `pnpm dlx`, local SDK import and uninstall. A Homebrew
118
+ upgrade test uses the same archive under a simulated older keg version for
119
+ the first release.
115
120
  The two CLI installation checks render the bundled opening card and run the
116
121
  installed-runtime workflow suite with Python 3.11+, FFmpeg and ffprobe.
117
122
  Software rendering, Lanczos upscaling, and failure handling run on every host.
@@ -126,7 +131,7 @@ work="$(mktemp -d)"
126
131
  bash scripts/release/test-workflows.sh "$(command -v opencut)" "$work/project"
127
132
  ```
128
133
 
129
- To keep results from a local npm or Homebrew installation check, set
134
+ To keep results from a local pnpm or Homebrew installation check, set
130
135
  `OPENCUT_RELEASE_EVALUATION_DIR` to the absolute path of a new directory
131
136
  outside the checkout before running the check.
132
137
 
package/docs/SDK.md CHANGED
@@ -4,7 +4,7 @@ The installed CLI and review app include the authoring SDK. A `.video.ts`
4
4
  definition can import `@opencut/sdk` without setting up a Node project.
5
5
  For TypeScript editor support or SDK usage from a separate Node program,
6
6
  install `@dantea/opencut` locally and use the `@dantea/opencut/sdk` export in the
7
- examples below. See the [installation guide](INSTALL.md#npm).
7
+ examples below. See the [installation guide](INSTALL.md#pnpm).
8
8
 
9
9
  Use Node 24.12+ (within 24.x). The CLI resolves bundled SDK imports from
10
10
  trusted `.video.ts` definitions, which should default-export
@@ -28,10 +28,17 @@ await renderCompiledVideo(video, 'delivery.mp4', {
28
28
  ```
29
29
 
30
30
  Use `renderVideo(file, output, options)` to compile and render in one call.
31
- A compiled render checks the identity of each source it uses before copying
32
- it for the render. If a source has changed, compile the definition again.
31
+ A compiled render checks source identities before decoding or reusing
32
+ picture. It copies media on first decode. If a source has changed, compile
33
+ the definition again.
33
34
  Pass an `AbortSignal` to cancel a foreground render.
34
35
 
36
+ Pass the same `pictureCacheDirectory` to `renderVideo` or
37
+ `renderCompiledVideo` on the initial export and revisions. The result
38
+ includes `pictureRanges` with zero-based project frames in `startFrame`
39
+ and `endFrame` (exclusive) and a `status` of `reused` or `rendered`.
40
+ See [picture cache behavior and storage](CLI.md#reuse-picture-between-exports).
41
+
35
42
  Final renders default to `quality`. Preview frames, clips, contact sheets
36
43
  and watches default to `fast`. Pass `quality: 'fast' | 'quality' | 'maximum'`
37
44
  to set the profile. You can choose the same profile when calling
@@ -200,3 +207,7 @@ to stop on a variant failure. An exception from `onProgress` cancels the batch
200
207
  and rejects the call after cleanup. Invalid manifests and duplicate output
201
208
  paths reject before the scheduler starts. See the [batch limits and file
202
209
  contract](CLI.md#batch-rendering).
210
+
211
+ ## Professional Dialogue Mix
212
+
213
+ Call `analyzeVideoMix(compiledVideo, options)` to generate dialogue and music curves and verify delivery loudness without rendering picture. Mix-enabled export and clip preview results include `audioMix`. See [definition and SDK examples](AUDIO_MIX.md).