@slidevideo/cli 0.3.0 → 0.3.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/CHANGELOG.md +20 -0
- package/README.md +3 -3
- package/addons/slidevideo/geometry.ts +334 -1
- package/addons/slidevideo/global-top.vue +57 -6
- package/addons/slidevideo/preview.ts +242 -25
- package/assets/fonts/OFL-LICENSES.txt +95 -0
- package/assets/fonts/instrument-serif-latin-2.woff2 +0 -0
- package/assets/fonts/instrument-serif-latin-ext-1.woff2 +0 -0
- package/assets/fonts/jetbrains-mono-latin-4.woff2 +0 -0
- package/assets/fonts/jetbrains-mono-latin-ext-3.woff2 +0 -0
- package/assets/fonts/plus-jakarta-sans-latin-6.woff2 +0 -0
- package/assets/fonts/plus-jakarta-sans-latin-ext-5.woff2 +0 -0
- package/dist/adapters/edge.d.ts +1 -0
- package/dist/adapters/edge.js +4 -3
- package/dist/adapters/elevenlabs.d.ts +1 -0
- package/dist/adapters/elevenlabs.js +4 -3
- package/dist/adapters/powerpoint-preview.d.ts +1 -1
- package/dist/adapters/powerpoint-preview.js +13 -2
- package/dist/adapters/powerpoint.js +91 -14
- package/dist/adapters/slidev-inspection.js +7 -2
- package/dist/annotation-paint.d.ts +195 -5
- package/dist/annotation-paint.js +1188 -2
- package/dist/annotations.d.ts +26 -2
- package/dist/annotations.js +1117 -29
- package/dist/assembly.js +143 -37
- package/dist/captions.d.ts +6 -0
- package/dist/captions.js +320 -0
- package/dist/cli.js +59 -19
- package/dist/compositor.d.ts +17 -2
- package/dist/compositor.js +108 -26
- package/dist/contracts.d.ts +254 -14
- package/dist/media.js +24 -1
- package/dist/pipeline.d.ts +6 -1
- package/dist/pipeline.js +68 -20
- package/dist/preview/contracts.d.ts +15 -0
- package/dist/preview/player.js +527 -34
- package/dist/preview/server.d.ts +1 -1
- package/dist/preview/server.js +125 -4
- package/dist/preview/view.d.ts +1 -1
- package/dist/preview/view.js +26 -7
- package/dist/run.d.ts +1 -0
- package/dist/run.js +20 -0
- package/dist/speech.d.ts +13 -3
- package/dist/speech.js +164 -45
- package/dist/stamp-fonts.d.ts +17 -0
- package/dist/stamp-fonts.js +202 -0
- package/dist/storyboard.js +60 -3
- package/dist/timing.d.ts +4 -1
- package/dist/timing.js +322 -14
- package/dist/update-check-worker.js +43 -11
- package/dist/update-check.js +14 -10
- package/package.json +12 -1
- package/schemas/annotation-geometry.v1.json +111 -0
- package/schemas/schedule.v1.json +1672 -84
- package/schemas/storyboard.v1.json +3725 -85
- package/skills/slidevideo/SKILL.md +5 -5
- package/skills/slidevideo/references/decks.md +6 -4
- package/skills/slidevideo/references/production.md +12 -11
- package/skills/slidevideo/references/storyboard.md +268 -5
- package/tools/powerpoint/powerpoint.ps1 +155 -6
- package/tools/powerpoint/preview.ps1 +68 -1
package/dist/contracts.d.ts
CHANGED
|
@@ -53,6 +53,25 @@ export type Rectangle = {
|
|
|
53
53
|
width: number;
|
|
54
54
|
height: number;
|
|
55
55
|
};
|
|
56
|
+
export type TextContainerTarget = {
|
|
57
|
+
type: 'element';
|
|
58
|
+
selector: string;
|
|
59
|
+
} | {
|
|
60
|
+
type: 'shape';
|
|
61
|
+
id: number;
|
|
62
|
+
};
|
|
63
|
+
export type TextTarget = {
|
|
64
|
+
type: 'text';
|
|
65
|
+
container?: TextContainerTarget;
|
|
66
|
+
text: string;
|
|
67
|
+
occurrence?: number;
|
|
68
|
+
};
|
|
69
|
+
export type ResolvedTextTarget = TextTarget & {
|
|
70
|
+
slice?: {
|
|
71
|
+
start: number;
|
|
72
|
+
end: number;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
56
75
|
export type AnnotationTarget = ({
|
|
57
76
|
type: 'region';
|
|
58
77
|
units: 'normalized';
|
|
@@ -62,10 +81,35 @@ export type AnnotationTarget = ({
|
|
|
62
81
|
} | {
|
|
63
82
|
type: 'shape';
|
|
64
83
|
id: number;
|
|
65
|
-
};
|
|
66
|
-
export type
|
|
84
|
+
} | TextTarget;
|
|
85
|
+
export type ResolvedAnnotationTarget = Exclude<AnnotationTarget, TextTarget> | ResolvedTextTarget;
|
|
86
|
+
export type GeometryTarget = ResolvedAnnotationTarget | {
|
|
67
87
|
type: 'slide';
|
|
68
88
|
};
|
|
89
|
+
export type WordFollowTokenMap = {
|
|
90
|
+
text: string;
|
|
91
|
+
occurrence?: number;
|
|
92
|
+
phrase: string;
|
|
93
|
+
phrase_occurrence?: number;
|
|
94
|
+
};
|
|
95
|
+
export type WordFollowTiming = {
|
|
96
|
+
segment: string;
|
|
97
|
+
phrase?: string;
|
|
98
|
+
occurrence?: number;
|
|
99
|
+
mode?: 'words' | 'phrase';
|
|
100
|
+
offset_ms?: number;
|
|
101
|
+
linger_ms?: number;
|
|
102
|
+
tokens?: WordFollowTokenMap[];
|
|
103
|
+
};
|
|
104
|
+
export type AnnotationTiming = {
|
|
105
|
+
at: number | PhraseCue;
|
|
106
|
+
duration_ms: number;
|
|
107
|
+
follow?: never;
|
|
108
|
+
} | {
|
|
109
|
+
follow: WordFollowTiming;
|
|
110
|
+
at?: never;
|
|
111
|
+
duration_ms?: never;
|
|
112
|
+
};
|
|
69
113
|
export type HighlightAppearance = {
|
|
70
114
|
color: string;
|
|
71
115
|
opacity: number;
|
|
@@ -82,15 +126,14 @@ export type HighlightAppearance = {
|
|
|
82
126
|
height: number;
|
|
83
127
|
};
|
|
84
128
|
};
|
|
85
|
-
export type
|
|
129
|
+
export type HighlightAnnotationBase = {
|
|
86
130
|
id: string;
|
|
87
131
|
scene: string;
|
|
88
132
|
effect: 'highlight';
|
|
89
133
|
target: AnnotationTarget;
|
|
90
134
|
appearance: HighlightAppearance;
|
|
91
|
-
at: PhraseCue;
|
|
92
|
-
duration_ms: number;
|
|
93
135
|
};
|
|
136
|
+
export type HighlightAnnotation = HighlightAnnotationBase & AnnotationTiming;
|
|
94
137
|
export type UnderlineAppearance = {
|
|
95
138
|
color: string;
|
|
96
139
|
opacity: number;
|
|
@@ -106,33 +149,229 @@ export type UnderlineMotion = {
|
|
|
106
149
|
in_ms?: number;
|
|
107
150
|
out_ms?: number;
|
|
108
151
|
};
|
|
109
|
-
export type
|
|
152
|
+
export type UnderlineAnnotationBase = {
|
|
110
153
|
id: string;
|
|
111
154
|
scene: string;
|
|
112
155
|
effect: 'underline';
|
|
113
156
|
target: AnnotationTarget;
|
|
114
157
|
appearance: UnderlineAppearance;
|
|
115
158
|
motion?: UnderlineMotion;
|
|
116
|
-
at: PhraseCue;
|
|
117
|
-
duration_ms: number;
|
|
118
159
|
};
|
|
119
|
-
export type
|
|
160
|
+
export type UnderlineAnnotation = UnderlineAnnotationBase & AnnotationTiming;
|
|
161
|
+
export type SpotlightPadding = {
|
|
162
|
+
units: 'normalized';
|
|
163
|
+
x: number;
|
|
164
|
+
y: number;
|
|
165
|
+
};
|
|
166
|
+
export type SpotlightAppearance = {
|
|
167
|
+
color?: string;
|
|
168
|
+
opacity: number;
|
|
169
|
+
shape?: 'rounded-rect';
|
|
170
|
+
radius?: number;
|
|
171
|
+
softness?: number;
|
|
172
|
+
padding?: SpotlightPadding;
|
|
173
|
+
} | {
|
|
174
|
+
color?: string;
|
|
175
|
+
opacity: number;
|
|
176
|
+
shape: 'ellipse';
|
|
177
|
+
softness?: number;
|
|
178
|
+
padding?: SpotlightPadding;
|
|
179
|
+
};
|
|
180
|
+
export type SpotlightMotion = {
|
|
181
|
+
type: 'fade';
|
|
182
|
+
in_ms?: number;
|
|
183
|
+
out_ms?: number;
|
|
184
|
+
};
|
|
185
|
+
export type SpotlightAnnotationBase = {
|
|
186
|
+
id: string;
|
|
187
|
+
scene: string;
|
|
188
|
+
effect: 'spotlight';
|
|
189
|
+
target: AnnotationTarget;
|
|
190
|
+
appearance: SpotlightAppearance;
|
|
191
|
+
motion?: SpotlightMotion;
|
|
192
|
+
};
|
|
193
|
+
export type SpotlightAnnotation = SpotlightAnnotationBase & AnnotationTiming;
|
|
194
|
+
export type ZoomPadding = {
|
|
195
|
+
units: 'normalized';
|
|
196
|
+
x: number;
|
|
197
|
+
y: number;
|
|
198
|
+
};
|
|
199
|
+
export type ZoomEasing = 'ease-in-out' | 'linear';
|
|
200
|
+
export type ZoomAppearance = {
|
|
201
|
+
fit?: 'contain' | 'cover';
|
|
202
|
+
scale?: number;
|
|
203
|
+
max_scale?: number;
|
|
204
|
+
padding?: ZoomPadding;
|
|
205
|
+
};
|
|
206
|
+
export type ZoomMotion = {
|
|
207
|
+
type: 'ease';
|
|
208
|
+
in_ms?: number;
|
|
209
|
+
out_ms?: number;
|
|
210
|
+
easing?: ZoomEasing;
|
|
211
|
+
};
|
|
212
|
+
export type ZoomAnnotationBase = {
|
|
213
|
+
id: string;
|
|
214
|
+
scene: string;
|
|
215
|
+
effect: 'zoom';
|
|
216
|
+
target: AnnotationTarget;
|
|
217
|
+
appearance?: ZoomAppearance;
|
|
218
|
+
motion?: ZoomMotion;
|
|
219
|
+
};
|
|
220
|
+
export type ZoomAnnotation = ZoomAnnotationBase & AnnotationTiming;
|
|
221
|
+
export type LaserAnchor = 'center' | 'top-left' | 'top' | 'top-right' | 'left' | 'right' | 'bottom-left' | 'bottom' | 'bottom-right';
|
|
222
|
+
export type LaserWaypoint = {
|
|
223
|
+
x: number;
|
|
224
|
+
y: number;
|
|
225
|
+
dwell_ms?: number;
|
|
226
|
+
} | {
|
|
227
|
+
target: AnnotationTarget;
|
|
228
|
+
anchor?: LaserAnchor;
|
|
229
|
+
dwell_ms?: number;
|
|
230
|
+
};
|
|
231
|
+
export type ResolvedLaserWaypoint = {
|
|
232
|
+
x: number;
|
|
233
|
+
y: number;
|
|
234
|
+
dwell_ms?: number;
|
|
235
|
+
} | {
|
|
236
|
+
target: ResolvedAnnotationTarget;
|
|
237
|
+
anchor?: LaserAnchor;
|
|
238
|
+
dwell_ms?: number;
|
|
239
|
+
};
|
|
240
|
+
export type LaserPathTarget = {
|
|
241
|
+
type: 'path';
|
|
242
|
+
units: 'normalized';
|
|
243
|
+
points: LaserWaypoint[];
|
|
244
|
+
};
|
|
245
|
+
export type ResolvedLaserPathTarget = {
|
|
246
|
+
type: 'path';
|
|
247
|
+
units: 'normalized';
|
|
248
|
+
points: ResolvedLaserWaypoint[];
|
|
249
|
+
};
|
|
250
|
+
export type LaserInterpolation = 'linear' | 'smooth';
|
|
251
|
+
export type LaserAppearance = {
|
|
252
|
+
color?: string;
|
|
253
|
+
opacity?: number;
|
|
254
|
+
radius?: number;
|
|
255
|
+
glow?: number;
|
|
256
|
+
trail_ms?: number;
|
|
257
|
+
interpolation?: LaserInterpolation;
|
|
258
|
+
};
|
|
259
|
+
export type LaserMotion = {
|
|
260
|
+
type: 'fade';
|
|
261
|
+
in_ms?: number;
|
|
262
|
+
out_ms?: number;
|
|
263
|
+
};
|
|
264
|
+
export type LaserAnnotationBase = {
|
|
265
|
+
id: string;
|
|
266
|
+
scene: string;
|
|
267
|
+
effect: 'laser';
|
|
268
|
+
target: LaserPathTarget;
|
|
269
|
+
appearance?: LaserAppearance;
|
|
270
|
+
motion?: LaserMotion;
|
|
271
|
+
};
|
|
272
|
+
export type LaserAnnotation = LaserAnnotationBase & AnnotationTiming;
|
|
273
|
+
export type TargetAnchor = LaserAnchor;
|
|
274
|
+
export type StampTarget = AnnotationTarget | {
|
|
275
|
+
type: 'point';
|
|
276
|
+
units: 'normalized';
|
|
277
|
+
x: number;
|
|
278
|
+
y: number;
|
|
279
|
+
};
|
|
280
|
+
export type ResolvedStampTarget = ResolvedAnnotationTarget | {
|
|
281
|
+
type: 'point';
|
|
282
|
+
units: 'normalized';
|
|
283
|
+
x: number;
|
|
284
|
+
y: number;
|
|
285
|
+
};
|
|
286
|
+
export type StampSymbol = 'check' | 'cross' | 'warning' | 'star' | 'info' | 'arrow-right';
|
|
287
|
+
export type StampFont = 'sans' | 'mono' | 'serif';
|
|
288
|
+
export type StampPadding = {
|
|
289
|
+
units: 'normalized';
|
|
290
|
+
x: number;
|
|
291
|
+
y: number;
|
|
292
|
+
};
|
|
293
|
+
export type StampOffset = {
|
|
294
|
+
units: 'normalized';
|
|
295
|
+
x: number;
|
|
296
|
+
y: number;
|
|
297
|
+
};
|
|
298
|
+
export type StampBorder = {
|
|
299
|
+
color: string;
|
|
300
|
+
opacity?: number;
|
|
301
|
+
width?: number;
|
|
302
|
+
};
|
|
303
|
+
export type StampAppearance = {
|
|
304
|
+
text?: string;
|
|
305
|
+
symbol?: StampSymbol;
|
|
306
|
+
font?: StampFont;
|
|
307
|
+
size?: number;
|
|
308
|
+
color?: string;
|
|
309
|
+
opacity?: number;
|
|
310
|
+
background?: string;
|
|
311
|
+
background_opacity?: number;
|
|
312
|
+
border?: StampBorder;
|
|
313
|
+
radius?: number;
|
|
314
|
+
padding?: StampPadding;
|
|
315
|
+
anchor?: TargetAnchor;
|
|
316
|
+
offset?: StampOffset;
|
|
317
|
+
rotation_deg?: number;
|
|
318
|
+
max_width?: number;
|
|
319
|
+
align?: 'left' | 'center' | 'right';
|
|
320
|
+
overflow?: 'error' | 'clip';
|
|
321
|
+
};
|
|
322
|
+
export type StampMotion = {
|
|
323
|
+
type: 'fade';
|
|
324
|
+
in_ms?: number;
|
|
325
|
+
out_ms?: number;
|
|
326
|
+
} | {
|
|
327
|
+
type: 'pop';
|
|
328
|
+
in_ms?: number;
|
|
329
|
+
out_ms?: number;
|
|
330
|
+
start_scale?: number;
|
|
331
|
+
};
|
|
332
|
+
export type StampAnnotationBase = {
|
|
333
|
+
id: string;
|
|
334
|
+
scene: string;
|
|
335
|
+
effect: 'stamp';
|
|
336
|
+
target: StampTarget;
|
|
337
|
+
appearance: StampAppearance;
|
|
338
|
+
motion?: StampMotion;
|
|
339
|
+
};
|
|
340
|
+
export type StampAnnotation = StampAnnotationBase & AnnotationTiming;
|
|
341
|
+
export type Annotation = HighlightAnnotation | UnderlineAnnotation | SpotlightAnnotation | ZoomAnnotation | LaserAnnotation | StampAnnotation;
|
|
120
342
|
export type ResolvedAnnotationWindow = {
|
|
121
343
|
start_ms: number;
|
|
122
344
|
end_ms: number;
|
|
123
345
|
slide: string;
|
|
124
346
|
visit: string;
|
|
125
347
|
click: number;
|
|
126
|
-
cue_span
|
|
348
|
+
cue_span?: {
|
|
127
349
|
segment: string;
|
|
128
350
|
start: number;
|
|
129
351
|
end: number;
|
|
130
352
|
form: string;
|
|
131
353
|
};
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
export type
|
|
135
|
-
|
|
354
|
+
source_id?: string;
|
|
355
|
+
};
|
|
356
|
+
export type ResolvedHighlightAnnotation = Omit<HighlightAnnotationBase, 'target'> & {
|
|
357
|
+
target: ResolvedAnnotationTarget;
|
|
358
|
+
} & ResolvedAnnotationWindow;
|
|
359
|
+
export type ResolvedUnderlineAnnotation = Omit<UnderlineAnnotationBase, 'target'> & {
|
|
360
|
+
target: ResolvedAnnotationTarget;
|
|
361
|
+
} & ResolvedAnnotationWindow;
|
|
362
|
+
export type ResolvedSpotlightAnnotation = Omit<SpotlightAnnotationBase, 'target'> & {
|
|
363
|
+
target: ResolvedAnnotationTarget;
|
|
364
|
+
} & ResolvedAnnotationWindow;
|
|
365
|
+
export type ResolvedZoomAnnotation = Omit<ZoomAnnotationBase, 'target'> & {
|
|
366
|
+
target: ResolvedAnnotationTarget;
|
|
367
|
+
} & ResolvedAnnotationWindow;
|
|
368
|
+
export type ResolvedLaserAnnotation = Omit<LaserAnnotationBase, 'target'> & {
|
|
369
|
+
target: ResolvedLaserPathTarget;
|
|
370
|
+
} & ResolvedAnnotationWindow;
|
|
371
|
+
export type ResolvedStampAnnotation = Omit<StampAnnotationBase, 'target'> & {
|
|
372
|
+
target: ResolvedStampTarget;
|
|
373
|
+
} & ResolvedAnnotationWindow;
|
|
374
|
+
export type ResolvedAnnotation = ResolvedHighlightAnnotation | ResolvedUnderlineAnnotation | ResolvedSpotlightAnnotation | ResolvedZoomAnnotation | ResolvedLaserAnnotation | ResolvedStampAnnotation;
|
|
136
375
|
export type GeometryRequest = {
|
|
137
376
|
key: string;
|
|
138
377
|
target: GeometryTarget;
|
|
@@ -346,6 +585,7 @@ export type VisualArtifact = {
|
|
|
346
585
|
export interface TtsAdapter {
|
|
347
586
|
id: string;
|
|
348
587
|
version: string;
|
|
588
|
+
readonly concurrency?: number;
|
|
349
589
|
validate(voice: Voice): void;
|
|
350
590
|
synthesize(segment: Narration, voice: Voice, destination: string): Promise<Omit<SpeechAsset, 'key'>>;
|
|
351
591
|
}
|
package/dist/media.js
CHANGED
|
@@ -92,7 +92,30 @@ export function ffmpegFilterScriptFlags(ffmpegPath = executable('ffmpeg')) {
|
|
|
92
92
|
}
|
|
93
93
|
return cached;
|
|
94
94
|
}
|
|
95
|
-
export async function audioDuration(path) {
|
|
95
|
+
export async function audioDuration(path) {
|
|
96
|
+
const command = executable('ffmpeg');
|
|
97
|
+
const args = ['-v', 'error', '-xerror', '-i', path, '-vn', '-ac', '1', '-ar', '48000', '-f', 's16le', '-'];
|
|
98
|
+
return new Promise((resolve, reject) => {
|
|
99
|
+
const context = executionScope.getStore();
|
|
100
|
+
const signal = context?.signal;
|
|
101
|
+
signal?.throwIfAborted();
|
|
102
|
+
const child = spawn(command, args, { stdio: ['ignore', 'pipe', 'pipe'], signal, killSignal: 'SIGKILL', windowsHide: true });
|
|
103
|
+
let bytes = 0;
|
|
104
|
+
const err = [];
|
|
105
|
+
const limit = context?.bounded ? undefined : 120000;
|
|
106
|
+
const timer = limit !== undefined ? setTimeout(() => { child.kill('SIGKILL'); }, limit) : undefined;
|
|
107
|
+
child.stdout.on('data', (data) => { bytes += data.length; });
|
|
108
|
+
child.stderr.on('data', (data) => err.push(data));
|
|
109
|
+
child.on('error', error => { clearTimeout(timer); reject(new ProductionError('DEPENDENCY', `${command}: ${error.message}`, 3)); });
|
|
110
|
+
child.on('close', code => {
|
|
111
|
+
clearTimeout(timer);
|
|
112
|
+
if (code !== 0)
|
|
113
|
+
reject(new ProductionError('SUBPROCESS', `${command} exited ${code}: ${Buffer.concat(err).toString().slice(-4000)}`, 3));
|
|
114
|
+
else
|
|
115
|
+
resolve(bytes / 96);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
}
|
|
96
119
|
export async function videoFramePeriod(path) {
|
|
97
120
|
const data = JSON.parse((await execute('ffprobe', ['-v', 'error', '-select_streams', 'v:0', '-show_frames', '-show_entries', 'frame=best_effort_timestamp_time,duration_time', '-of', 'json', path])).toString());
|
|
98
121
|
const frames = data.frames;
|
package/dist/pipeline.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type FrameRate, type Viewport, type ProgressReporter } from './contracts.js';
|
|
2
|
+
import { type CaptionSelection } from './captions.js';
|
|
2
3
|
export type InspectInput = {
|
|
3
4
|
kind: 'storyboard';
|
|
4
5
|
storyboard: string;
|
|
@@ -15,13 +16,15 @@ export type Options = {
|
|
|
15
16
|
viewport?: Viewport;
|
|
16
17
|
fps?: FrameRate;
|
|
17
18
|
run?: string;
|
|
18
|
-
cache?: string;
|
|
19
|
+
cache?: string | false;
|
|
19
20
|
output?: string;
|
|
21
|
+
captions?: CaptionSelection;
|
|
20
22
|
resume?: boolean;
|
|
21
23
|
export?: string;
|
|
22
24
|
verify_timing?: boolean;
|
|
23
25
|
timeout_ms?: number;
|
|
24
26
|
progress?: ProgressReporter;
|
|
27
|
+
onRunResolved?: (directory: string) => void;
|
|
25
28
|
};
|
|
26
29
|
export declare function produce(options: Options): Promise<{
|
|
27
30
|
version: number;
|
|
@@ -31,6 +34,7 @@ export declare function produce(options: Options): Promise<{
|
|
|
31
34
|
warnings: string[];
|
|
32
35
|
completed_stages: string[];
|
|
33
36
|
run_id: string | undefined;
|
|
37
|
+
run_dir: string | undefined;
|
|
34
38
|
timing_status: string;
|
|
35
39
|
} | {
|
|
36
40
|
version: number;
|
|
@@ -40,6 +44,7 @@ export declare function produce(options: Options): Promise<{
|
|
|
40
44
|
warnings: string[];
|
|
41
45
|
completed_stages: string[];
|
|
42
46
|
run_id: string | undefined;
|
|
47
|
+
run_dir: string | undefined;
|
|
43
48
|
timing_status: string;
|
|
44
49
|
inspection: {
|
|
45
50
|
annotation_targets: {
|
package/dist/pipeline.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { mkdir, readdir, rm } from 'node:fs/promises';
|
|
2
|
-
import { join, resolve } from 'node:path';
|
|
2
|
+
import { dirname, join, resolve } from 'node:path';
|
|
3
3
|
import { defaultVideoOutput, defaultViewport } from './contracts.js';
|
|
4
4
|
import { loadStoryboard, fingerprint } from './storyboard.js';
|
|
5
5
|
import { presentationAdapter, ttsAdapters } from './adapters/registry.js';
|
|
6
|
-
import { generateSpeech } from './speech.js';
|
|
6
|
+
import { generateSpeech, resolveSpeechCache } from './speech.js';
|
|
7
7
|
import { resolveTiming } from './timing.js';
|
|
8
|
-
import { Run, filesIn } from './run.js';
|
|
8
|
+
import { Run, createDefaultRunDirectory, filesIn } from './run.js';
|
|
9
9
|
import { json, saveJson, execute, executionScope } from './media.js';
|
|
10
10
|
import { assemble } from './assembly.js';
|
|
11
|
+
import { writeCaptions } from './captions.js';
|
|
11
12
|
import { configuredLicense } from './executables.js';
|
|
13
|
+
import { stampFontInputFiles } from './stamp-fonts.js';
|
|
12
14
|
import { requireCondition, ProductionError } from './errors.js';
|
|
13
15
|
const baseStageTimeoutMs = 180_000;
|
|
14
16
|
function defaultStageTimeoutMs(stage, story, options) {
|
|
@@ -71,7 +73,7 @@ export async function produce(options) {
|
|
|
71
73
|
warnings.push('Slides without explicit click bounds require runtime reveal checks before recording.');
|
|
72
74
|
if ((inspection.unsupported?.length ?? 0) > 0)
|
|
73
75
|
warnings.push('Deck contains unsupported native features. Adjust the deck before production.');
|
|
74
|
-
return { version: 1, command: options.command, status: 'completed', artifacts: {}, warnings, completed_stages: [], run_id: undefined, timing_status: 'not_evaluated', inspection: { ...inspection, annotation_targets } };
|
|
76
|
+
return { version: 1, command: options.command, status: 'completed', artifacts: {}, warnings, completed_stages: [], run_id: undefined, run_dir: undefined, timing_status: 'not_evaluated', inspection: { ...inspection, annotation_targets } };
|
|
75
77
|
}
|
|
76
78
|
finally {
|
|
77
79
|
await adapter.cleanup();
|
|
@@ -107,7 +109,7 @@ export async function produce(options) {
|
|
|
107
109
|
tts.validate(voice);
|
|
108
110
|
}
|
|
109
111
|
const result = { version: 1, command: options.command, status: 'completed', artifacts: {}, warnings: story.cues.length || story.annotations.length ||
|
|
110
|
-
overlays.some(overlay => overlay.visible?.some(interval => typeof interval.start !== 'number' || typeof interval.end !== 'number')) ? ['Phrase cues require paired speech alignment at resolution.'] : [], completed_stages: [], run_id: undefined, timing_status: 'not_evaluated' };
|
|
112
|
+
overlays.some(overlay => overlay.visible?.some(interval => typeof interval.start !== 'number' || typeof interval.end !== 'number')) ? ['Phrase cues require paired speech alignment at resolution.'] : [], completed_stages: [], run_id: undefined, run_dir: undefined, timing_status: 'not_evaluated' };
|
|
111
113
|
if (story.cues.some(cue => cue.action.type === 'slide'))
|
|
112
114
|
result.warnings.push('Phrase-driven navigation requires reveal target checks after resolution.');
|
|
113
115
|
if (inspection.slides.some(slide => slide.clicks_known === false))
|
|
@@ -125,7 +127,7 @@ export async function produce(options) {
|
|
|
125
127
|
activeAdapter = undefined;
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
|
-
const inputs = [...inspection.files, ...story.media.map(media => media.src), ...overlays.map(overlay => overlay.src)];
|
|
130
|
+
const inputs = [...inspection.files, ...story.media.map(media => media.src), ...overlays.map(overlay => overlay.src), ...stampFontInputFiles(story.annotations)];
|
|
129
131
|
if (options.command === 'validate') {
|
|
130
132
|
const fingerprints = await fingerprint(source, inputs);
|
|
131
133
|
await validateOverlayAssets(fingerprints.inputs);
|
|
@@ -140,21 +142,33 @@ export async function produce(options) {
|
|
|
140
142
|
for (const overlay of assets.values())
|
|
141
143
|
await loadOverlayImage(overlay, hashes[overlay.src]);
|
|
142
144
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
const allowDefaultRun = (options.command === 'build' && !options.resume) || options.command === 'tts';
|
|
146
|
+
requireCondition(options.run || allowDefaultRun, 'RUN_REQUIRED', options.command === 'build' && options.resume ? 'build --resume requires --run' : `${options.command} requires --run`);
|
|
147
|
+
let directory;
|
|
148
|
+
if (options.run) {
|
|
149
|
+
directory = resolve(options.run);
|
|
150
|
+
if (options.command === 'build' && !options.resume) {
|
|
151
|
+
let entries = [];
|
|
152
|
+
try {
|
|
153
|
+
entries = await readdir(directory);
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
if (error.code !== 'ENOENT')
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
requireCondition(entries.length === 0, 'NEW_RUN_REQUIRED', 'build requires a new or empty directory. Use --resume for unchanged inputs.');
|
|
160
|
+
await adapter.validate(story, inspection, { viewport: options.viewport ?? defaultViewport });
|
|
149
161
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
162
|
+
await mkdir(directory, { recursive: true });
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
if (options.command === 'build') {
|
|
166
|
+
await adapter.validate(story, inspection, { viewport: options.viewport ?? defaultViewport });
|
|
153
167
|
}
|
|
154
|
-
|
|
155
|
-
await adapter.validate(story, inspection, { viewport: options.viewport ?? defaultViewport });
|
|
168
|
+
directory = await createDefaultRunDirectory();
|
|
156
169
|
}
|
|
157
|
-
|
|
170
|
+
result.run_dir = directory;
|
|
171
|
+
options.onRunResolved?.(directory);
|
|
158
172
|
lock = join(directory, '.lock');
|
|
159
173
|
try {
|
|
160
174
|
await mkdir(lock);
|
|
@@ -199,8 +213,9 @@ export async function produce(options) {
|
|
|
199
213
|
const visualPath = join(directory, 'recording/visual.json');
|
|
200
214
|
const reportPath = join(directory, 'assembly/report.json');
|
|
201
215
|
const resolveViewport = ['build', 'record', 'assemble'].includes(options.command) ? video : undefined;
|
|
216
|
+
const verifiedSpeech = new Map();
|
|
202
217
|
const resolveSchedule = async () => {
|
|
203
|
-
const schedule = await resolveTiming(story, await json(speechPath));
|
|
218
|
+
const schedule = await resolveTiming(story, await json(speechPath), verifiedSpeech);
|
|
204
219
|
await adapter.validate(story, inspection, { ...(resolveViewport ? { viewport: resolveViewport } : {}), schedule });
|
|
205
220
|
return schedule;
|
|
206
221
|
};
|
|
@@ -276,7 +291,7 @@ export async function produce(options) {
|
|
|
276
291
|
const prehashed = {};
|
|
277
292
|
const operation = async () => {
|
|
278
293
|
if (stage === 'tts') {
|
|
279
|
-
const speech = await generateSpeech(story, join(directory, 'speech'), ttsAdapters, options.cache, options.progress);
|
|
294
|
+
const speech = await generateSpeech(story, join(directory, 'speech'), ttsAdapters, resolveSpeechCache(source, options.cache), options.progress, verifiedSpeech);
|
|
280
295
|
artifacts.push(speechPath, ...speech.assets.map(asset => asset.audio));
|
|
281
296
|
}
|
|
282
297
|
if (stage === 'resolve') {
|
|
@@ -356,6 +371,39 @@ export async function produce(options) {
|
|
|
356
371
|
}
|
|
357
372
|
if (result.completed_stages.includes('assemble'))
|
|
358
373
|
result.artifacts.video = run.manifest.output;
|
|
374
|
+
const captionSelection = options.captions
|
|
375
|
+
?? (result.completed_stages.includes('assemble') && story.narration.length > 0 ? 'both' : 'none');
|
|
376
|
+
if (captionSelection !== 'none') {
|
|
377
|
+
await run.verify('tts');
|
|
378
|
+
await run.verify('resolve');
|
|
379
|
+
const schedule = await json(schedulePath);
|
|
380
|
+
const speech = await json(speechPath);
|
|
381
|
+
if (result.completed_stages.includes('assemble') && run.manifest.output) {
|
|
382
|
+
let audioOriginMs = 0;
|
|
383
|
+
try {
|
|
384
|
+
const report = await json(reportPath);
|
|
385
|
+
if (typeof report.audio_origin_ms === 'number' && Number.isFinite(report.audio_origin_ms))
|
|
386
|
+
audioOriginMs = report.audio_origin_ms;
|
|
387
|
+
}
|
|
388
|
+
catch { }
|
|
389
|
+
const externalOutput = dirname(run.manifest.output) !== directory;
|
|
390
|
+
const writeBesideOutput = !externalOutput || options.captions !== undefined;
|
|
391
|
+
const basePath = writeBesideOutput ? run.manifest.output.replace(/\.mp4$/i, '') : join(directory, 'final');
|
|
392
|
+
const written = await writeCaptions(schedule, speech, captionSelection, basePath, audioOriginMs, { protectExisting: externalOutput && writeBesideOutput });
|
|
393
|
+
if (written.vtt)
|
|
394
|
+
result.artifacts.captions_vtt = written.vtt;
|
|
395
|
+
if (written.srt)
|
|
396
|
+
result.artifacts.captions_srt = written.srt;
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
const basePath = join(directory, 'timing', 'captions');
|
|
400
|
+
const written = await writeCaptions(schedule, speech, captionSelection, basePath, 0);
|
|
401
|
+
if (written.vtt)
|
|
402
|
+
result.artifacts.captions_vtt = written.vtt;
|
|
403
|
+
if (written.srt)
|
|
404
|
+
result.artifacts.captions_srt = written.srt;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
359
407
|
if (result.completed_stages.includes('record') && result.timing_status === 'not_evaluated')
|
|
360
408
|
result.warnings.push(result.completed_stages.includes('assemble') ? 'Timing was not verified. The delivered video is ready for user review.' : 'Timing was not verified. Assemble the capture to produce the video.');
|
|
361
409
|
return result;
|
|
@@ -6,12 +6,27 @@ export interface NativePreview {
|
|
|
6
6
|
export type PreviewSession = {
|
|
7
7
|
url: string;
|
|
8
8
|
} | NativePreview;
|
|
9
|
+
export type PreviewScene = {
|
|
10
|
+
id: string;
|
|
11
|
+
slide: string;
|
|
12
|
+
start_ms: number;
|
|
13
|
+
end_ms: number;
|
|
14
|
+
};
|
|
15
|
+
export type PreviewAudioCue = {
|
|
16
|
+
segment: string;
|
|
17
|
+
start_ms: number;
|
|
18
|
+
end_ms: number;
|
|
19
|
+
url: string;
|
|
20
|
+
};
|
|
9
21
|
export type PlayerConfig = {
|
|
10
22
|
deck: string;
|
|
11
23
|
duration: number;
|
|
12
24
|
width: number;
|
|
13
25
|
height: number;
|
|
14
26
|
approximate: string[];
|
|
27
|
+
approximate_cues: string[];
|
|
28
|
+
scenes: PreviewScene[];
|
|
29
|
+
audio: PreviewAudioCue[];
|
|
15
30
|
stage: {
|
|
16
31
|
url: string;
|
|
17
32
|
} | {
|