@dantea/opencut 0.1.3 → 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 (76) hide show
  1. package/dist/commands.d.ts +8 -1
  2. package/dist/commands.js +30 -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 +21 -3
  10. package/docs/AUDIO_MIX.md +132 -0
  11. package/docs/CLI.md +6 -0
  12. package/docs/INSTALL.md +1 -1
  13. package/docs/SDK.md +4 -0
  14. package/docs/VIDEO_DEFINITIONS.md +4 -0
  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 +4 -1
  23. package/node_modules/@opencut/core/dist/render-plan.js +6 -0
  24. package/node_modules/@opencut/core/dist/render-sources.d.ts +3 -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-compiler.d.ts +3 -0
  29. package/node_modules/@opencut/core/dist/video-compiler.js +20 -1
  30. package/node_modules/@opencut/core/dist/video-definition.d.ts +121 -0
  31. package/node_modules/@opencut/core/dist/video-definition.js +6 -1
  32. package/node_modules/@opencut/core/dist/video-files.d.ts +55 -0
  33. package/node_modules/@opencut/core/dist/video-package-format.d.ts +53 -0
  34. package/node_modules/@opencut/core/dist/video-preview.d.ts +56 -1
  35. package/node_modules/@opencut/core/dist/video-preview.js +7 -2
  36. package/node_modules/@opencut/core/dist/video-render.d.ts +11 -4
  37. package/node_modules/@opencut/core/dist/video-render.js +16 -3
  38. package/node_modules/@opencut/core/dist/video-watch.d.ts +5 -0
  39. package/node_modules/@opencut/core/dist/video-watch.js +18 -2
  40. package/node_modules/@opencut/core/dist/video.d.ts +5 -0
  41. package/node_modules/@opencut/core/dist/video.js +2 -0
  42. package/node_modules/@opencut/core/package.json +3 -3
  43. package/node_modules/@opencut/media/dist/audio-graph.d.ts +88 -0
  44. package/node_modules/@opencut/media/dist/audio-graph.js +292 -0
  45. package/node_modules/@opencut/media/dist/audio-mastering.d.ts +29 -0
  46. package/node_modules/@opencut/media/dist/audio-mastering.js +205 -0
  47. package/node_modules/@opencut/media/dist/deepfilter.d.ts +4 -0
  48. package/node_modules/@opencut/media/dist/deepfilter.js +76 -0
  49. package/node_modules/@opencut/media/dist/dialogue-analysis.d.ts +32 -0
  50. package/node_modules/@opencut/media/dist/dialogue-analysis.js +214 -0
  51. package/node_modules/@opencut/media/dist/index.d.ts +3 -1
  52. package/node_modules/@opencut/media/dist/index.js +1 -1
  53. package/node_modules/@opencut/media/dist/process-memory +0 -0
  54. package/node_modules/@opencut/media/dist/process.d.ts +2 -1
  55. package/node_modules/@opencut/media/dist/process.js +13 -4
  56. package/node_modules/@opencut/media/dist/professional-mix.d.ts +34 -0
  57. package/node_modules/@opencut/media/dist/professional-mix.js +411 -0
  58. package/node_modules/@opencut/media/dist/render-budget.d.ts +1 -1
  59. package/node_modules/@opencut/media/dist/render-budget.js +7 -5
  60. package/node_modules/@opencut/media/dist/render.d.ts +28 -46
  61. package/node_modules/@opencut/media/dist/render.js +78 -224
  62. package/node_modules/@opencut/media/dist/video-enhance +0 -0
  63. package/node_modules/@opencut/media/dist/video-interpolate +0 -0
  64. package/node_modules/@opencut/media/package.json +2 -2
  65. package/node_modules/@opencut/sdk/dist/index.d.ts +2 -2
  66. package/node_modules/@opencut/sdk/dist/index.js +1 -1
  67. package/node_modules/@opencut/sdk/package.json +3 -3
  68. package/node_modules/@opencut/shared/dist/index.d.ts +1 -0
  69. package/node_modules/@opencut/shared/dist/index.js +1 -0
  70. package/node_modules/@opencut/shared/dist/professional-mix.d.ts +98 -0
  71. package/node_modules/@opencut/shared/dist/professional-mix.js +30 -0
  72. package/node_modules/@opencut/shared/package.json +1 -1
  73. package/package.json +5 -5
  74. package/skills/video-editor/SKILL.md +6 -0
  75. package/skills/video-editor/references/cli.md +7 -0
  76. package/skills/video-editor/references/sdk.md +4 -0
