@slidevideo/cli 0.9.0 → 0.11.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.
- package/CHANGELOG.md +10 -0
- package/README.md +1 -1
- package/addons/slidevideo/global-top.vue +15 -2
- package/addons/slidevideo/preview.ts +27 -3
- package/dist/adapters/powerpoint.js +83 -64
- package/dist/adapters/slidev-inspection.d.ts +1 -1
- package/dist/adapters/slidev-inspection.js +19 -7
- package/dist/adapters/slidev-server.js +1 -1
- package/dist/assembly.d.ts +2 -2
- package/dist/assembly.js +129 -10
- package/dist/cli.js +41 -8
- package/dist/contracts.d.ts +79 -18
- package/dist/contracts.js +6 -0
- package/dist/init.d.ts +20 -0
- package/dist/init.js +223 -0
- package/dist/pipeline.d.ts +1 -0
- package/dist/pipeline.js +56 -27
- package/dist/preview/contracts.d.ts +20 -0
- package/dist/preview/player.js +435 -14
- package/dist/preview/server.js +146 -45
- package/dist/standalone-media.d.ts +27 -0
- package/dist/standalone-media.js +201 -0
- package/dist/storyboard.d.ts +1 -0
- package/dist/storyboard.js +86 -8
- package/dist/timing.js +306 -35
- package/package.json +5 -1
- package/schemas/schedule.v1.json +67 -0
- package/schemas/storyboard.v1.json +673 -494
- package/skills/slidevideo/SKILL.md +4 -4
- package/skills/slidevideo/references/decks.md +3 -3
- package/skills/slidevideo/references/production.md +2 -2
- package/skills/slidevideo/references/storyboard.md +74 -9
- package/tools/powerpoint/powerpoint.ps1 +36 -2
package/dist/assembly.js
CHANGED
|
@@ -7,6 +7,7 @@ import { execute, executionScope, executionSignal, ffmpegFilterScriptFlags, hash
|
|
|
7
7
|
import { ProductionError, requireCondition } from './errors.js';
|
|
8
8
|
import { configuredLicense, executable } from './executables.js';
|
|
9
9
|
import { annotationApplications, verifyAnnotations } from './annotations.js';
|
|
10
|
+
import { hasStandaloneMediaSchedule, remapDeckVisualToFull, standaloneAnnotationGeometry } from './standalone-media.js';
|
|
10
11
|
const NARRATION_SAMPLE_RATE = 48000;
|
|
11
12
|
const NARRATION_CHANNELS = 2;
|
|
12
13
|
const NARRATION_BYTES_PER_SAMPLE = 4 * NARRATION_CHANNELS; // f32le stereo
|
|
@@ -102,10 +103,112 @@ async function writeNarrationTrack(destination, items, audioOrigin) {
|
|
|
102
103
|
throw error;
|
|
103
104
|
}
|
|
104
105
|
}
|
|
106
|
+
async function buildSplicedBaseVideo(schedule, visual, video, mapping, temporaryDirectory) {
|
|
107
|
+
const inputIndexes = new Map();
|
|
108
|
+
const args = ['-v', 'error', '-xerror', '-y'];
|
|
109
|
+
const inputFor = (filePath) => {
|
|
110
|
+
const existing = inputIndexes.get(filePath);
|
|
111
|
+
if (existing !== undefined)
|
|
112
|
+
return existing;
|
|
113
|
+
const index = inputIndexes.size;
|
|
114
|
+
inputIndexes.set(filePath, index);
|
|
115
|
+
args.push('-i', filePath);
|
|
116
|
+
return index;
|
|
117
|
+
};
|
|
118
|
+
const scalePad = `scale=${video.width}:${video.height}:force_original_aspect_ratio=decrease,pad=${video.width}:${video.height}:(ow-iw)/2:(oh-ih)/2:black,setsar=1`;
|
|
119
|
+
const filters = [];
|
|
120
|
+
const segments = [];
|
|
121
|
+
const windows = [];
|
|
122
|
+
let deckCursor = 0;
|
|
123
|
+
for (const scene of schedule.scenes ?? []) {
|
|
124
|
+
const sceneDurationMs = scene.end_ms - scene.start_ms;
|
|
125
|
+
if (sceneDurationMs <= 0)
|
|
126
|
+
continue;
|
|
127
|
+
if (scene.kind === 'slide') {
|
|
128
|
+
requireCondition(Boolean(visual.file), 'CAPTURE_ORIGIN', 'Assembly requires a recorded presentation capture for slide scenes', 6);
|
|
129
|
+
const deckIdx = inputFor(visual.file);
|
|
130
|
+
const deckStart = deckCursor;
|
|
131
|
+
const deckEnd = deckCursor + sceneDurationMs;
|
|
132
|
+
deckCursor = deckEnd;
|
|
133
|
+
windows.push({
|
|
134
|
+
id: scene.id,
|
|
135
|
+
slide: scene.slide,
|
|
136
|
+
full_start_ms: scene.start_ms,
|
|
137
|
+
full_end_ms: scene.end_ms,
|
|
138
|
+
deck_start_ms: deckStart,
|
|
139
|
+
deck_end_ms: deckEnd,
|
|
140
|
+
});
|
|
141
|
+
const rawStart = mapping.offset_ms + deckStart;
|
|
142
|
+
const rawEnd = mapping.offset_ms + deckEnd;
|
|
143
|
+
const clipStart = Math.max(mapping.trim_start_ms, rawStart);
|
|
144
|
+
const leadHoldSec = Math.max(0, clipStart - rawStart) / 1000;
|
|
145
|
+
const minFrameMs = 1000 / video.fps;
|
|
146
|
+
const clipEnd = Math.min(mapping.trim_end_ms, Math.max(clipStart + minFrameMs, rawEnd));
|
|
147
|
+
const sceneDurSec = sceneDurationMs / 1000;
|
|
148
|
+
const seg = `seg${segments.length}`;
|
|
149
|
+
const leadPad = leadHoldSec > 1e-6 ? `,tpad=start_mode=clone:start_duration=${leadHoldSec}` : '';
|
|
150
|
+
filters.push(`[${deckIdx}:v]trim=start=${clipStart / 1000}:end=${clipEnd / 1000},setpts=PTS-STARTPTS${leadPad},${scalePad},fps=${video.fps},tpad=stop_mode=clone:stop_duration=${sceneDurSec},trim=duration=${sceneDurSec},setpts=PTS-STARTPTS,format=yuv420p[${seg}]`);
|
|
151
|
+
segments.push(`[${seg}]`);
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
const mediaEntry = schedule.media.find(item => item.id === scene.media);
|
|
155
|
+
requireCondition(mediaEntry, 'MISSING_MEDIA', `Missing scheduled media ${scene.media}`, 7);
|
|
156
|
+
const mediaIdx = inputFor(mediaEntry.src);
|
|
157
|
+
const slices = schedule.actions
|
|
158
|
+
.filter((item) => item.scene === scene.id && item.action.type === 'play')
|
|
159
|
+
.sort((a, b) => a.start_ms - b.start_ms);
|
|
160
|
+
for (let index = 0; index < slices.length; index++) {
|
|
161
|
+
const slice = slices[index];
|
|
162
|
+
requireCondition(slice.start_ms >= scene.start_ms - 1e-6 && slice.end_ms <= scene.end_ms + 1e-6, 'MEDIA_SCENE_RANGE', `Play ${slice.id} exceeds standalone media scene ${scene.id} bounds`, 7);
|
|
163
|
+
const trimStartSec = (slice.action.trim_start_ms ?? 0) / 1000;
|
|
164
|
+
const trimEndSec = (slice.action.trim_end_ms ?? mediaEntry.duration_ms) / 1000;
|
|
165
|
+
const rate = slice.action.rate ?? 1;
|
|
166
|
+
const sliceDurSec = (slice.end_ms - slice.start_ms) / 1000;
|
|
167
|
+
const leadHoldSec = index === 0 ? Math.max(0, slice.start_ms - scene.start_ms) / 1000 : 0;
|
|
168
|
+
const nextStart = slices[index + 1]?.start_ms ?? scene.end_ms;
|
|
169
|
+
const tailHoldSec = Math.max(0, nextStart - slice.end_ms) / 1000;
|
|
170
|
+
const totalSegDurSec = leadHoldSec + sliceDurSec + tailHoldSec;
|
|
171
|
+
const seg = `seg${segments.length}`;
|
|
172
|
+
const leadPad = leadHoldSec > 1e-6 ? `,tpad=start_mode=clone:start_duration=${leadHoldSec}` : '';
|
|
173
|
+
filters.push(`[${mediaIdx}:v]trim=start=${trimStartSec}:end=${trimEndSec},setpts=(PTS-STARTPTS)/${rate},${scalePad},fps=${video.fps}${leadPad},tpad=stop_mode=clone:stop_duration=${tailHoldSec + 0.25},trim=duration=${totalSegDurSec},setpts=PTS-STARTPTS,format=yuv420p[${seg}]`);
|
|
174
|
+
segments.push(`[${seg}]`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
requireCondition(segments.length > 0, 'ASSEMBLY', 'No visual segments available for standalone media splicing', 7);
|
|
178
|
+
if (segments.length === 1) {
|
|
179
|
+
filters.push(`${segments[0]}null[v]`);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
filters.push(`${segments.join('')}concat=n=${segments.length}:v=1:a=0[v]`);
|
|
183
|
+
}
|
|
184
|
+
const filterScript = join(temporaryDirectory, 'splice-filter.txt');
|
|
185
|
+
await writeFile(filterScript, filters.join(';'));
|
|
186
|
+
const filterFlags = await ffmpegFilterScriptFlags();
|
|
187
|
+
const splicedPath = join(temporaryDirectory, 'spliced.mp4');
|
|
188
|
+
await execute('ffmpeg', [
|
|
189
|
+
...args,
|
|
190
|
+
filterFlags.complex,
|
|
191
|
+
filterScript,
|
|
192
|
+
'-map',
|
|
193
|
+
'[v]',
|
|
194
|
+
'-an',
|
|
195
|
+
'-c:v',
|
|
196
|
+
'libx264',
|
|
197
|
+
'-preset',
|
|
198
|
+
'fast',
|
|
199
|
+
'-crf',
|
|
200
|
+
'14',
|
|
201
|
+
'-pix_fmt',
|
|
202
|
+
'yuv420p',
|
|
203
|
+
splicedPath,
|
|
204
|
+
]);
|
|
205
|
+
return { file: splicedPath, windows };
|
|
206
|
+
}
|
|
105
207
|
export async function assemble(schedule, speech, visual, directory, output, options = { verify_timing: false, output: defaultVideoOutput }) {
|
|
106
208
|
const video = options.output;
|
|
107
209
|
const licensed = options.licensed ?? configuredLicense();
|
|
108
|
-
|
|
210
|
+
const standaloneOnly = visual.provenance.adapter === 'standalone-media';
|
|
211
|
+
requireCondition(visual.timing.status !== 'failed' && (!options.verify_timing || standaloneOnly || visual.timing.status === 'accepted'), 'TIMING_REQUIRED', 'Assembly cannot use failed or missing requested timing proof', 6);
|
|
109
212
|
const mapping = visual.origin?.mapping ?? (visual.timing.status === 'accepted' ? visual.timing.mapping : undefined);
|
|
110
213
|
requireCondition(mapping && Object.values(mapping).every(Number.isFinite) && mapping.trim_start_ms >= 0 && mapping.trim_end_ms > mapping.trim_start_ms, 'CAPTURE_ORIGIN', 'Assembly requires a usable capture origin', 6);
|
|
111
214
|
requireCondition(mapping.rate === 1, 'TIMING_RATE', 'Capture clock drift cannot be hidden by stretching narration', 6);
|
|
@@ -140,14 +243,30 @@ export async function assemble(schedule, speech, visual, directory, output, opti
|
|
|
140
243
|
const transformations = [];
|
|
141
244
|
const { trim_start_ms, trim_end_ms, offset_ms } = mapping;
|
|
142
245
|
const originDelta = offset_ms - trim_start_ms;
|
|
143
|
-
if (options.verify_timing)
|
|
246
|
+
if (options.verify_timing && !standaloneOnly)
|
|
144
247
|
requireCondition(originDelta >= -100 && originDelta <= 100, 'TRIM_MAPPING', 'Presentation trim differs from measured origin', 6);
|
|
145
|
-
const
|
|
146
|
-
|
|
248
|
+
const spliced = hasStandaloneMediaSchedule(schedule)
|
|
249
|
+
? await buildSplicedBaseVideo(schedule, visual, video, mapping, temporaryDirectory)
|
|
250
|
+
: undefined;
|
|
251
|
+
const baseVideoFile = spliced ? spliced.file : visual.file;
|
|
252
|
+
const audioOrigin = spliced ? 0 : Math.max(0, originDelta);
|
|
253
|
+
const pictureLeadHold = spliced ? 0 : Math.max(0, -originDelta);
|
|
147
254
|
const duration = (schedule.duration_ms + audioOrigin) / 1000;
|
|
148
|
-
const baseFilter =
|
|
255
|
+
const baseFilter = spliced
|
|
256
|
+
? `fps=${video.fps},tpad=stop_mode=clone:stop_duration=${duration},trim=duration=${duration},format=yuv420p`
|
|
257
|
+
: `trim=start=${trim_start_ms / 1000}:end=${trim_end_ms / 1000},setpts=PTS-STARTPTS,tpad=start_mode=clone:start_duration=${pictureLeadHold / 1000},fps=${video.fps},tpad=stop_mode=clone:stop_duration=${duration},trim=duration=${duration},format=yuv420p`;
|
|
149
258
|
const frameCount = Math.ceil(duration * video.fps - 1e-9);
|
|
150
|
-
const
|
|
259
|
+
const effectiveVisual = spliced
|
|
260
|
+
? {
|
|
261
|
+
...remapDeckVisualToFull(visual, spliced.windows),
|
|
262
|
+
file: baseVideoFile,
|
|
263
|
+
annotation_geometry: [
|
|
264
|
+
...(remapDeckVisualToFull(visual, spliced.windows).annotation_geometry ?? []),
|
|
265
|
+
...standaloneAnnotationGeometry(schedule, video),
|
|
266
|
+
],
|
|
267
|
+
}
|
|
268
|
+
: visual;
|
|
269
|
+
const annotations = annotationApplications(video, schedule, effectiveVisual, audioOrigin);
|
|
151
270
|
const renderer = annotations.length || schedule.overlays?.length || !licensed ? await import('./compositor.js') : undefined;
|
|
152
271
|
const layers = await renderer?.frameLayers(video, schedule, options.inputHashes) ?? [];
|
|
153
272
|
const { canvasLayers, staticTopLayers } = renderer ? renderer.splitFrameLayers(layers) : { canvasLayers: [], staticTopLayers: [] };
|
|
@@ -168,12 +287,12 @@ export async function assemble(schedule, speech, visual, directory, output, opti
|
|
|
168
287
|
let input = 1;
|
|
169
288
|
switch (plan.kind) {
|
|
170
289
|
case 'none':
|
|
171
|
-
args.push('-i',
|
|
290
|
+
args.push('-i', baseVideoFile);
|
|
172
291
|
filters.push(`[0:v]${baseFilter}[${stageOut}]`);
|
|
173
292
|
input = 1;
|
|
174
293
|
break;
|
|
175
294
|
case 'sparse':
|
|
176
|
-
args.push('-i',
|
|
295
|
+
args.push('-i', baseVideoFile);
|
|
177
296
|
args.push('-f', 'rawvideo', '-pixel_format', 'rgba', '-video_size', `${video.width}x${video.height}`, '-framerate', String(video.fps), '-i', 'pipe:0');
|
|
178
297
|
filters.push(`[0:v]${baseFilter}[base]`, `[1:v]setpts='${plan.ptsExpr}'[comp_in]`, `[base][comp_in]overlay=eof_action=pass:format=rgb:enable='${plan.betweenExpr}',format=yuv420p[${stageOut}]`);
|
|
179
298
|
input = 2;
|
|
@@ -243,7 +362,7 @@ export async function assemble(schedule, speech, visual, directory, output, opti
|
|
|
243
362
|
args.push('-c:v', 'libx264', '-preset', 'fast', '-crf', '18', '-t', String(duration), '-movflags', '+faststart');
|
|
244
363
|
let compositor;
|
|
245
364
|
if (plan.kind !== 'none') {
|
|
246
|
-
compositor = await renderer.compositeFrames(
|
|
365
|
+
compositor = await renderer.compositeFrames(baseVideoFile, baseFilter, [...args, temporary], video, annotations, plan, frameCount, audioOrigin, temporaryDirectory);
|
|
247
366
|
}
|
|
248
367
|
else {
|
|
249
368
|
await execute('ffmpeg', [...args, temporary]);
|
|
@@ -258,7 +377,7 @@ export async function assemble(schedule, speech, visual, directory, output, opti
|
|
|
258
377
|
let annotationEvidence;
|
|
259
378
|
if (annotations.length && options.verify_timing) {
|
|
260
379
|
try {
|
|
261
|
-
annotationEvidence = await verifyAnnotations(temporary,
|
|
380
|
+
annotationEvidence = await verifyAnnotations(temporary, baseVideoFile, baseFilter, annotations, video, directory, output, frame => renderer.visibleFrameLayerBounds(layers, frame, video.fps, audioOrigin, watermarkRect), outputSha256);
|
|
262
381
|
}
|
|
263
382
|
catch (error) {
|
|
264
383
|
await copyFile(temporary, join(directory, 'failed-composite.mp4'));
|
package/dist/cli.js
CHANGED
|
@@ -12,6 +12,7 @@ import { configuredLicense, withExecutables } from './executables.js';
|
|
|
12
12
|
import { setup } from './setup.js';
|
|
13
13
|
import { setupLicense } from './setup-license.js';
|
|
14
14
|
import { installSkill } from './skill-install.js';
|
|
15
|
+
import { initStoryboard } from './init.js';
|
|
15
16
|
import { notifyUpdate } from './update-check.js';
|
|
16
17
|
const commands = ['inspect', 'validate', 'play', 'tts', 'resolve', 'record', 'assemble', 'build'];
|
|
17
18
|
const documents = new Map([
|
|
@@ -60,6 +61,17 @@ skill decks Print the Slidev and PowerPoint deck-compatibility reference
|
|
|
60
61
|
current directory (and ./.claude/skills/slidevideo if .claude exists).
|
|
61
62
|
--json Print document metadata or installation results as JSON.
|
|
62
63
|
`;
|
|
64
|
+
const initHelp = `slidevideo init --deck <file> [options]
|
|
65
|
+
Create a starter slidevideo.yaml from an existing Slidev or PowerPoint deck.
|
|
66
|
+
|
|
67
|
+
--deck <file> Required .md or .pptx deck to inspect.
|
|
68
|
+
--output <file> Destination storyboard path (default: slidevideo.yaml beside the deck).
|
|
69
|
+
--provider <edge-tts|elevenlabs> Speech provider (default: edge-tts).
|
|
70
|
+
--voice <id> Voice name or ID (default: en-US-AriaNeural for edge-tts).
|
|
71
|
+
--force Overwrite an existing storyboard file.
|
|
72
|
+
--json Print structured result as JSON.
|
|
73
|
+
--quiet Suppress progress on stderr.
|
|
74
|
+
`;
|
|
63
75
|
function setupChecklist(report, licensed) {
|
|
64
76
|
const labels = {
|
|
65
77
|
ffmpeg: 'FFmpeg', ffprobe: 'ffprobe', browser: 'Chromium', python: 'Python environment',
|
|
@@ -99,7 +111,7 @@ try {
|
|
|
99
111
|
const { values, positionals } = parseArgs({ options: {
|
|
100
112
|
storyboard: { type: 'string' }, deck: { type: 'string' }, width: { type: 'string' }, height: { type: 'string' }, fps: { type: 'string' }, port: { type: 'string' }, run: { type: 'string' }, 'cache-dir': { type: 'string' }, output: { type: 'string' }, captions: { type: 'string' }, export: { type: 'string' }, 'timeout-minutes': { type: 'string' },
|
|
101
113
|
browser: { type: 'string' }, python: { type: 'string' }, ffmpeg: { type: 'string' }, ffprobe: { type: 'string' },
|
|
102
|
-
presentation: { type: 'string' }, provider: { type: 'string' }, 'voice-id': { type: 'string' }, install: { type: 'boolean' }, project: { type: 'boolean' }, manual: { type: 'boolean' },
|
|
114
|
+
presentation: { type: 'string' }, provider: { type: 'string' }, 'voice-id': { type: 'string' }, voice: { type: 'string' }, force: { type: 'boolean' }, install: { type: 'boolean' }, project: { type: 'boolean' }, manual: { type: 'boolean' },
|
|
103
115
|
license: { type: 'boolean' },
|
|
104
116
|
json: { type: 'boolean' }, quiet: { type: 'boolean' }, resume: { type: 'boolean' }, 'no-cache': { type: 'boolean' }, 'verify-timing': { type: 'boolean' }, help: { type: 'boolean', short: 'h' }, version: { type: 'boolean' },
|
|
105
117
|
}, allowPositionals: true });
|
|
@@ -116,17 +128,17 @@ try {
|
|
|
116
128
|
console.log(values.json ? JSON.stringify({ version: 1, package_version: version }) : version);
|
|
117
129
|
}
|
|
118
130
|
else if (values.help || command === 'help') {
|
|
119
|
-
const help = command === 'setup' ? setupHelp : command === 'skill' ? skillHelp : `slidevideo <setup|inspect|validate|play|tts|resolve|record|assemble|build|skill|license|impressum>
|
|
131
|
+
const help = command === 'setup' ? setupHelp : command === 'skill' ? skillHelp : command === 'init' ? initHelp : `slidevideo <setup|init|inspect|validate|play|tts|resolve|record|assemble|build|skill|license|impressum>
|
|
120
132
|
|
|
121
|
-
--storyboard <file> Required for presentation commands except assemble; inspect
|
|
122
|
-
--deck <file>
|
|
133
|
+
--storyboard <file> Required for presentation commands except assemble; inspect and init accept --deck.
|
|
134
|
+
--deck <file> Deck file (.md or .pptx) for inspect or init before a storyboard exists.
|
|
123
135
|
--width/--height <px> Even viewport or output size (default: 1920x1080; PPTX inspect --deck uses slide size).
|
|
124
136
|
--fps <15|24|30|60> Output frame rate for record, assemble, or build (default: 30).
|
|
125
137
|
--run <directory> Run directory (default: runs/YYYYMMDD-HHmmss for build and tts; required for resolve, record, assemble, and build --resume).
|
|
126
138
|
--cache-dir <dir> Speech cache directory for play, tts, or build (default: .slidevideo/speech beside storyboard).
|
|
127
139
|
--no-cache Disable speech cache reading and writing for play, tts, or build.
|
|
128
140
|
--port <number> Local play server port (default: auto).
|
|
129
|
-
--output <file>
|
|
141
|
+
--output <file> Output path: new final MP4 for assemble/build, or storyboard path for init.
|
|
130
142
|
--captions <vtt|srt|both|none> Caption export (default: both for build/assemble with narration; optional for resolve).
|
|
131
143
|
--resume Reuse intact build stages with matching inputs and mode.
|
|
132
144
|
--verify-timing Opt in to decoded timing proof for build or record; assemble checks the recorded mode.
|
|
@@ -138,8 +150,9 @@ try {
|
|
|
138
150
|
--version Package version.
|
|
139
151
|
|
|
140
152
|
setup prepares shared tools and speech providers, and detects Slidev and native PowerPoint support (see setup --help).
|
|
153
|
+
init --deck <file> creates a starter slidevideo.yaml from slide structure and speaker notes (see init --help).
|
|
141
154
|
Normal production leaves timing unevaluated and the video for user review.
|
|
142
|
-
inspect lists slide targets, click counts, media IDs and annotation targets from --deck or --storyboard without recording.
|
|
155
|
+
inspect lists slide targets, click counts, speaker notes, media IDs and annotation targets from --deck or --storyboard without recording.
|
|
143
156
|
validate checks inputs without recording.
|
|
144
157
|
play --storyboard <file> serves slides and annotations (with cached audio when available) with Play, Pause and Replay. Ctrl+C stops the server.
|
|
145
158
|
skill displays or registers (--install) the bundled coding-agent skill; see skill --help for references and options.
|
|
@@ -169,12 +182,32 @@ impressum displays the provider's contact details.
|
|
|
169
182
|
const result = { version: 1, command, document, path: command === 'skill' ? path : undefined };
|
|
170
183
|
process.stdout.write(values.json ? JSON.stringify(result) + '\n' : document);
|
|
171
184
|
}
|
|
185
|
+
else if (command === 'init') {
|
|
186
|
+
requireCondition(positionals.length === 1 && Object.keys(values).every(key => ['deck', 'output', 'provider', 'voice', 'force', 'json', 'quiet', 'browser', 'python', 'ffmpeg', 'ffprobe'].includes(key)), 'OPTION', 'Run slidevideo init --help for init options');
|
|
187
|
+
requireCondition(values.deck !== undefined && values.deck.trim().length > 0, 'OPTION', 'init requires --deck <file>');
|
|
188
|
+
requireCondition(values.output === undefined || values.output.trim().length > 0, 'OPTION', '--output requires a file path');
|
|
189
|
+
const result = await withExecutables(values, () => initStoryboard({
|
|
190
|
+
deck: values.deck,
|
|
191
|
+
output: values.output,
|
|
192
|
+
provider: values.provider,
|
|
193
|
+
voice: values.voice,
|
|
194
|
+
force: values.force,
|
|
195
|
+
}));
|
|
196
|
+
if (values.json)
|
|
197
|
+
console.log(JSON.stringify(result));
|
|
198
|
+
else {
|
|
199
|
+
console.log(`Created ${result.output} (${result.slides} slide${result.slides === 1 ? '' : 's'}, ${result.narrated_slides} narrated).`);
|
|
200
|
+
for (const warning of result.warnings)
|
|
201
|
+
console.log(`Warning: ${warning}`);
|
|
202
|
+
console.log(`Next steps:\n slidevideo play --storyboard ${result.output}\n slidevideo build --storyboard ${result.output}`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
172
205
|
else if (command === 'setup' && values.license) {
|
|
173
206
|
requireCondition(positionals.length === 1 && Object.keys(values).every(key => key === 'license'), 'OPTION', 'Use slidevideo setup --license by itself in a terminal.');
|
|
174
207
|
await withExecutables({}, setupLicense);
|
|
175
208
|
}
|
|
176
209
|
else if (command === 'setup') {
|
|
177
|
-
requireCondition(positionals.length === 1 && !['storyboard', 'deck', 'width', 'height', 'fps', 'port', 'run', 'cache-dir', 'no-cache', 'output', 'captions', 'export', 'timeout-minutes', 'resume', 'verify-timing', 'project'].some(key => key in values), 'OPTION', 'Run slidevideo setup --help for setup options');
|
|
210
|
+
requireCondition(positionals.length === 1 && !['storyboard', 'deck', 'width', 'height', 'fps', 'port', 'run', 'cache-dir', 'no-cache', 'output', 'captions', 'export', 'timeout-minutes', 'resume', 'verify-timing', 'project', 'voice', 'force'].some(key => key in values), 'OPTION', 'Run slidevideo setup --help for setup options');
|
|
178
211
|
let initialChecklist;
|
|
179
212
|
const report = await withExecutables(values, () => setup(values, current => {
|
|
180
213
|
initialChecklist = setupChecklist(current, configuredLicense());
|
|
@@ -227,7 +260,7 @@ impressum displays the provider's contact details.
|
|
|
227
260
|
else {
|
|
228
261
|
requireCondition(commands.includes(command) && positionals.length === 1, 'COMMAND', 'Run slidevideo --help for available commands');
|
|
229
262
|
requireCondition(!values.project, 'OPTION', '--project requires slidevideo skill --install');
|
|
230
|
-
requireCondition(!['presentation', 'provider', 'voice-id', 'install', 'manual', 'license'].some(key => key in values), 'OPTION', 'Presentation, provider, voice
|
|
263
|
+
requireCondition(!['presentation', 'provider', 'voice-id', 'voice', 'force', 'install', 'manual', 'license'].some(key => key in values), 'OPTION', 'Presentation, provider, voice, force, install and license options require setup or init');
|
|
231
264
|
let timeout;
|
|
232
265
|
if (values['timeout-minutes'] !== undefined) {
|
|
233
266
|
const raw = values['timeout-minutes'].trim();
|
package/dist/contracts.d.ts
CHANGED
|
@@ -9,15 +9,8 @@ export type Narration = {
|
|
|
9
9
|
text: string;
|
|
10
10
|
voice?: Voice;
|
|
11
11
|
};
|
|
12
|
-
export type
|
|
13
|
-
|
|
14
|
-
target: string;
|
|
15
|
-
duration_ms: number;
|
|
16
|
-
} | {
|
|
17
|
-
type: 'reveal';
|
|
18
|
-
click: number;
|
|
19
|
-
duration_ms: number;
|
|
20
|
-
} | {
|
|
12
|
+
export type PlayOverflow = 'continuous' | 'freeze' | 'fit_video';
|
|
13
|
+
export type PlayAction = {
|
|
21
14
|
type: 'play';
|
|
22
15
|
media: string;
|
|
23
16
|
audio: 'source' | 'muted';
|
|
@@ -25,11 +18,24 @@ export type VisualAction = {
|
|
|
25
18
|
trim_start_ms?: number;
|
|
26
19
|
trim_end_ms?: number;
|
|
27
20
|
rate?: number;
|
|
21
|
+
overflow?: PlayOverflow;
|
|
22
|
+
min_rate?: number;
|
|
23
|
+
max_rate?: number;
|
|
28
24
|
};
|
|
29
|
-
export type
|
|
25
|
+
export type SpeakAction = {
|
|
30
26
|
type: 'speak';
|
|
31
27
|
segment: string;
|
|
28
|
+
};
|
|
29
|
+
export type VisualAction = {
|
|
30
|
+
type: 'slide';
|
|
31
|
+
target: string;
|
|
32
|
+
duration_ms: number;
|
|
32
33
|
} | {
|
|
34
|
+
type: 'reveal';
|
|
35
|
+
click: number;
|
|
36
|
+
duration_ms: number;
|
|
37
|
+
} | PlayAction;
|
|
38
|
+
export type Action = (VisualAction | SpeakAction | {
|
|
33
39
|
type: 'hold';
|
|
34
40
|
duration_ms: number;
|
|
35
41
|
}) & {
|
|
@@ -42,10 +48,33 @@ export type PhraseCue = {
|
|
|
42
48
|
boundary: 'start' | 'end';
|
|
43
49
|
offset_ms: number;
|
|
44
50
|
};
|
|
51
|
+
export type MediaCue = {
|
|
52
|
+
media: string;
|
|
53
|
+
time_ms: number;
|
|
54
|
+
play?: string;
|
|
55
|
+
offset_ms?: number;
|
|
56
|
+
};
|
|
57
|
+
export type PhraseAlign = {
|
|
58
|
+
phrase: string;
|
|
59
|
+
occurrence?: number;
|
|
60
|
+
boundary: 'start' | 'end';
|
|
61
|
+
offset_ms?: number;
|
|
62
|
+
};
|
|
45
63
|
export type Cue = {
|
|
46
64
|
id: string;
|
|
47
65
|
at: PhraseCue;
|
|
48
66
|
action: VisualAction;
|
|
67
|
+
align?: never;
|
|
68
|
+
} | {
|
|
69
|
+
id: string;
|
|
70
|
+
at: MediaCue;
|
|
71
|
+
action: VisualAction;
|
|
72
|
+
align?: never;
|
|
73
|
+
} | {
|
|
74
|
+
id: string;
|
|
75
|
+
at: MediaCue;
|
|
76
|
+
action: SpeakAction;
|
|
77
|
+
align?: PhraseAlign;
|
|
49
78
|
};
|
|
50
79
|
export type Rectangle = {
|
|
51
80
|
x: number;
|
|
@@ -102,7 +131,7 @@ export type WordFollowTiming = {
|
|
|
102
131
|
tokens?: WordFollowTokenMap[];
|
|
103
132
|
};
|
|
104
133
|
export type AnnotationTiming = {
|
|
105
|
-
at: number | PhraseCue;
|
|
134
|
+
at: number | PhraseCue | MediaCue;
|
|
106
135
|
duration_ms: number;
|
|
107
136
|
follow?: never;
|
|
108
137
|
} | {
|
|
@@ -481,21 +510,37 @@ export type ResolvedOverlay = Pick<ImageOverlay, 'id' | 'src' | 'box' | 'opacity
|
|
|
481
510
|
end_ms: number;
|
|
482
511
|
}[];
|
|
483
512
|
};
|
|
513
|
+
export type MediaSceneAction = (PlayAction | SpeakAction | {
|
|
514
|
+
type: 'hold';
|
|
515
|
+
duration_ms: number;
|
|
516
|
+
}) & {
|
|
517
|
+
id: string;
|
|
518
|
+
};
|
|
519
|
+
export type SlideScene = {
|
|
520
|
+
id: string;
|
|
521
|
+
slide: string;
|
|
522
|
+
media?: never;
|
|
523
|
+
duration_ms?: number;
|
|
524
|
+
actions: Action[];
|
|
525
|
+
};
|
|
526
|
+
export type MediaScene = {
|
|
527
|
+
id: string;
|
|
528
|
+
media: string;
|
|
529
|
+
slide?: never;
|
|
530
|
+
duration_ms?: number;
|
|
531
|
+
actions: MediaSceneAction[];
|
|
532
|
+
};
|
|
533
|
+
export type Scene = SlideScene | MediaScene;
|
|
484
534
|
export type Storyboard = {
|
|
485
535
|
version: 1;
|
|
486
|
-
deck
|
|
536
|
+
deck?: string;
|
|
487
537
|
voice?: Voice;
|
|
488
538
|
media: {
|
|
489
539
|
id: string;
|
|
490
540
|
src: string;
|
|
491
541
|
}[];
|
|
492
542
|
narration: Narration[];
|
|
493
|
-
scenes:
|
|
494
|
-
id: string;
|
|
495
|
-
slide: string;
|
|
496
|
-
duration_ms?: number;
|
|
497
|
-
actions: Action[];
|
|
498
|
-
}[];
|
|
543
|
+
scenes: Scene[];
|
|
499
544
|
cues: Cue[];
|
|
500
545
|
annotations: Annotation[];
|
|
501
546
|
overlays?: ImageOverlay[];
|
|
@@ -552,9 +597,23 @@ export type ScheduledAction = {
|
|
|
552
597
|
form: string;
|
|
553
598
|
};
|
|
554
599
|
};
|
|
600
|
+
export type ScheduleScene = {
|
|
601
|
+
id: string;
|
|
602
|
+
kind: 'slide';
|
|
603
|
+
slide: string;
|
|
604
|
+
start_ms: number;
|
|
605
|
+
end_ms: number;
|
|
606
|
+
} | {
|
|
607
|
+
id: string;
|
|
608
|
+
kind: 'media';
|
|
609
|
+
media: string;
|
|
610
|
+
start_ms: number;
|
|
611
|
+
end_ms: number;
|
|
612
|
+
};
|
|
555
613
|
export type Schedule = {
|
|
556
614
|
version: 1;
|
|
557
615
|
duration_ms: number;
|
|
616
|
+
scenes?: ScheduleScene[];
|
|
558
617
|
actions: ScheduledAction[];
|
|
559
618
|
media: {
|
|
560
619
|
id: string;
|
|
@@ -649,6 +708,7 @@ export interface TtsAdapter {
|
|
|
649
708
|
validate(voice: Voice): void;
|
|
650
709
|
synthesize(segment: Narration, voice: Voice, destination: string): Promise<Omit<SpeechAsset, 'key'>>;
|
|
651
710
|
}
|
|
711
|
+
export declare function normalizeSpeakerNotes(raw: string | null | undefined): string | undefined;
|
|
652
712
|
export type PresentationInspection = {
|
|
653
713
|
dimensions?: Viewport;
|
|
654
714
|
slides: {
|
|
@@ -660,6 +720,7 @@ export type PresentationInspection = {
|
|
|
660
720
|
transition_duration_ms?: number;
|
|
661
721
|
entry_duration_ms?: number;
|
|
662
722
|
click_durations_ms?: number[];
|
|
723
|
+
notes?: string;
|
|
663
724
|
}[];
|
|
664
725
|
media_ids: string[];
|
|
665
726
|
media?: {
|
package/dist/contracts.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
export const defaultViewport = { width: 1920, height: 1080 };
|
|
2
2
|
export const defaultVideoOutput = { width: 1920, height: 1080, fps: 30 };
|
|
3
|
+
export function normalizeSpeakerNotes(raw) {
|
|
4
|
+
if (typeof raw !== 'string')
|
|
5
|
+
return undefined;
|
|
6
|
+
const normalized = raw.replace(/\r\n?/g, '\n').trim();
|
|
7
|
+
return normalized.length > 0 ? normalized : undefined;
|
|
8
|
+
}
|
package/dist/init.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Voice } from './contracts.js';
|
|
2
|
+
export type InitOptions = {
|
|
3
|
+
deck: string;
|
|
4
|
+
output?: string;
|
|
5
|
+
provider?: string;
|
|
6
|
+
voice?: string;
|
|
7
|
+
force?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type InitResult = {
|
|
10
|
+
version: 1;
|
|
11
|
+
command: 'init';
|
|
12
|
+
status: 'completed';
|
|
13
|
+
deck: string;
|
|
14
|
+
output: string;
|
|
15
|
+
slides: number;
|
|
16
|
+
narrated_slides: number;
|
|
17
|
+
voice: Voice;
|
|
18
|
+
warnings: string[];
|
|
19
|
+
};
|
|
20
|
+
export declare function initStoryboard(options: InitOptions): Promise<InitResult>;
|