@slidevideo/cli 0.2.0 → 0.2.1
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 +7 -0
- package/README.md +2 -2
- package/addons/slidevideo/geometry.ts +63 -30
- package/addons/slidevideo/global-top.vue +41 -9
- package/addons/slidevideo/playback-entries.ts +16 -5
- package/addons/slidevideo/preview.ts +26 -14
- package/dist/adapters/powerpoint.d.ts +7 -4
- package/dist/adapters/powerpoint.js +116 -26
- package/dist/adapters/slidev-inspection.d.ts +5 -2
- package/dist/adapters/slidev-inspection.js +3 -2
- package/dist/adapters/slidev.d.ts +3 -4
- package/dist/adapters/slidev.js +20 -19
- package/dist/annotation-paint.d.ts +65 -11
- package/dist/annotation-paint.js +290 -10
- package/dist/annotations.d.ts +13 -8
- package/dist/annotations.js +619 -88
- package/dist/assembly.d.ts +4 -2
- package/dist/assembly.js +23 -18
- package/dist/cli.js +102 -16
- package/dist/compositor.d.ts +10 -5
- package/dist/compositor.js +215 -128
- package/dist/contracts.d.ts +91 -30
- package/dist/contracts.js +2 -1
- package/dist/media.d.ts +5 -0
- package/dist/media.js +30 -0
- package/dist/pipeline.d.ts +35 -9
- package/dist/pipeline.js +62 -10
- package/dist/preview/contracts.d.ts +3 -3
- package/dist/preview/player.js +20 -15
- package/dist/preview/server.d.ts +2 -1
- package/dist/preview/server.js +6 -5
- package/dist/setup.d.ts +3 -0
- package/dist/setup.js +16 -1
- package/dist/skill-install.d.ts +35 -0
- package/dist/skill-install.js +132 -0
- package/dist/storyboard.js +9 -0
- package/package.json +4 -1
- package/schemas/annotation-geometry.v1.json +260 -28
- package/schemas/run-manifest.v1.json +31 -0
- package/schemas/schedule.v1.json +448 -182
- package/schemas/storyboard.v1.json +358 -174
- package/skills/slidevideo/SKILL.md +11 -9
- package/skills/slidevideo/references/decks.md +228 -0
- package/skills/slidevideo/references/production.md +14 -10
- package/skills/slidevideo/references/storyboard.md +65 -33
- package/tools/powerpoint/powerpoint.ps1 +52 -41
- package/tools/powerpoint/preview.ps1 +5 -5
package/dist/assembly.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Schedule, type SpeechManifest, type VisualArtifact, type ProductionOptions } from './contracts.js';
|
|
2
2
|
type AssemblyOptions = ProductionOptions & {
|
|
3
3
|
licensed?: boolean;
|
|
4
4
|
inputHashes?: Record<string, string>;
|
|
5
5
|
onOutputReserved?: () => Promise<void>;
|
|
6
6
|
};
|
|
7
|
-
export declare function assemble(
|
|
7
|
+
export declare function assemble(schedule: Schedule, speech: SpeechManifest, visual: VisualArtifact, directory: string, output: string, options?: AssemblyOptions): Promise<{
|
|
8
8
|
report: {
|
|
9
9
|
output_origin_delta_ms: number;
|
|
10
10
|
audio_origin_ms: number;
|
|
@@ -20,6 +20,7 @@ export declare function assemble(story: Storyboard, schedule: Schedule, speech:
|
|
|
20
20
|
version: string;
|
|
21
21
|
frames: number;
|
|
22
22
|
composited_frames: number;
|
|
23
|
+
readback_frames: number;
|
|
23
24
|
mode: string;
|
|
24
25
|
} | undefined;
|
|
25
26
|
base_capture_timing?: "accepted" | "not_evaluated" | undefined;
|
|
@@ -27,6 +28,7 @@ export declare function assemble(story: Storyboard, schedule: Schedule, speech:
|
|
|
27
28
|
final_composite?: {
|
|
28
29
|
source: string;
|
|
29
30
|
target_ms: number;
|
|
31
|
+
coverage: string[];
|
|
30
32
|
checks: Record<string, unknown>[];
|
|
31
33
|
gaps: string[];
|
|
32
34
|
sha256: string;
|
package/dist/assembly.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { join, dirname } from 'node:path';
|
|
2
|
-
import { lstat, mkdir, mkdtemp, link, rm, copyFile } from 'node:fs/promises';
|
|
3
|
-
import {
|
|
2
|
+
import { lstat, mkdir, mkdtemp, link, rm, copyFile, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { defaultVideoOutput } from './contracts.js';
|
|
4
|
+
import { execute, ffmpegFilterScriptFlags, hashFile, probe, decode, saveJson } from './media.js';
|
|
4
5
|
import { requireCondition } from './errors.js';
|
|
5
6
|
import { configuredLicense } from './executables.js';
|
|
6
7
|
import { annotationApplications, verifyAnnotations } from './annotations.js';
|
|
7
|
-
export async function assemble(
|
|
8
|
+
export async function assemble(schedule, speech, visual, directory, output, options = { verify_timing: false, output: defaultVideoOutput }) {
|
|
9
|
+
const video = options.output;
|
|
8
10
|
const licensed = options.licensed ?? configuredLicense();
|
|
9
11
|
requireCondition(visual.timing.status !== 'failed' && (!options.verify_timing || visual.timing.status === 'accepted'), 'TIMING_REQUIRED', 'Assembly cannot use failed or missing requested timing proof', 6);
|
|
10
12
|
const mapping = visual.origin?.mapping ?? (visual.timing.status === 'accepted' ? visual.timing.mapping : undefined);
|
|
@@ -46,17 +48,17 @@ export async function assemble(story, schedule, speech, visual, directory, outpu
|
|
|
46
48
|
const audioOrigin = Math.max(0, originDelta);
|
|
47
49
|
const pictureLeadHold = Math.max(0, -originDelta);
|
|
48
50
|
const duration = (schedule.duration_ms + audioOrigin) / 1000;
|
|
49
|
-
const baseFilter = `trim=start=${trim_start_ms / 1000}:end=${trim_end_ms / 1000},setpts=PTS-STARTPTS,tpad=start_mode=clone:start_duration=${pictureLeadHold / 1000},fps=${
|
|
50
|
-
const frameCount = Math.ceil(duration *
|
|
51
|
-
const annotations = annotationApplications(
|
|
51
|
+
const baseFilter = `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`;
|
|
52
|
+
const frameCount = Math.ceil(duration * video.fps - 1e-9);
|
|
53
|
+
const annotations = annotationApplications(video, schedule, visual, audioOrigin);
|
|
52
54
|
const renderer = annotations.length || schedule.overlays?.length || !licensed ? await import('./compositor.js') : undefined;
|
|
53
|
-
const layers = await renderer?.frameLayers(
|
|
55
|
+
const layers = await renderer?.frameLayers(video, schedule, licensed, options.inputHashes) ?? [];
|
|
54
56
|
const { canvasLayers, staticTopLayers } = renderer ? renderer.splitFrameLayers(layers) : { canvasLayers: [], staticTopLayers: [] };
|
|
55
|
-
const plan = renderer ? renderer.planCompositor(frameCount,
|
|
57
|
+
const plan = renderer ? renderer.planCompositor(frameCount, video.fps, audioOrigin, annotations, canvasLayers) : { kind: 'none' };
|
|
56
58
|
let layerImage;
|
|
57
59
|
if (staticTopLayers.length) {
|
|
58
60
|
layerImage = join(temporaryDirectory, 'overlays.png');
|
|
59
|
-
await renderer.writeStaticFrameLayers(layerImage,
|
|
61
|
+
await renderer.writeStaticFrameLayers(layerImage, video, staticTopLayers);
|
|
60
62
|
}
|
|
61
63
|
let input = 1;
|
|
62
64
|
switch (plan.kind) {
|
|
@@ -74,19 +76,19 @@ export async function assemble(story, schedule, speech, visual, directory, outpu
|
|
|
74
76
|
break;
|
|
75
77
|
case 'sparse':
|
|
76
78
|
args.push('-i', visual.file);
|
|
77
|
-
args.push('-f', 'rawvideo', '-pixel_format', 'rgba', '-video_size', `${
|
|
79
|
+
args.push('-f', 'rawvideo', '-pixel_format', 'rgba', '-video_size', `${video.width}x${video.height}`, '-framerate', String(video.fps), '-i', 'pipe:0');
|
|
78
80
|
if (layerImage) {
|
|
79
81
|
args.push('-i', layerImage);
|
|
80
|
-
filters.push(`[0:v]${baseFilter}[base]`, `[1:v]setpts='${plan.ptsExpr}'[comp_in]`, `[base][comp_in]overlay=eof_action=pass:enable='${plan.betweenExpr}'[comp]`, '[comp][2:v]overlay=eof_action=repeat,format=yuv420p[v]');
|
|
82
|
+
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}'[comp]`, '[comp][2:v]overlay=eof_action=repeat,format=yuv420p[v]');
|
|
81
83
|
input = 3;
|
|
82
84
|
}
|
|
83
85
|
else {
|
|
84
|
-
filters.push(`[0:v]${baseFilter}[base]`, `[1:v]setpts='${plan.ptsExpr}'[comp_in]`, `[base][comp_in]overlay=eof_action=pass:enable='${plan.betweenExpr}',format=yuv420p[v]`);
|
|
86
|
+
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[v]`);
|
|
85
87
|
input = 2;
|
|
86
88
|
}
|
|
87
89
|
break;
|
|
88
90
|
case 'full':
|
|
89
|
-
args.push('-f', 'rawvideo', '-pixel_format', 'rgba', '-video_size', `${
|
|
91
|
+
args.push('-f', 'rawvideo', '-pixel_format', 'rgba', '-video_size', `${video.width}x${video.height}`, '-framerate', String(video.fps), '-i', 'pipe:0');
|
|
90
92
|
if (layerImage) {
|
|
91
93
|
args.push('-i', layerImage);
|
|
92
94
|
filters.push('[0:v]format=yuv420p[base]', '[base][1:v]overlay=eof_action=repeat,format=yuv420p[v]');
|
|
@@ -126,28 +128,31 @@ export async function assemble(story, schedule, speech, visual, directory, outpu
|
|
|
126
128
|
}
|
|
127
129
|
if (tracks.length)
|
|
128
130
|
filters.push(`${tracks.join('')}amix=inputs=${tracks.length}:normalize=0,apad,atrim=duration=${duration}[a]`);
|
|
129
|
-
|
|
131
|
+
const filterScript = join(temporaryDirectory, 'filter-complex.txt');
|
|
132
|
+
await writeFile(filterScript, filters.join(';'));
|
|
133
|
+
const filterFlags = await ffmpegFilterScriptFlags();
|
|
134
|
+
args.push(filterFlags.complex, filterScript, '-map', '[v]');
|
|
130
135
|
if (tracks.length)
|
|
131
136
|
args.push('-map', '[a]', '-c:a', 'aac', '-b:a', '192k', '-ar', '48000');
|
|
132
137
|
args.push('-c:v', 'libx264', '-preset', 'fast', '-crf', '18', '-t', String(duration), '-movflags', '+faststart');
|
|
133
138
|
let compositor;
|
|
134
139
|
if (plan.kind !== 'none') {
|
|
135
|
-
compositor = await renderer.compositeFrames(visual.file, baseFilter, [...args, temporary],
|
|
140
|
+
compositor = await renderer.compositeFrames(visual.file, baseFilter, [...args, temporary], video, annotations, plan, frameCount, audioOrigin, temporaryDirectory);
|
|
136
141
|
}
|
|
137
142
|
else {
|
|
138
143
|
await execute('ffmpeg', [...args, temporary]);
|
|
139
144
|
if (annotations.length)
|
|
140
|
-
compositor = { renderer: 'canvas-skia', version: '1.1.1', frames: frameCount, composited_frames: 0, mode: 'none' };
|
|
145
|
+
compositor = { renderer: 'canvas-skia', version: '1.1.1', frames: frameCount, composited_frames: 0, readback_frames: 0, mode: 'none' };
|
|
141
146
|
}
|
|
142
147
|
if (options.verify_timing)
|
|
143
148
|
await decode(temporary);
|
|
144
149
|
const properties = await probe(temporary);
|
|
145
|
-
requireCondition(properties.width ===
|
|
150
|
+
requireCondition(properties.width === video.width && properties.height === video.height && properties.has_audio === (tracks.length > 0) && Math.abs(properties.duration_ms - duration * 1000) <= 100, 'OUTPUT_MEDIA', 'Final media properties do not match the schedule', 7);
|
|
146
151
|
const outputSha256 = await hashFile(temporary);
|
|
147
152
|
let annotationEvidence;
|
|
148
153
|
if (annotations.length && options.verify_timing) {
|
|
149
154
|
try {
|
|
150
|
-
annotationEvidence = await verifyAnnotations(temporary, visual.file, baseFilter, annotations,
|
|
155
|
+
annotationEvidence = await verifyAnnotations(temporary, visual.file, baseFilter, annotations, video, directory, output, frame => renderer.visibleFrameLayerBounds(layers, frame, video.fps, audioOrigin), outputSha256);
|
|
151
156
|
}
|
|
152
157
|
catch (error) {
|
|
153
158
|
await copyFile(temporary, join(directory, 'failed-composite.mp4'));
|
package/dist/cli.js
CHANGED
|
@@ -11,6 +11,7 @@ import { packagePath, userConfigFile } from './installation.js';
|
|
|
11
11
|
import { configuredLicense, withExecutables } from './executables.js';
|
|
12
12
|
import { setup } from './setup.js';
|
|
13
13
|
import { setupLicense } from './setup-license.js';
|
|
14
|
+
import { installSkill } from './skill-install.js';
|
|
14
15
|
import { notifyUpdate } from './update-check.js';
|
|
15
16
|
const commands = ['inspect', 'validate', 'play', 'tts', 'resolve', 'record', 'assemble', 'build'];
|
|
16
17
|
const documents = new Map([
|
|
@@ -19,20 +20,46 @@ const documents = new Map([
|
|
|
19
20
|
['skill', 'skills/slidevideo/SKILL.md'],
|
|
20
21
|
['skill storyboard', 'skills/slidevideo/references/storyboard.md'],
|
|
21
22
|
['skill production', 'skills/slidevideo/references/production.md'],
|
|
23
|
+
['skill decks', 'skills/slidevideo/references/decks.md'],
|
|
22
24
|
]);
|
|
23
25
|
const setupHelp = `slidevideo setup [options]
|
|
24
26
|
Check this installation and configure tools and speech providers.
|
|
25
27
|
|
|
26
|
-
--manual
|
|
27
|
-
--install
|
|
28
|
-
--
|
|
29
|
-
--
|
|
28
|
+
--manual Show status and next steps without prompts or installation.
|
|
29
|
+
--install Install supported missing tools (required in non-interactive shells).
|
|
30
|
+
--presentation <slidev|powerpoint> Scope checks and --install to one presentation runtime.
|
|
31
|
+
--provider <edge-tts|elevenlabs> Scope checks and setup to one speech provider.
|
|
32
|
+
--voice-id <id> Include a selected voice ID in --json output with --provider.
|
|
33
|
+
--license Manage license activation in an interactive terminal.
|
|
34
|
+
--json Print detailed status as JSON.
|
|
35
|
+
--quiet Suppress progress on stderr.
|
|
30
36
|
|
|
31
37
|
Custom tool paths:
|
|
32
38
|
--browser <path> --python <path> --ffmpeg <path> --ffprobe <path>
|
|
33
39
|
|
|
40
|
+
Non-interactive ElevenLabs credentials:
|
|
41
|
+
Set ELEVENLABS_API_KEY in the environment or a mode-600 .env file, or set
|
|
42
|
+
"elevenlabs_api_key" in the per-user config file reported by setup --manual --json.
|
|
43
|
+
|
|
44
|
+
Coding-agent skill:
|
|
45
|
+
Run slidevideo skill --install to register the bundled skill in ~/.agents/skills/slidevideo.
|
|
46
|
+
|
|
34
47
|
Exit codes: 0 ready, 3 missing prerequisites.
|
|
35
48
|
`;
|
|
49
|
+
const skillHelp = `slidevideo skill [storyboard|production|decks] [options]
|
|
50
|
+
Display or register the bundled SlideVideo skill for coding agents.
|
|
51
|
+
|
|
52
|
+
skill Print the main SKILL.md authoring and production instructions.
|
|
53
|
+
skill storyboard Print the storyboard YAML field and timing reference.
|
|
54
|
+
skill production Print the CLI operation, caching, and diagnostics reference.
|
|
55
|
+
skill decks Print the Slidev and PowerPoint deck-compatibility reference.
|
|
56
|
+
|
|
57
|
+
--install Link the bundled skill into ~/.agents/skills/slidevideo
|
|
58
|
+
(and ~/.claude/skills/slidevideo when Claude Code is detected).
|
|
59
|
+
--project With --install, link into ./.agents/skills/slidevideo in the
|
|
60
|
+
current directory (and ./.claude/skills/slidevideo if .claude exists).
|
|
61
|
+
--json Print document metadata or installation results as JSON.
|
|
62
|
+
`;
|
|
36
63
|
function setupChecklist(report, licensed) {
|
|
37
64
|
const labels = {
|
|
38
65
|
ffmpeg: 'FFmpeg', ffprobe: 'ffprobe', browser: 'Chromium', python: 'Python environment',
|
|
@@ -55,6 +82,12 @@ function setupChecklist(report, licensed) {
|
|
|
55
82
|
group('Native PowerPoint', report.presentations.powerpoint);
|
|
56
83
|
group('Edge TTS', report.providers['edge-tts'], report.providers['edge-tts']?.deferred);
|
|
57
84
|
group('ElevenLabs', report.providers.elevenlabs, report.providers.elevenlabs?.deferred);
|
|
85
|
+
const skillState = report.skill.status === 'installed'
|
|
86
|
+
? 'installed'
|
|
87
|
+
: report.skill.targets.some(target => target.status === 'broken' || target.status === 'outdated')
|
|
88
|
+
? 'needs refresh'
|
|
89
|
+
: 'not installed';
|
|
90
|
+
lines.push(` [${report.skill.status === 'installed' ? '✓' : 'X'}] Agent skill ${skillState}`);
|
|
58
91
|
lines.push(` [${licensed ? '✓' : 'X'}] License ${licensed ? 'active' : 'not active'}`);
|
|
59
92
|
return lines.join('\n');
|
|
60
93
|
}
|
|
@@ -64,9 +97,9 @@ let previewReady = false;
|
|
|
64
97
|
let runDirectory;
|
|
65
98
|
try {
|
|
66
99
|
const { values, positionals } = parseArgs({ options: {
|
|
67
|
-
storyboard: { type: 'string' }, port: { type: 'string' }, run: { type: 'string' }, 'cache-dir': { type: 'string' }, output: { type: 'string' }, export: { type: 'string' }, 'timeout-minutes': { type: 'string' },
|
|
100
|
+
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' }, export: { type: 'string' }, 'timeout-minutes': { type: 'string' },
|
|
68
101
|
browser: { type: 'string' }, python: { type: 'string' }, ffmpeg: { type: 'string' }, ffprobe: { type: 'string' },
|
|
69
|
-
presentation: { type: 'string' }, provider: { type: 'string' }, 'voice-id': { type: 'string' }, install: { type: 'boolean' }, manual: { type: 'boolean' },
|
|
102
|
+
presentation: { type: 'string' }, provider: { type: 'string' }, 'voice-id': { type: 'string' }, install: { type: 'boolean' }, project: { type: 'boolean' }, manual: { type: 'boolean' },
|
|
70
103
|
license: { type: 'boolean' },
|
|
71
104
|
json: { type: 'boolean' }, quiet: { type: 'boolean' }, resume: { type: 'boolean' }, 'verify-timing': { type: 'boolean' }, help: { type: 'boolean', short: 'h' }, version: { type: 'boolean' },
|
|
72
105
|
}, allowPositionals: true });
|
|
@@ -78,9 +111,12 @@ try {
|
|
|
78
111
|
console.log(values.json ? JSON.stringify({ version: 1, package_version: version }) : version);
|
|
79
112
|
}
|
|
80
113
|
else if (values.help || command === 'help') {
|
|
81
|
-
const help = command === 'setup' ? setupHelp : `slidevideo <setup|inspect|validate|play|tts|resolve|record|assemble|build|skill|license|impressum>
|
|
114
|
+
const help = command === 'setup' ? setupHelp : command === 'skill' ? skillHelp : `slidevideo <setup|inspect|validate|play|tts|resolve|record|assemble|build|skill|license|impressum>
|
|
82
115
|
|
|
83
|
-
--storyboard <file> Required for presentation commands except assemble.
|
|
116
|
+
--storyboard <file> Required for presentation commands except assemble; inspect also accepts --deck.
|
|
117
|
+
--deck <file> Inspect a .md or .pptx deck directly before a storyboard exists.
|
|
118
|
+
--width/--height <px> Even viewport or output size (default: 1920x1080; PPTX inspect --deck uses slide size).
|
|
119
|
+
--fps <15|24|30|60> Output frame rate for record, assemble, or build (default: 30).
|
|
84
120
|
--run <directory> Required for artifact-producing commands.
|
|
85
121
|
--cache-dir <dir> Speech cache for tts or build, read-only timing metadata for play.
|
|
86
122
|
--port <number> Local play server port (default: auto).
|
|
@@ -94,20 +130,32 @@ try {
|
|
|
94
130
|
--quiet Suppress progress on stderr.
|
|
95
131
|
--version Package version.
|
|
96
132
|
|
|
97
|
-
setup prepares shared tools and speech providers, and detects Slidev and native PowerPoint support.
|
|
133
|
+
setup prepares shared tools and speech providers, and detects Slidev and native PowerPoint support (see setup --help).
|
|
98
134
|
Normal production leaves timing unevaluated and the video for user review.
|
|
99
|
-
inspect lists
|
|
135
|
+
inspect lists slide targets, click counts, media IDs and annotation targets from --deck or --storyboard without recording.
|
|
100
136
|
validate checks inputs without recording.
|
|
101
137
|
play --storyboard <file> serves silent slides and annotations with Play, Pause and Replay. Ctrl+C stops the server.
|
|
102
|
-
skill displays the bundled
|
|
138
|
+
skill displays or registers (--install) the bundled coding-agent skill; see skill --help for references and options.
|
|
103
139
|
license displays the bundled license terms. Use setup --license to manage activation.
|
|
104
140
|
impressum displays the provider's contact details.
|
|
105
141
|
`;
|
|
106
142
|
console.log(values.json ? JSON.stringify({ version: 1, command, help }) : help);
|
|
107
143
|
}
|
|
144
|
+
else if (command === 'skill' && values.install) {
|
|
145
|
+
requireCondition(positionals.length === 1 && Object.keys(values).every(key => ['install', 'project', 'json', 'quiet'].includes(key)), 'OPTION', 'Use slidevideo skill --install [--project] [--json].');
|
|
146
|
+
const report = await installSkill(values.project ? 'project' : 'user');
|
|
147
|
+
if (values.json)
|
|
148
|
+
console.log(JSON.stringify(report));
|
|
149
|
+
else {
|
|
150
|
+
console.log(`Skill source: ${report.source}`);
|
|
151
|
+
for (const item of report.targets)
|
|
152
|
+
console.log(` [✓] ${item.path} (${item.action})`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
108
155
|
else if (command === 'skill' || command === 'license' || command === 'impressum') {
|
|
156
|
+
requireCondition(!values.project, 'OPTION', '--project requires slidevideo skill --install.');
|
|
109
157
|
const file = documents.get(positionals.join(' '));
|
|
110
|
-
const usage = command === 'skill' ? 'skill [storyboard|production]' : command;
|
|
158
|
+
const usage = command === 'skill' ? 'skill [storyboard|production|decks] or slidevideo skill --install' : command;
|
|
111
159
|
requireCondition(file && Object.keys(values).every(key => key === 'json'), 'OPTION', `Use slidevideo ${usage} [--json].`);
|
|
112
160
|
const path = packagePath(file);
|
|
113
161
|
const document = await readFile(path, 'utf8');
|
|
@@ -119,7 +167,7 @@ impressum displays the provider's contact details.
|
|
|
119
167
|
await withExecutables({}, setupLicense);
|
|
120
168
|
}
|
|
121
169
|
else if (command === 'setup') {
|
|
122
|
-
requireCondition(positionals.length === 1 && !['storyboard', 'port', 'run', 'cache-dir', 'output', 'export', 'timeout-minutes', 'resume', 'verify-timing'].some(key => key in values), 'OPTION', 'Run slidevideo setup --help for setup options');
|
|
170
|
+
requireCondition(positionals.length === 1 && !['storyboard', 'deck', 'width', 'height', 'fps', 'port', 'run', 'cache-dir', 'output', 'export', 'timeout-minutes', 'resume', 'verify-timing', 'project'].some(key => key in values), 'OPTION', 'Run slidevideo setup --help for setup options');
|
|
123
171
|
let initialChecklist;
|
|
124
172
|
const report = await withExecutables(values, () => setup(values, current => {
|
|
125
173
|
initialChecklist = setupChecklist(current, configuredLicense());
|
|
@@ -152,6 +200,12 @@ impressum displays the provider's contact details.
|
|
|
152
200
|
if (!check.ready && check.name !== 'platform')
|
|
153
201
|
next.push(check.detail);
|
|
154
202
|
}
|
|
203
|
+
if (report.skill.status !== 'installed') {
|
|
204
|
+
const conflict = report.skill.targets.find(target => target.status === 'conflict');
|
|
205
|
+
next.push(conflict
|
|
206
|
+
? `Agent skill: remove or move ${conflict.conflict_path ?? conflict.path}, then run slidevideo skill --install.`
|
|
207
|
+
: 'Agent skill: run slidevideo skill --install to register the bundled skill for coding agents.');
|
|
208
|
+
}
|
|
155
209
|
if (next.length)
|
|
156
210
|
console.log(`\nNext steps\n${next.map(step => ` ${step}`).join('\n')}`);
|
|
157
211
|
for (const error of report.installation_errors)
|
|
@@ -165,6 +219,7 @@ impressum displays the provider's contact details.
|
|
|
165
219
|
}
|
|
166
220
|
else {
|
|
167
221
|
requireCondition(commands.includes(command) && positionals.length === 1, 'COMMAND', 'Run slidevideo --help for available commands');
|
|
222
|
+
requireCondition(!values.project, 'OPTION', '--project requires slidevideo skill --install');
|
|
168
223
|
requireCondition(!['presentation', 'provider', 'voice-id', 'install', 'manual', 'license'].some(key => key in values), 'OPTION', 'Presentation, provider, voice ID, install and license options require setup');
|
|
169
224
|
let timeout;
|
|
170
225
|
if (values['timeout-minutes'] !== undefined) {
|
|
@@ -179,13 +234,44 @@ impressum displays the provider's contact details.
|
|
|
179
234
|
requireCondition(!values.export || ['resolve', 'build'].includes(command), 'OPTION', '--export requires resolve or build');
|
|
180
235
|
requireCondition(!values['verify-timing'] || ['record', 'assemble', 'build'].includes(command), 'OPTION', '--verify-timing requires record, assemble or build');
|
|
181
236
|
requireCondition(values.port === undefined || command === 'play', 'OPTION', '--port requires play');
|
|
237
|
+
requireCondition((values.width === undefined) === (values.height === undefined), 'OPTION', 'Pass --width and --height together');
|
|
238
|
+
requireCondition((values.width === undefined && values.height === undefined) || ['inspect', 'validate', 'play', 'record', 'assemble', 'build'].includes(command), 'OPTION', '--width and --height require inspect, validate, play, record, assemble or build');
|
|
239
|
+
requireCondition(values.fps === undefined || ['record', 'assemble', 'build'].includes(command), 'OPTION', '--fps requires record, assemble or build');
|
|
240
|
+
let viewport;
|
|
241
|
+
if (values.width !== undefined && values.height !== undefined) {
|
|
242
|
+
const parseEvenDimension = (raw, name, min, max) => {
|
|
243
|
+
const trimmed = raw.trim();
|
|
244
|
+
const parsed = Number(trimmed);
|
|
245
|
+
requireCondition(/^\d+$/.test(trimmed) && Number.isInteger(parsed) && parsed >= min && parsed <= max && parsed % 2 === 0, 'OPTION', `--${name} must be an even integer from ${min} to ${max}`);
|
|
246
|
+
return parsed;
|
|
247
|
+
};
|
|
248
|
+
viewport = { width: parseEvenDimension(values.width, 'width', 640, 3840), height: parseEvenDimension(values.height, 'height', 360, 2160) };
|
|
249
|
+
}
|
|
250
|
+
let fps;
|
|
251
|
+
if (values.fps !== undefined) {
|
|
252
|
+
const trimmed = values.fps.trim();
|
|
253
|
+
const parsed = Number(trimmed);
|
|
254
|
+
requireCondition(/^\d+$/.test(trimmed) && (parsed === 15 || parsed === 24 || parsed === 30 || parsed === 60), 'OPTION', '--fps must be 15, 24, 30 or 60');
|
|
255
|
+
fps = parsed;
|
|
256
|
+
}
|
|
257
|
+
let inspectInput;
|
|
258
|
+
if (command === 'inspect') {
|
|
259
|
+
requireCondition(!(values.storyboard && values.deck), 'OPTION', 'Pass either --storyboard or --deck to inspect, not both');
|
|
260
|
+
requireCondition(values.storyboard !== undefined || values.deck !== undefined, 'STORYBOARD_REQUIRED', 'inspect requires --storyboard or --deck');
|
|
261
|
+
inspectInput = values.deck !== undefined
|
|
262
|
+
? { kind: 'deck', deck: values.deck, ...(viewport ? { viewport } : {}) }
|
|
263
|
+
: { kind: 'storyboard', storyboard: values.storyboard, ...(viewport ? { viewport } : {}) };
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
requireCondition(values.deck === undefined, 'OPTION', '--deck requires inspect');
|
|
267
|
+
}
|
|
182
268
|
await withExecutables(values, async () => {
|
|
183
269
|
if (command === 'play') {
|
|
184
270
|
requireCondition(values.storyboard, 'STORYBOARD_REQUIRED', 'play requires --storyboard');
|
|
185
|
-
requireCondition(values.run === undefined && values['timeout-minutes'] === undefined, 'OPTION', 'play takes --storyboard, --cache-dir and --
|
|
271
|
+
requireCondition(values.run === undefined && values['timeout-minutes'] === undefined, 'OPTION', 'play takes --storyboard, --cache-dir, --port, --width and --height; Ctrl+C stops the server');
|
|
186
272
|
const port = Number(values.port ?? 0);
|
|
187
273
|
requireCondition(values.port === undefined || /^\d+$/.test(values.port) && Number.isInteger(port) && port <= 65535, 'PREVIEW_PORT', '--port must be between 0 and 65535');
|
|
188
|
-
await servePreview(values.storyboard, values['cache-dir'], port, (url, approximate) => {
|
|
274
|
+
await servePreview(values.storyboard, values['cache-dir'], port, viewport, (url, approximate) => {
|
|
189
275
|
previewReady = true;
|
|
190
276
|
console.log(values.json ? JSON.stringify({ version: 1, command, status: 'ready', url, approximate, timing_status: 'not_evaluated' }) : `Open ${url} to preview the storyboard. Press Ctrl+C to stop.`);
|
|
191
277
|
});
|
|
@@ -203,7 +289,7 @@ impressum displays the provider's contact details.
|
|
|
203
289
|
progress?.(operation);
|
|
204
290
|
const heartbeat = progress ? setInterval(() => process.stderr.write(`[slidevideo] ${operation} (${Math.floor((Date.now() - started) / 1000)}s elapsed)\n`), 5000) : undefined;
|
|
205
291
|
try {
|
|
206
|
-
const result = await produce({ command, storyboard: values.storyboard, run: values.run, cache: values['cache-dir'], output: values.output, export: values.export, resume: values.resume, verify_timing: values['verify-timing'], timeout_ms: timeout, progress });
|
|
292
|
+
const result = await produce({ command, storyboard: values.storyboard, inspect: inspectInput, viewport, fps, run: values.run, cache: values['cache-dir'], output: values.output, export: values.export, resume: values.resume, verify_timing: values['verify-timing'], timeout_ms: timeout, progress });
|
|
207
293
|
progress?.(`${command} completed`);
|
|
208
294
|
console.log(values.json || command === 'inspect' ? JSON.stringify(result) : `${command} completed${result.artifacts.video ? `: ${result.artifacts.video}` : ''}`);
|
|
209
295
|
}
|
package/dist/compositor.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Canvas, type Image } from '@napi-rs/canvas';
|
|
2
|
-
import type { Rectangle, Schedule,
|
|
2
|
+
import type { Rectangle, Schedule, VideoOutput } from './contracts.js';
|
|
3
3
|
import type { AppliedAnnotation } from './annotations.js';
|
|
4
4
|
export type FrameLayer = {
|
|
5
5
|
image: Image | Canvas;
|
|
@@ -20,26 +20,31 @@ export type CompositorPlan = {
|
|
|
20
20
|
activeFrames: number;
|
|
21
21
|
betweenExpr: string;
|
|
22
22
|
ptsExpr: string;
|
|
23
|
+
readbackIntervals: ActiveInterval[];
|
|
24
|
+
selectedReadbackFrames: number;
|
|
25
|
+
readbackBetweenExpr?: string;
|
|
23
26
|
canvasLayers: FrameLayer[];
|
|
24
27
|
} | {
|
|
25
28
|
kind: 'full';
|
|
26
29
|
activeFrames: number;
|
|
30
|
+
selectedReadbackFrames: number;
|
|
27
31
|
canvasLayers: FrameLayer[];
|
|
28
32
|
};
|
|
29
|
-
export declare function frameLayers(output:
|
|
30
|
-
export declare function writeStaticFrameLayers(file: string, output:
|
|
33
|
+
export declare function frameLayers(output: VideoOutput, schedule: Schedule, licensed: boolean, hashes?: Record<string, string>): Promise<FrameLayer[]>;
|
|
34
|
+
export declare function writeStaticFrameLayers(file: string, output: VideoOutput, layers: FrameLayer[]): Promise<void>;
|
|
31
35
|
export declare function visibleFrameLayerBounds(layers: FrameLayer[], frame: number, fps: number, audioOrigin: number): Rectangle[];
|
|
32
36
|
export declare function splitFrameLayers(layers: FrameLayer[]): {
|
|
33
37
|
canvasLayers: FrameLayer[];
|
|
34
38
|
staticTopLayers: FrameLayer[];
|
|
35
39
|
};
|
|
36
40
|
export declare function planCompositor(frameCount: number, fps: number, audioOrigin: number, applications: AppliedAnnotation[], canvasLayers: FrameLayer[]): CompositorPlan;
|
|
37
|
-
export declare function compositeFrames(source: string, baseFilter: string, encoderArgs: string[], output:
|
|
41
|
+
export declare function compositeFrames(source: string, baseFilter: string, encoderArgs: string[], output: VideoOutput, applications: AppliedAnnotation[], plan: Exclude<CompositorPlan, {
|
|
38
42
|
kind: 'none';
|
|
39
|
-
}>, frameCount: number, audioOrigin: number): Promise<{
|
|
43
|
+
}>, frameCount: number, audioOrigin: number, stagingDirectory: string): Promise<{
|
|
40
44
|
renderer: string;
|
|
41
45
|
version: string;
|
|
42
46
|
frames: number;
|
|
43
47
|
composited_frames: number;
|
|
48
|
+
readback_frames: number;
|
|
44
49
|
mode: "sparse" | "full";
|
|
45
50
|
}>;
|