@@ -121,6 +121,11 @@ export declare const videoDefinitionSchema: z.ZodObject<{
121
121
  tracks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
122
122
  volume: z.ZodOptional<z.ZodNumber>;
123
123
  muted: z.ZodOptional<z.ZodBoolean>;
124
+ audioRole: z.ZodOptional<z.ZodEnum<{
125
+ dialogue: "dialogue";
126
+ music: "music";
127
+ other: "other";
128
+ }>>;
124
129
  id: z.ZodOptional<z.ZodString>;
125
130
  name: z.ZodOptional<z.ZodString>;
126
131
  type: z.ZodLiteral<"video">;
@@ -495,6 +500,11 @@ export declare const videoDefinitionSchema: z.ZodObject<{
495
500
  }, z.core.$strict>, z.ZodObject<{
496
501
  volume: z.ZodOptional<z.ZodNumber>;
497
502
  muted: z.ZodOptional<z.ZodBoolean>;
503
+ audioRole: z.ZodOptional<z.ZodEnum<{
504
+ dialogue: "dialogue";
505
+ music: "music";
506
+ other: "other";
507
+ }>>;
498
508
  id: z.ZodOptional<z.ZodString>;
499
509
  name: z.ZodOptional<z.ZodString>;
500
510
  type: z.ZodLiteral<"audio">;
@@ -1139,6 +1149,64 @@ export declare const videoDefinitionSchema: z.ZodObject<{
1139
1149
  frame: z.ZodInt;
1140
1150
  name: z.ZodString;
1141
1151
  }, z.core.$strict>>>;
1152
+ professionalMix: z.ZodOptional<z.ZodObject<{
1153
+ preset: z.ZodEnum<{
1154
+ "natural-cinematic": "natural-cinematic";
1155
+ "clear-voiceover": "clear-voiceover";
1156
+ }>;
1157
+ enabled: z.ZodOptional<z.ZodBoolean>;
1158
+ cleanup: z.ZodOptional<z.ZodNumber>;
1159
+ warmth: z.ZodOptional<z.ZodNumber>;
1160
+ clarity: z.ZodOptional<z.ZodNumber>;
1161
+ consistency: z.ZodOptional<z.ZodNumber>;
1162
+ dialogueLufs: z.ZodOptional<z.ZodNumber>;
1163
+ highPassHz: z.ZodOptional<z.ZodNumber>;
1164
+ eq: z.ZodOptional<z.ZodArray<z.ZodObject<{
1165
+ frequency: z.ZodNumber;
1166
+ q: z.ZodNumber;
1167
+ db: z.ZodNumber;
1168
+ }, z.core.$strict>>>;
1169
+ deEsser: z.ZodOptional<z.ZodNumber>;
1170
+ compressor: z.ZodOptional<z.ZodObject<{
1171
+ thresholdDb: z.ZodNumber;
1172
+ ratio: z.ZodNumber;
1173
+ attackMs: z.ZodNumber;
1174
+ releaseMs: z.ZodNumber;
1175
+ }, z.core.$strict>>;
1176
+ ai: z.ZodOptional<z.ZodLiteral<"deepfilternet">>;
1177
+ dereverb: z.ZodOptional<z.ZodNumber>;
1178
+ matching: z.ZodOptional<z.ZodObject<{
1179
+ amount: z.ZodNumber;
1180
+ referenceClip: z.ZodOptional<z.ZodString>;
1181
+ }, z.core.$strict>>;
1182
+ crossfadeMs: z.ZodOptional<z.ZodNumber>;
1183
+ ducking: z.ZodOptional<z.ZodObject<{
1184
+ depthDb: z.ZodOptional<z.ZodNumber>;
1185
+ attackMs: z.ZodOptional<z.ZodNumber>;
1186
+ holdMs: z.ZodOptional<z.ZodNumber>;
1187
+ releaseMs: z.ZodOptional<z.ZodNumber>;
1188
+ }, z.core.$strict>>;
1189
+ delivery: z.ZodOptional<z.ZodObject<{
1190
+ preset: z.ZodEnum<{
1191
+ web: "web";
1192
+ broadcast: "broadcast";
1193
+ film: "film";
1194
+ }>;
1195
+ integratedLufs: z.ZodOptional<z.ZodNumber>;
1196
+ truePeakDbtp: z.ZodOptional<z.ZodNumber>;
1197
+ loudnessRange: z.ZodOptional<z.ZodNumber>;
1198
+ }, z.core.$strict>>;
1199
+ automation: z.ZodOptional<z.ZodObject<{
1200
+ dialogue: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
1201
+ sample: z.ZodInt;
1202
+ db: z.ZodNumber;
1203
+ }, z.core.$strict>>>>;
1204
+ music: z.ZodOptional<z.ZodArray<z.ZodObject<{
1205
+ sample: z.ZodInt;
1206
+ db: z.ZodNumber;
1207
+ }, z.core.$strict>>>;
1208
+ }, z.core.$strict>>;
1209
+ }, z.core.$strict>>;
1142
1210
  id: z.ZodOptional<z.ZodString>;
1143
1211
  name: z.ZodOptional<z.ZodString>;
1144
1212
  createdAt: z.ZodOptional<z.ZodISODateTime>;
@@ -1492,6 +1560,7 @@ export declare function parseVideoDefinition(value: unknown): {
1492
1560
  })[];
1493
1561
  volume?: number | undefined;
1494
1562
  muted?: boolean | undefined;
1563
+ audioRole?: "dialogue" | "music" | "other" | undefined;
1495
1564
  id?: string | undefined;
1496
1565
  name?: string | undefined;
1497
1566
  } | {
@@ -1638,6 +1707,7 @@ export declare function parseVideoDefinition(value: unknown): {
1638
1707
  }[];
1639
1708
  volume?: number | undefined;
1640
1709
  muted?: boolean | undefined;
1710
+ audioRole?: "dialogue" | "music" | "other" | undefined;
1641
1711
  id?: string | undefined;
1642
1712
  name?: string | undefined;
1643
1713
  } | {
@@ -2121,6 +2191,57 @@ export declare function parseVideoDefinition(value: unknown): {
2121
2191
  frame: number;
2122
2192
  name: string;
2123
2193
  }[] | undefined;
2194
+ professionalMix?: {
2195
+ preset: "natural-cinematic" | "clear-voiceover";
2196
+ enabled?: boolean | undefined;
2197
+ cleanup?: number | undefined;
2198
+ warmth?: number | undefined;
2199
+ clarity?: number | undefined;
2200
+ consistency?: number | undefined;
2201
+ dialogueLufs?: number | undefined;
2202
+ highPassHz?: number | undefined;
2203
+ eq?: {
2204
+ frequency: number;
2205
+ q: number;
2206
+ db: number;
2207
+ }[] | undefined;
2208
+ deEsser?: number | undefined;
2209
+ compressor?: {
2210
+ thresholdDb: number;
2211
+ ratio: number;
2212
+ attackMs: number;
2213
+ releaseMs: number;
2214
+ } | undefined;
2215
+ ai?: "deepfilternet" | undefined;
2216
+ dereverb?: number | undefined;
2217
+ matching?: {
2218
+ amount: number;
2219
+ referenceClip?: string | undefined;
2220
+ } | undefined;
2221
+ crossfadeMs?: number | undefined;
2222
+ ducking?: {
2223
+ depthDb?: number | undefined;
2224
+ attackMs?: number | undefined;
2225
+ holdMs?: number | undefined;
2226
+ releaseMs?: number | undefined;
2227
+ } | undefined;
2228
+ delivery?: {
2229
+ preset: "web" | "broadcast" | "film";
2230
+ integratedLufs?: number | undefined;
2231
+ truePeakDbtp?: number | undefined;
2232
+ loudnessRange?: number | undefined;
2233
+ } | undefined;
2234
+ automation?: {
2235
+ dialogue?: Record<string, {
2236
+ sample: number;
2237
+ db: number;
2238
+ }[]> | undefined;
2239
+ music?: {
2240
+ sample: number;
2241
+ db: number;
2242
+ }[] | undefined;
2243
+ } | undefined;
2244
+ } | undefined;
2124
2245
  id?: string | undefined;
2125
2246
  name?: string | undefined;
2126
2247
  createdAt?: string | undefined;
@@ -56,7 +56,11 @@ const track = trackSchema.omit({ id: true, name: true, type: true }).extend({
56
56
  id: entityIdSchema.optional(),
57
57
  name: trackSchema.shape.name.optional(),
58
58
  });
59
- const visualOnlyTrack = track.omit({ volume: true, muted: true });
59
+ const visualOnlyTrack = track.omit({
60
+ volume: true,
61
+ muted: true,
62
+ audioRole: true,
63
+ });
60
64
  const asset = assetSchema
61
65
  .pick({ name: true, freezeFrame: true, provenance: true })
62
66
  .partial()
@@ -100,6 +104,7 @@ export const videoDefinitionSchema = z.strictObject({
100
104
  subtitles: subtitles.optional(),
101
105
  transitions: z.array(transitionSchema).optional(),
102
106
  markers: z.array(markerSchema).optional(),
107
+ professionalMix: snapshotSchema.shape.professionalMix,
103
108
  });
104
109
  const parametersSchema = z.record(z.string(), z.json());
105
110
  const parameterized = Symbol('videoParameters');
@@ -1,3 +1,4 @@
1
+ import type { VideoMixEdit } from '@opencut/shared';
1
2
  import type { VideoParameters } from './video-definition.js';
2
3
  import type { CompilationOptions, CompiledVideo } from './video-compiler.js';
3
4
  import { processingSettings } from './video-processing.js';
@@ -7,6 +8,7 @@ export declare function isVideoDefinitionPath(file: string): boolean;
7
8
  export type VideoCompileOptions = Pick<CompilationOptions, 'signal' | 'preview' | 'processing' | 'quality'> & {
8
9
  /** A JSON object validated by the TypeScript definition. */
9
10
  params?: unknown;
11
+ audioMixEdit?: VideoMixEdit | undefined;
10
12
  };
11
13
  type InputOptions = CompilationOptions & VideoCompileOptions & {
12
14
  checkpoint?: boolean;
@@ -406,6 +408,7 @@ export declare function readVideoInput(file: string, options: InputOptions, reco
406
408
  })[];
407
409
  volume?: number | undefined;
408
410
  muted?: boolean | undefined;
411
+ audioRole?: "dialogue" | "music" | "other" | undefined;
409
412
  id?: string | undefined;
410
413
  name?: string | undefined;
411
414
  } | {
@@ -552,6 +555,7 @@ export declare function readVideoInput(file: string, options: InputOptions, reco
552
555
  }[];
553
556
  volume?: number | undefined;
554
557
  muted?: boolean | undefined;
558
+ audioRole?: "dialogue" | "music" | "other" | undefined;
555
559
  id?: string | undefined;
556
560
  name?: string | undefined;
557
561
  } | {
@@ -1035,6 +1039,57 @@ export declare function readVideoInput(file: string, options: InputOptions, reco
1035
1039
  frame: number;
1036
1040
  name: string;
1037
1041
  }[] | undefined;
1042
+ professionalMix?: {
1043
+ preset: "natural-cinematic" | "clear-voiceover";
1044
+ enabled?: boolean | undefined;
1045
+ cleanup?: number | undefined;
1046
+ warmth?: number | undefined;
1047
+ clarity?: number | undefined;
1048
+ consistency?: number | undefined;
1049
+ dialogueLufs?: number | undefined;
1050
+ highPassHz?: number | undefined;
1051
+ eq?: {
1052
+ frequency: number;
1053
+ q: number;
1054
+ db: number;
1055
+ }[] | undefined;
1056
+ deEsser?: number | undefined;
1057
+ compressor?: {
1058
+ thresholdDb: number;
1059
+ ratio: number;
1060
+ attackMs: number;
1061
+ releaseMs: number;
1062
+ } | undefined;
1063
+ ai?: "deepfilternet" | undefined;
1064
+ dereverb?: number | undefined;
1065
+ matching?: {
1066
+ amount: number;
1067
+ referenceClip?: string | undefined;
1068
+ } | undefined;
1069
+ crossfadeMs?: number | undefined;
1070
+ ducking?: {
1071
+ depthDb?: number | undefined;
1072
+ attackMs?: number | undefined;
1073
+ holdMs?: number | undefined;
1074
+ releaseMs?: number | undefined;
1075
+ } | undefined;
1076
+ delivery?: {
1077
+ preset: "web" | "broadcast" | "film";
1078
+ integratedLufs?: number | undefined;
1079
+ truePeakDbtp?: number | undefined;
1080
+ loudnessRange?: number | undefined;
1081
+ } | undefined;
1082
+ automation?: {
1083
+ dialogue?: Record<string, {
1084
+ sample: number;
1085
+ db: number;
1086
+ }[]> | undefined;
1087
+ music?: {
1088
+ sample: number;
1089
+ db: number;
1090
+ }[] | undefined;
1091
+ } | undefined;
1092
+ } | undefined;
1038
1093
  id?: string | undefined;
1039
1094
  name?: string | undefined;
1040
1095
  createdAt?: string | undefined;
@@ -460,6 +460,7 @@ export declare function verifyPackageContents(directory: string, signal?: AbortS
460
460
  })[];
461
461
  volume?: number | undefined;
462
462
  muted?: boolean | undefined;
463
+ audioRole?: "dialogue" | "music" | "other" | undefined;
463
464
  id?: string | undefined;
464
465
  name?: string | undefined;
465
466
  } | {
@@ -606,6 +607,7 @@ export declare function verifyPackageContents(directory: string, signal?: AbortS
606
607
  }[];
607
608
  volume?: number | undefined;
608
609
  muted?: boolean | undefined;
610
+ audioRole?: "dialogue" | "music" | "other" | undefined;
609
611
  id?: string | undefined;
610
612
  name?: string | undefined;
611
613
  } | {
@@ -1089,6 +1091,57 @@ export declare function verifyPackageContents(directory: string, signal?: AbortS
1089
1091
  frame: number;
1090
1092
  name: string;
1091
1093
  }[] | undefined;
1094
+ professionalMix?: {
1095
+ preset: "natural-cinematic" | "clear-voiceover";
1096
+ enabled?: boolean | undefined;
1097
+ cleanup?: number | undefined;
1098
+ warmth?: number | undefined;
1099
+ clarity?: number | undefined;
1100
+ consistency?: number | undefined;
1101
+ dialogueLufs?: number | undefined;
1102
+ highPassHz?: number | undefined;
1103
+ eq?: {
1104
+ frequency: number;
1105
+ q: number;
1106
+ db: number;
1107
+ }[] | undefined;
1108
+ deEsser?: number | undefined;
1109
+ compressor?: {
1110
+ thresholdDb: number;
1111
+ ratio: number;
1112
+ attackMs: number;
1113
+ releaseMs: number;
1114
+ } | undefined;
1115
+ ai?: "deepfilternet" | undefined;
1116
+ dereverb?: number | undefined;
1117
+ matching?: {
1118
+ amount: number;
1119
+ referenceClip?: string | undefined;
1120
+ } | undefined;
1121
+ crossfadeMs?: number | undefined;
1122
+ ducking?: {
1123
+ depthDb?: number | undefined;
1124
+ attackMs?: number | undefined;
1125
+ holdMs?: number | undefined;
1126
+ releaseMs?: number | undefined;
1127
+ } | undefined;
1128
+ delivery?: {
1129
+ preset: "web" | "broadcast" | "film";
1130
+ integratedLufs?: number | undefined;
1131
+ truePeakDbtp?: number | undefined;
1132
+ loudnessRange?: number | undefined;
1133
+ } | undefined;
1134
+ automation?: {
1135
+ dialogue?: Record<string, {
1136
+ sample: number;
1137
+ db: number;
1138
+ }[]> | undefined;
1139
+ music?: {
1140
+ sample: number;
1141
+ db: number;
1142
+ }[] | undefined;
1143
+ } | undefined;
1144
+ } | undefined;
1092
1145
  id?: string | undefined;
1093
1146
  name?: string | undefined;
1094
1147
  createdAt?: string | undefined;
@@ -76,6 +76,7 @@ export declare function previewVideo(video: CompiledVideo): {
76
76
  id: string;
77
77
  name: string;
78
78
  type: "video" | "audio";
79
+ audioRole?: "dialogue" | "music" | "other" | undefined;
79
80
  volume?: number | undefined;
80
81
  muted?: boolean | undefined;
81
82
  }[];
@@ -338,6 +339,57 @@ export declare function previewVideo(video: CompiledVideo): {
338
339
  frame: number;
339
340
  name: string;
340
341
  }[] | undefined;
342
+ professionalMix?: {
343
+ preset: "natural-cinematic" | "clear-voiceover";
344
+ enabled?: boolean | undefined;
345
+ cleanup?: number | undefined;
346
+ warmth?: number | undefined;
347
+ clarity?: number | undefined;
348
+ consistency?: number | undefined;
349
+ dialogueLufs?: number | undefined;
350
+ highPassHz?: number | undefined;
351
+ eq?: {
352
+ frequency: number;
353
+ q: number;
354
+ db: number;
355
+ }[] | undefined;
356
+ deEsser?: number | undefined;
357
+ compressor?: {
358
+ thresholdDb: number;
359
+ ratio: number;
360
+ attackMs: number;
361
+ releaseMs: number;
362
+ } | undefined;
363
+ ai?: "deepfilternet" | undefined;
364
+ dereverb?: number | undefined;
365
+ matching?: {
366
+ amount: number;
367
+ referenceClip?: string | undefined;
368
+ } | undefined;
369
+ crossfadeMs?: number | undefined;
370
+ ducking?: {
371
+ depthDb?: number | undefined;
372
+ attackMs?: number | undefined;
373
+ holdMs?: number | undefined;
374
+ releaseMs?: number | undefined;
375
+ } | undefined;
376
+ delivery?: {
377
+ preset: "web" | "broadcast" | "film";
378
+ integratedLufs?: number | undefined;
379
+ truePeakDbtp?: number | undefined;
380
+ loudnessRange?: number | undefined;
381
+ } | undefined;
382
+ automation?: {
383
+ dialogue?: Record<string, {
384
+ sample: number;
385
+ db: number;
386
+ }[]> | undefined;
387
+ music?: {
388
+ sample: number;
389
+ db: number;
390
+ }[] | undefined;
391
+ } | undefined;
392
+ } | undefined;
341
393
  };
342
394
  inspectFrame: (position: PreviewPosition) => {
343
395
  inspectionVersion: 1;
@@ -1198,7 +1250,10 @@ export declare function previewVideo(video: CompiledVideo): {
1198
1250
  y: number;
1199
1251
  }[];
1200
1252
  }>;
1201
- clip(selection: Required<VideoPreviewRange>, output: string, options?: VideoPreviewOptions & Pick<RenderControls, "onProgress">): Promise<{
1253
+ clip(selection: Required<VideoPreviewRange>, output: string, options?: VideoPreviewOptions & Pick<RenderControls, "onProgress" | "audioComparison"> & {
1254
+ audioMixCacheDirectory?: string | undefined;
1255
+ }): Promise<{
1256
+ audioMix?: import("@opencut/media").AudioMixReport;
1202
1257
  inspectionVersion: 1;
1203
1258
  path: string;
1204
1259
  projectPath: string;
@@ -1,6 +1,7 @@
1
1
  import { renderContactSheet, renderTimelineFrame, renderVideoTimeline, } from '@opencut/media';
2
2
  import { inspectProject, inspectTimeline, previewClipSchema, previewFrameSchema, previewSheetSchema, } from './inspection.js';
3
3
  import { frameTime, timeSchema } from './time.js';
4
+ import { openAudioMixCache } from './video-audio-mix.js';
4
5
  import { withRenderSources } from './render-sources.js';
5
6
  export class VideoPreviewRangeError extends RangeError {
6
7
  }
@@ -95,16 +96,19 @@ export function previewVideo(video) {
95
96
  const { signal, onProgress } = options;
96
97
  const quality = options.quality ?? 'fast';
97
98
  const revision = await video.forQuality(quality, true, signal);
98
- const { path, width, height, frameCount, durationSeconds } = await withRenderSources(revision, signal, (plan) => renderVideoTimeline({
99
+ const audioMixCache = await openAudioMixCache(options.audioMixCacheDirectory, signal);
100
+ const { path, width, height, frameCount, durationSeconds, audioMix } = await withRenderSources(revision, signal, (plan) => renderVideoTimeline({
99
101
  ...plan,
100
102
  signal,
101
103
  ...(onProgress && { onProgress }),
102
104
  maxDimension: options.maxDimension ?? 640,
105
+ audioComparison: options.audioComparison,
106
+ ...(audioMixCache && { audioMixCache }),
103
107
  quality,
104
108
  output,
105
109
  range: { startFrame, endFrame },
106
110
  }));
107
- return previewClipSchema.parse({
111
+ const result = previewClipSchema.parse({
108
112
  ...base,
109
113
  path,
110
114
  width,
@@ -118,6 +122,7 @@ export function previewVideo(video) {
118
122
  startTime: frameTime(startFrame, frameRate),
119
123
  endTime: frameTime(endFrame, frameRate),
120
124
  });
125
+ return { ...result, ...(audioMix && { audioMix }) };
121
126
  },
122
127
  };
123
128
  }
@@ -2,20 +2,25 @@ import type { RenderControls } from '@opencut/media';
2
2
  import type { CompiledVideo } from './video-compiler.js';
3
3
  import type { VideoProcessingOptions } from './video-processing.js';
4
4
  import type { VideoBuild, VideoCompileOptions } from './video-files.js';
5
+ import type { VideoMixEdit } from '@opencut/shared';
5
6
  export type VideoRenderOptions = Omit<RenderControls, 'range' | 'maxDimension'> & {
6
7
  burnSubtitles?: boolean;
7
8
  pictureCacheDirectory?: string | undefined;
9
+ audioMixCacheDirectory?: string | undefined;
10
+ audioMixEdit?: VideoCompileOptions['audioMixEdit'];
8
11
  processing?: VideoProcessingOptions | undefined;
9
12
  params?: VideoCompileOptions['params'];
10
13
  };
11
- export type CompiledVideoRenderOptions = Omit<VideoRenderOptions, 'processing' | 'params'>;
12
- export type VideoRenderConfiguration = Omit<RenderControls, 'onProgress' | 'signal' | 'overwrite'> & Pick<CompiledVideoRenderOptions, 'burnSubtitles'>;
14
+ export type CompiledVideoRenderOptions = Omit<VideoRenderOptions, 'processing' | 'params' | 'audioMixEdit'>;
15
+ export type VideoRenderConfiguration = Omit<RenderControls, 'onProgress' | 'signal' | 'overwrite'> & Pick<CompiledVideoRenderOptions, 'burnSubtitles'> & {
16
+ audioMixEdit?: VideoMixEdit;
17
+ };
13
18
  export interface VideoRenderBuild extends VideoBuild {
14
19
  readonly version: 1;
15
20
  readonly render: Readonly<VideoRenderConfiguration>;
16
21
  }
17
22
  /** Render one compiled revision using the shared media engine. */
18
- export declare function renderCompiledVideo(video: CompiledVideo, output: string, { burnSubtitles, quality, pictureCacheDirectory, ...options }?: CompiledVideoRenderOptions): Promise<{
23
+ export declare function renderCompiledVideo(video: CompiledVideo, output: string, { burnSubtitles, quality, pictureCacheDirectory, audioMixCacheDirectory, ...options }?: CompiledVideoRenderOptions): Promise<{
19
24
  build?: VideoRenderBuild;
20
25
  codec: import("@opencut/media").RenderCodec;
21
26
  quality: import("@opencut/media").RenderQuality;
@@ -32,9 +37,10 @@ export declare function renderCompiledVideo(video: CompiledVideo, output: string
32
37
  metadata: import("@opencut/media").MediaMetadata;
33
38
  warnings?: string[];
34
39
  pictureRanges?: import("@opencut/media").PictureRange[];
40
+ audioMix?: import("@opencut/media").AudioMixReport;
35
41
  }>;
36
42
  /** Compile and render in the calling process. Subprocesses are scoped to this call. */
37
- export declare function renderVideo(file: string, output: string, { params, processing, ...options }?: VideoRenderOptions): Promise<{
43
+ export declare function renderVideo(file: string, output: string, { params, processing, audioMixEdit, ...options }?: VideoRenderOptions): Promise<{
38
44
  build?: VideoRenderBuild;
39
45
  codec: import("@opencut/media").RenderCodec;
40
46
  quality: import("@opencut/media").RenderQuality;
@@ -51,4 +57,5 @@ export declare function renderVideo(file: string, output: string, { params, proc
51
57
  metadata: import("@opencut/media").MediaMetadata;
52
58
  warnings?: string[];
53
59
  pictureRanges?: import("@opencut/media").PictureRange[];
60
+ audioMix?: import("@opencut/media").AudioMixReport;
54
61
  }>;
@@ -5,6 +5,7 @@ import { authoredInputs, checkpointRender } from './video-build.js';
5
5
  import { withRenderSources } from './render-sources.js';
6
6
  import { compileVideo } from './video-files.js';
7
7
  import { isInterpolationStep } from './video-recipe-schema.js';
8
+ import { openAudioMixCache } from './video-audio-mix.js';
8
9
  import { openPictureCache } from './video-picture-cache.js';
9
10
  async function statIfPresent(path) {
10
11
  try {
@@ -34,7 +35,7 @@ async function protectInputs(video, output, boundSources, signal) {
34
35
  }
35
36
  }
36
37
  /** Render one compiled revision using the shared media engine. */
37
- export async function renderCompiledVideo(video, output, { burnSubtitles = true, quality = 'quality', pictureCacheDirectory, ...options } = {}) {
38
+ export async function renderCompiledVideo(video, output, { burnSubtitles = true, quality = 'quality', pictureCacheDirectory, audioMixCacheDirectory, ...options } = {}) {
38
39
  const { onProgress, signal, overwrite, ...settings } = options;
39
40
  video = await video.forQuality(quality, !burnSubtitles, signal);
40
41
  // Record the controls the shared renderer receives, including runtime callers.
@@ -61,11 +62,20 @@ export async function renderCompiledVideo(video, output, { burnSubtitles = true,
61
62
  audioSampleRate: settings.audioSampleRate ?? 48000,
62
63
  audioChannels: settings.audioChannels ?? 2,
63
64
  burnSubtitles,
65
+ ...(settings.audioComparison && {
66
+ audioComparison: settings.audioComparison,
67
+ }),
68
+ ...(video.audioMixEdit && { audioMixEdit: video.audioMixEdit }),
64
69
  },
65
70
  };
66
71
  const buildMetadata = build && JSON.stringify(build);
67
72
  signal?.throwIfAborted();
68
- return checkpointRender(video, output, { ...settings, quality, burnSubtitles }, signal, (scratchDirectory, onVerifiedOutput) => withRenderSources(video, signal, async (plan) => {
73
+ return checkpointRender(video, output, {
74
+ ...settings,
75
+ quality,
76
+ burnSubtitles,
77
+ ...(video.audioMixEdit && { audioMixEdit: video.audioMixEdit }),
78
+ }, signal, (scratchDirectory, onVerifiedOutput) => withRenderSources(video, signal, async (plan) => {
69
79
  if (overwrite)
70
80
  await protectInputs(video, output, plan.sourceMetadata.keys(), signal);
71
81
  if (!burnSubtitles)
@@ -73,6 +83,7 @@ export async function renderCompiledVideo(video, output, { burnSubtitles = true,
73
83
  const pictureCache = pictureCacheDirectory === undefined
74
84
  ? undefined
75
85
  : await openPictureCache(pictureCacheDirectory, video, signal);
86
+ const audioMixCache = await openAudioMixCache(audioMixCacheDirectory, signal);
76
87
  const result = await renderVideoTimeline({
77
88
  ...plan,
78
89
  ...settings,
@@ -80,6 +91,7 @@ export async function renderCompiledVideo(video, output, { burnSubtitles = true,
80
91
  signal,
81
92
  overwrite,
82
93
  pictureCache,
94
+ ...(audioMixCache && { audioMixCache }),
83
95
  ...(onProgress && { onProgress }),
84
96
  ...(buildMetadata && { buildMetadata }),
85
97
  ...(scratchDirectory && { scratchDirectory }),
@@ -94,13 +106,14 @@ export async function renderCompiledVideo(video, output, { burnSubtitles = true,
94
106
  }, scratchDirectory));
95
107
  }
96
108
  /** Compile and render in the calling process. Subprocesses are scoped to this call. */
97
- export async function renderVideo(file, output, { params, processing, ...options } = {}) {
109
+ export async function renderVideo(file, output, { params, processing, audioMixEdit, ...options } = {}) {
98
110
  const video = await compileVideo(file, {
99
111
  signal: options.signal,
100
112
  preview: options.burnSubtitles === false,
101
113
  processing,
102
114
  quality: options.quality ?? 'quality',
103
115
  params,
116
+ audioMixEdit,
104
117
  });
105
118
  return renderCompiledVideo(video, output, options);
106
119
  }
@@ -1,3 +1,4 @@
1
+ import type { VideoMixEdit } from '@opencut/shared';
1
2
  import type { RenderQuality, VideoTimelineResult } from '@opencut/media';
2
3
  import type { CompiledVideo } from './video-compiler.js';
3
4
  import type { VideoProcessingOptions } from './video-processing.js';
@@ -22,10 +23,14 @@ export interface VideoWatchOptions {
22
23
  quality?: RenderQuality | undefined;
23
24
  processing?: VideoProcessingOptions;
24
25
  signal?: AbortSignal;
26
+ audioMixEdit?: VideoMixEdit | undefined;
27
+ audioComparison?: 'before' | 'after' | undefined;
28
+ audioMixCacheDirectory?: string | undefined;
25
29
  }
26
30
  /** Watch only inputs of the selected definition, retaining one playable revision. */
27
31
  export declare function watchVideo(file: string, options: VideoWatchOptions): Promise<{
28
32
  path: string;
29
33
  close: () => Promise<void>;
30
34
  withCurrent: <T>(generation: number, run: (video: CompiledVideo) => Promise<T>) => Promise<T>;
35
+ setAudioMix: (edit: VideoMixEdit | undefined, comparison?: "after" | "before") => void;
31
36
  }>;
@@ -1,3 +1,4 @@
1
+ import { openAudioMixCache } from './video-audio-mix.js';
1
2
  import { createHash, randomUUID } from 'node:crypto';
2
3
  import { mkdtemp, readFile, realpath, rm } from 'node:fs/promises';
3
4
  import { tmpdir } from 'node:os';
@@ -20,6 +21,8 @@ export async function watchVideo(file, options) {
20
21
  maxDimension: options.maxDimension ?? 640,
21
22
  quality: options.quality ?? 'fast',
22
23
  };
24
+ let audioMixEdit = options.audioMixEdit;
25
+ let audioComparison = options.audioComparison;
23
26
  const renders = new Map();
24
27
  let published;
25
28
  let active;
@@ -98,6 +101,7 @@ export async function watchVideo(file, options) {
98
101
  const inputs = new Map();
99
102
  const media = new Set();
100
103
  const output = join(directory, `revision-${next}.mp4`);
104
+ const comparison = audioComparison;
101
105
  const record = (input) => {
102
106
  if (!inputs.has(input.path))
103
107
  inputs.set(input.path, input);
@@ -111,6 +115,7 @@ export async function watchVideo(file, options) {
111
115
  signal,
112
116
  probes,
113
117
  processing: options.processing,
118
+ audioMixEdit,
114
119
  scriptWorker: {},
115
120
  inputs: {
116
121
  record,
@@ -154,17 +159,23 @@ export async function watchVideo(file, options) {
154
159
  // The bound paths identify immutable media copies. Edits that leave
155
160
  // the composition unchanged can publish a new revision with the same MP4.
156
161
  const renderKey = createHash('sha256')
157
- .update(JSON.stringify([plan, settings]))
162
+ .update(JSON.stringify([plan, settings, comparison]))
158
163
  .digest('hex');
159
164
  let playback = published?.renderKey === renderKey
160
165
  ? published.revision.playback
161
166
  : undefined;
162
167
  if (!playback) {
163
168
  emit('rendering', next);
169
+ const audioMixCache = video.project.professionalMix?.ai &&
170
+ video.project.professionalMix.enabled !== false
171
+ ? await openAudioMixCache(options.audioMixCacheDirectory ?? directory, signal)
172
+ : undefined;
164
173
  playback = await withDefaultRenderBudget(signal, () => renderVideoTimeline({
165
174
  ...plan,
166
175
  sourceMetadata,
167
176
  ...settings,
177
+ audioComparison: comparison,
178
+ ...(audioMixCache && { audioMixCache }),
168
179
  output,
169
180
  signal,
170
181
  }));
@@ -256,6 +267,11 @@ export async function watchVideo(file, options) {
256
267
  await pruneSnapshots();
257
268
  }
258
269
  }
259
- return { path, close, withCurrent };
270
+ function setAudioMix(edit, comparison = 'after') {
271
+ audioMixEdit = edit;
272
+ audioComparison = comparison;
273
+ schedule();
274
+ }
275
+ return { path, close, withCurrent, setAudioMix };
260
276
  }
261
277
  //# sourceMappingURL=video-watch.js.map
@@ -24,3 +24,8 @@ export type { VideoBatchOptions, VideoBatchProgress, VideoBatchResult, VideoVari
24
24
  export { packageVideo, verifyVideoPackage } from './video-package.js';
25
25
  export type { VideoPackageOptions } from './video-package.js';
26
26
  export type { VideoPackageManifest } from './video-package-format.js';
27
+ export { analyzeVideoMix } from './video-audio-mix.js';
28
+ export type { AudioMixAnalysisOptions } from './video-audio-mix.js';
29
+ export { audioRoleSchema, professionalMixSchema, videoMixEditSchema, } from './professional-mix.js';
30
+ export type { AudioRole, DeliveryPreset, DialoguePreset, MixAutomation, MixGainPoint, ProfessionalMix, VideoMixEdit, } from '@opencut/shared';
31
+ export type { AudioMixReport } from '@opencut/media';