@slidevideo/cli 0.1.2 → 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.
- package/CHANGELOG.md +34 -0
- package/IMPRESSUM.md +18 -4
- package/LICENSE-TERMS.md +46 -13
- package/README.md +3 -3
- package/addons/slidevideo/global-top.vue +1 -1
- package/addons/slidevideo/playback-entries.ts +1 -1
- package/addons/slidevideo/preview.ts +2 -2
- package/dist/adapters/browser-runtime.d.ts +3 -0
- package/dist/adapters/elevenlabs.d.ts +1 -0
- package/dist/adapters/elevenlabs.js +8 -4
- package/dist/adapters/powerpoint.d.ts +1 -1
- package/dist/adapters/powerpoint.js +10 -11
- package/dist/adapters/slidev-inspection.js +2 -4
- package/dist/adapters/slidev-server.js +136 -15
- package/dist/adapters/slidev.d.ts +9 -0
- package/dist/adapters/slidev.js +347 -62
- package/dist/annotations.d.ts +1 -1
- package/dist/annotations.js +3 -3
- package/dist/assembly.d.ts +44 -38
- package/dist/assembly.js +60 -21
- package/dist/calibration.js +5 -4
- package/dist/cli.js +86 -31
- package/dist/compositor.d.ts +30 -3
- package/dist/compositor.js +196 -30
- package/dist/contracts.d.ts +6 -6
- package/dist/executables.d.ts +2 -0
- package/dist/executables.js +27 -8
- package/dist/media.d.ts +7 -1
- package/dist/media.js +23 -4
- package/dist/pipeline.d.ts +1 -1
- package/dist/pipeline.js +107 -42
- package/dist/preview/server.js +4 -4
- package/dist/run.d.ts +1 -1
- package/dist/run.js +8 -3
- package/dist/setup-install.d.ts +1 -0
- package/dist/setup-install.js +8 -1
- package/dist/setup.d.ts +26 -8
- package/dist/setup.js +168 -76
- package/dist/speech.js +10 -6
- package/dist/storyboard.js +3 -6
- package/dist/timing.js +2 -2
- package/package.json +1 -3
- package/schemas/schedule.v1.json +389 -1
- package/schemas/storyboard.v1.json +342 -1
- package/skills/slidevideo/SKILL.md +2 -2
- package/skills/slidevideo/references/production.md +7 -6
- package/skills/slidevideo/references/storyboard.md +9 -8
- package/schemas/schedule.v2.json +0 -496
- package/schemas/storyboard.v2.json +0 -802
package/dist/assembly.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join, dirname } from 'node:path';
|
|
2
2
|
import { lstat, mkdir, mkdtemp, link, rm, copyFile } from 'node:fs/promises';
|
|
3
|
-
import { execute, probe, decode, saveJson } from './media.js';
|
|
3
|
+
import { execute, hashFile, probe, decode, saveJson } from './media.js';
|
|
4
4
|
import { requireCondition } from './errors.js';
|
|
5
5
|
import { configuredLicense } from './executables.js';
|
|
6
6
|
import { annotationApplications, verifyAnnotations } from './annotations.js';
|
|
@@ -32,6 +32,7 @@ export async function assemble(story, schedule, speech, visual, directory, outpu
|
|
|
32
32
|
}
|
|
33
33
|
let temporaryDirectory;
|
|
34
34
|
try {
|
|
35
|
+
await options.onOutputReserved?.();
|
|
35
36
|
temporaryDirectory = await mkdtemp(`${output}.partial-`);
|
|
36
37
|
const temporary = join(temporaryDirectory, 'video.mp4');
|
|
37
38
|
const args = ['-v', 'error', '-xerror', '-y'];
|
|
@@ -46,26 +47,60 @@ export async function assemble(story, schedule, speech, visual, directory, outpu
|
|
|
46
47
|
const pictureLeadHold = Math.max(0, -originDelta);
|
|
47
48
|
const duration = (schedule.duration_ms + audioOrigin) / 1000;
|
|
48
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=${story.output.fps},tpad=stop_mode=clone:stop_duration=${duration},trim=duration=${duration},format=yuv420p`;
|
|
50
|
+
const frameCount = Math.ceil(duration * story.output.fps - 1e-9);
|
|
49
51
|
const annotations = annotationApplications(story, schedule, visual, audioOrigin);
|
|
50
52
|
const renderer = annotations.length || schedule.overlays?.length || !licensed ? await import('./compositor.js') : undefined;
|
|
51
53
|
const layers = await renderer?.frameLayers(story.output, schedule, licensed, options.inputHashes) ?? [];
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
const { canvasLayers, staticTopLayers } = renderer ? renderer.splitFrameLayers(layers) : { canvasLayers: [], staticTopLayers: [] };
|
|
55
|
+
const plan = renderer ? renderer.planCompositor(frameCount, story.output.fps, audioOrigin, annotations, canvasLayers) : { kind: 'none' };
|
|
56
|
+
let layerImage;
|
|
57
|
+
if (staticTopLayers.length) {
|
|
58
|
+
layerImage = join(temporaryDirectory, 'overlays.png');
|
|
59
|
+
await renderer.writeStaticFrameLayers(layerImage, story.output, staticTopLayers);
|
|
57
60
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
let input = 1;
|
|
62
|
+
switch (plan.kind) {
|
|
63
|
+
case 'none':
|
|
64
|
+
args.push('-i', visual.file);
|
|
65
|
+
if (layerImage) {
|
|
66
|
+
args.push('-i', layerImage);
|
|
67
|
+
filters.push(`[0:v]${baseFilter}[base]`, '[base][1:v]overlay=eof_action=repeat,format=yuv420p[v]');
|
|
68
|
+
input = 2;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
filters.push(`[0:v]${baseFilter}[v]`);
|
|
72
|
+
input = 1;
|
|
73
|
+
}
|
|
74
|
+
break;
|
|
75
|
+
case 'sparse':
|
|
76
|
+
args.push('-i', visual.file);
|
|
77
|
+
args.push('-f', 'rawvideo', '-pixel_format', 'rgba', '-video_size', `${story.output.width}x${story.output.height}`, '-framerate', String(story.output.fps), '-i', 'pipe:0');
|
|
78
|
+
if (layerImage) {
|
|
79
|
+
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]');
|
|
81
|
+
input = 3;
|
|
82
|
+
}
|
|
83
|
+
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]`);
|
|
85
|
+
input = 2;
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
case 'full':
|
|
89
|
+
args.push('-f', 'rawvideo', '-pixel_format', 'rgba', '-video_size', `${story.output.width}x${story.output.height}`, '-framerate', String(story.output.fps), '-i', 'pipe:0');
|
|
90
|
+
if (layerImage) {
|
|
91
|
+
args.push('-i', layerImage);
|
|
92
|
+
filters.push('[0:v]format=yuv420p[base]', '[base][1:v]overlay=eof_action=repeat,format=yuv420p[v]');
|
|
93
|
+
input = 2;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
filters.push('[0:v]format=yuv420p[v]');
|
|
97
|
+
input = 1;
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
default: {
|
|
101
|
+
const _exhaustive = plan;
|
|
102
|
+
throw new Error(`Unhandled compositor plan: ${String(_exhaustive)}`);
|
|
66
103
|
}
|
|
67
|
-
else
|
|
68
|
-
filters.push(`[0:v]${baseFilter}[v]`);
|
|
69
104
|
}
|
|
70
105
|
if (annotations.length)
|
|
71
106
|
await saveJson(join(directory, 'annotations-applied.json'), { version: 1, annotations });
|
|
@@ -96,19 +131,23 @@ export async function assemble(story, schedule, speech, visual, directory, outpu
|
|
|
96
131
|
args.push('-map', '[a]', '-c:a', 'aac', '-b:a', '192k', '-ar', '48000');
|
|
97
132
|
args.push('-c:v', 'libx264', '-preset', 'fast', '-crf', '18', '-t', String(duration), '-movflags', '+faststart');
|
|
98
133
|
let compositor;
|
|
99
|
-
if (
|
|
100
|
-
compositor = await renderer.compositeFrames(visual.file, baseFilter, [...args, temporary], story.output, annotations,
|
|
134
|
+
if (plan.kind !== 'none') {
|
|
135
|
+
compositor = await renderer.compositeFrames(visual.file, baseFilter, [...args, temporary], story.output, annotations, plan, frameCount, audioOrigin);
|
|
101
136
|
}
|
|
102
|
-
else
|
|
137
|
+
else {
|
|
103
138
|
await execute('ffmpeg', [...args, temporary]);
|
|
139
|
+
if (annotations.length)
|
|
140
|
+
compositor = { renderer: 'canvas-skia', version: '1.1.1', frames: frameCount, composited_frames: 0, mode: 'none' };
|
|
141
|
+
}
|
|
104
142
|
if (options.verify_timing)
|
|
105
143
|
await decode(temporary);
|
|
106
144
|
const properties = await probe(temporary);
|
|
107
145
|
requireCondition(properties.width === story.output.width && properties.height === story.output.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
|
+
const outputSha256 = await hashFile(temporary);
|
|
108
147
|
let annotationEvidence;
|
|
109
148
|
if (annotations.length && options.verify_timing) {
|
|
110
149
|
try {
|
|
111
|
-
annotationEvidence = await verifyAnnotations(temporary, visual.file, baseFilter, annotations, story, directory, output, frame => renderer.visibleFrameLayerBounds(layers, frame, story.output.fps, audioOrigin));
|
|
150
|
+
annotationEvidence = await verifyAnnotations(temporary, visual.file, baseFilter, annotations, story, directory, output, frame => renderer.visibleFrameLayerBounds(layers, frame, story.output.fps, audioOrigin), outputSha256);
|
|
112
151
|
}
|
|
113
152
|
catch (error) {
|
|
114
153
|
await copyFile(temporary, join(directory, 'failed-composite.mp4'));
|
|
@@ -124,7 +163,7 @@ export async function assemble(story, schedule, speech, visual, directory, outpu
|
|
|
124
163
|
}
|
|
125
164
|
const report = { version: 1, output, properties, watermark: !licensed, ...(schedule.overlays?.length ? { image_overlays: schedule.overlays } : {}), decode: options.verify_timing ? 'passed' : 'not_evaluated', timing_status: visual.timing.status, ...(annotations.length ? { compositor, base_capture_timing: visual.timing.status, applied_annotations: annotations, final_composite: annotationEvidence ?? { status: 'not_evaluated', gaps: ['Final annotation frames were not verified. The user reviews the video.'] } } : {}), output_origin_delta_ms: originDelta, audio_origin_ms: audioOrigin, picture_lead_hold_ms: pictureLeadHold, final_hold: 'clone last content frame to scheduled end', trim_start_ms, trim_end_ms, mapping, transformations, editorial_review: 'user' };
|
|
126
165
|
await saveJson(join(directory, 'report.json'), report);
|
|
127
|
-
return report;
|
|
166
|
+
return { report, outputSha256 };
|
|
128
167
|
}
|
|
129
168
|
finally {
|
|
130
169
|
try {
|
package/dist/calibration.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { spawn } from 'node:child_process';
|
|
3
|
-
import { execute,
|
|
3
|
+
import { execute, executionSignal, hasStageDeadline, saveJson } from './media.js';
|
|
4
4
|
import { executable } from './executables.js';
|
|
5
5
|
import { ProductionError } from './errors.js';
|
|
6
6
|
const analysisWidth = 640;
|
|
@@ -18,7 +18,8 @@ async function* decodedFrames(file, range) {
|
|
|
18
18
|
if (range)
|
|
19
19
|
args.push('-frames:v', String(range.last - range.first + 1));
|
|
20
20
|
args.push('-f', 'rawvideo', '-');
|
|
21
|
-
const
|
|
21
|
+
const signal = executionSignal();
|
|
22
|
+
const child = spawn(executable('ffmpeg'), args, { stdio: ['ignore', 'pipe', 'pipe'], signal, killSignal: 'SIGKILL', windowsHide: true });
|
|
22
23
|
let error = '';
|
|
23
24
|
child.stderr.on('data', data => { error = (error + data.toString()).slice(-4000); });
|
|
24
25
|
const completion = new Promise((resolve, reject) => {
|
|
@@ -26,7 +27,7 @@ async function* decodedFrames(file, range) {
|
|
|
26
27
|
child.once('close', code => code === 0 ? resolve() : reject(new ProductionError('SUBPROCESS', `ffmpeg exited ${code}: ${error}`, 3)));
|
|
27
28
|
});
|
|
28
29
|
void completion.catch(() => { });
|
|
29
|
-
const timer = setTimeout(() => child.kill('SIGKILL'), 120000);
|
|
30
|
+
const timer = hasStageDeadline() ? undefined : setTimeout(() => child.kill('SIGKILL'), 120000);
|
|
30
31
|
const frame = Buffer.alloc(bytes);
|
|
31
32
|
let filled = 0;
|
|
32
33
|
let index = range?.first ?? 0;
|
|
@@ -332,7 +333,7 @@ export async function calibrate(file, markers, references, duration, directory)
|
|
|
332
333
|
await checkpoint();
|
|
333
334
|
}
|
|
334
335
|
}
|
|
335
|
-
|
|
336
|
+
executionSignal()?.throwIfAborted();
|
|
336
337
|
report.status = failed || pending.size ? 'failed' : 'accepted';
|
|
337
338
|
await checkpoint();
|
|
338
339
|
return report;
|
package/dist/cli.js
CHANGED
|
@@ -7,8 +7,8 @@ import { produce } from './pipeline.js';
|
|
|
7
7
|
import { resolve, join } from 'node:path';
|
|
8
8
|
import { json } from './media.js';
|
|
9
9
|
import { ProductionError, requireCondition } from './errors.js';
|
|
10
|
-
import { packagePath } from './installation.js';
|
|
11
|
-
import { withExecutables } from './executables.js';
|
|
10
|
+
import { packagePath, userConfigFile } from './installation.js';
|
|
11
|
+
import { configuredLicense, withExecutables } from './executables.js';
|
|
12
12
|
import { setup } from './setup.js';
|
|
13
13
|
import { setupLicense } from './setup-license.js';
|
|
14
14
|
import { notifyUpdate } from './update-check.js';
|
|
@@ -20,29 +20,57 @@ const documents = new Map([
|
|
|
20
20
|
['skill storyboard', 'skills/slidevideo/references/storyboard.md'],
|
|
21
21
|
['skill production', 'skills/slidevideo/references/production.md'],
|
|
22
22
|
]);
|
|
23
|
-
const setupHelp = `slidevideo setup [
|
|
23
|
+
const setupHelp = `slidevideo setup [options]
|
|
24
|
+
Check this installation and configure tools and speech providers.
|
|
24
25
|
|
|
25
|
-
--
|
|
26
|
-
--install
|
|
27
|
-
--
|
|
28
|
-
--
|
|
29
|
-
--json Print the readiness report as JSON. Pass the workflow choices as options.
|
|
30
|
-
--license Manage activation in a terminal without checking dependencies.
|
|
26
|
+
--manual Show status and next steps without prompts or installation.
|
|
27
|
+
--install Install supported missing tools.
|
|
28
|
+
--license Manage license activation.
|
|
29
|
+
--json Print detailed status as JSON.
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
Custom tool paths:
|
|
32
|
+
--browser <path> --python <path> --ffmpeg <path> --ffprobe <path>
|
|
33
|
+
|
|
34
|
+
Exit codes: 0 ready, 3 missing prerequisites.
|
|
34
35
|
`;
|
|
36
|
+
function setupChecklist(report, licensed) {
|
|
37
|
+
const labels = {
|
|
38
|
+
ffmpeg: 'FFmpeg', ffprobe: 'ffprobe', browser: 'Chromium', python: 'Python environment',
|
|
39
|
+
'elevenlabs-key': 'API key',
|
|
40
|
+
powershell: 'Windows PowerShell 5.1', powerpoint: 'desktop PowerPoint', desktop: 'unlocked desktop',
|
|
41
|
+
'ffmpeg-gdigrab': 'FFmpeg gdigrab input', platform: 'supported platform',
|
|
42
|
+
};
|
|
43
|
+
const lines = report.shared_checks.map(check => ` [${check.ready ? '✓' : 'X'}] ${labels[check.name] ?? check.name}`);
|
|
44
|
+
const group = (name, readiness, deferred = false) => {
|
|
45
|
+
if (!readiness)
|
|
46
|
+
return;
|
|
47
|
+
if (readiness.status === 'unavailable')
|
|
48
|
+
lines.push(` [-] ${name}: ${readiness.checks[0].detail}`);
|
|
49
|
+
else {
|
|
50
|
+
const missing = readiness.checks.filter(check => !check.ready).map(check => labels[check.name] ?? check.name);
|
|
51
|
+
lines.push(` [${readiness.status === 'ready' ? '✓' : 'X'}] ${name}${missing.length ? `: needs ${missing.join(', ')}` : ''}${deferred ? ', setup deferred' : ''}`);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
group('Slidev / Chromium', report.presentations.slidev);
|
|
55
|
+
group('Native PowerPoint', report.presentations.powerpoint);
|
|
56
|
+
group('Edge TTS', report.providers['edge-tts'], report.providers['edge-tts']?.deferred);
|
|
57
|
+
group('ElevenLabs', report.providers.elevenlabs, report.providers.elevenlabs?.deferred);
|
|
58
|
+
lines.push(` [${licensed ? '✓' : 'X'}] License ${licensed ? 'active' : 'not active'}`);
|
|
59
|
+
return lines.join('\n');
|
|
60
|
+
}
|
|
35
61
|
let command = process.argv[2] ?? 'help';
|
|
36
62
|
const jsonMode = process.argv.includes('--json');
|
|
37
63
|
let previewReady = false;
|
|
64
|
+
let runDirectory;
|
|
38
65
|
try {
|
|
39
66
|
const { values, positionals } = parseArgs({ options: {
|
|
40
|
-
storyboard: { type: 'string' }, port: { type: 'string' }, run: { type: 'string' }, 'cache-dir': { type: 'string' }, output: { type: 'string' }, export: { type: 'string' }, 'timeout-
|
|
67
|
+
storyboard: { type: 'string' }, port: { type: 'string' }, run: { type: 'string' }, 'cache-dir': { type: 'string' }, output: { type: 'string' }, export: { type: 'string' }, 'timeout-minutes': { type: 'string' },
|
|
41
68
|
browser: { type: 'string' }, python: { type: 'string' }, ffmpeg: { type: 'string' }, ffprobe: { type: 'string' },
|
|
42
69
|
presentation: { type: 'string' }, provider: { type: 'string' }, 'voice-id': { type: 'string' }, install: { type: 'boolean' }, manual: { type: 'boolean' },
|
|
43
70
|
license: { type: 'boolean' },
|
|
44
71
|
json: { type: 'boolean' }, quiet: { type: 'boolean' }, resume: { type: 'boolean' }, 'verify-timing': { type: 'boolean' }, help: { type: 'boolean', short: 'h' }, version: { type: 'boolean' },
|
|
45
72
|
}, allowPositionals: true });
|
|
73
|
+
runDirectory = values.run;
|
|
46
74
|
command = positionals[0] ?? 'help';
|
|
47
75
|
notifyUpdate(Boolean(values.json), Boolean(values.quiet));
|
|
48
76
|
if (values.version) {
|
|
@@ -60,13 +88,13 @@ try {
|
|
|
60
88
|
--resume Reuse intact build stages with matching inputs and mode.
|
|
61
89
|
--verify-timing Opt in to decoded timing proof for build or record; assemble checks the recorded mode.
|
|
62
90
|
--export <file> Optional resolved schedule export.
|
|
63
|
-
--timeout-
|
|
91
|
+
--timeout-minutes <min> Stage timeout override in minutes; defaults scale with project duration.
|
|
64
92
|
--browser/--python/--ffmpeg/--ffprobe <path> Override a tool for this command.
|
|
65
93
|
--json One JSON result on stdout (play reports its URL at readiness).
|
|
66
94
|
--quiet Suppress progress on stderr.
|
|
67
95
|
--version Package version.
|
|
68
96
|
|
|
69
|
-
setup
|
|
97
|
+
setup prepares shared tools and speech providers, and detects Slidev and native PowerPoint support.
|
|
70
98
|
Normal production leaves timing unevaluated and the video for user review.
|
|
71
99
|
inspect lists existing annotation targets without recording.
|
|
72
100
|
validate checks inputs without recording.
|
|
@@ -91,23 +119,46 @@ impressum displays the provider's contact details.
|
|
|
91
119
|
await withExecutables({}, setupLicense);
|
|
92
120
|
}
|
|
93
121
|
else if (command === 'setup') {
|
|
94
|
-
requireCondition(positionals.length === 1 && !['storyboard', 'port', 'run', 'cache-dir', 'output', 'export', 'timeout-
|
|
95
|
-
|
|
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');
|
|
123
|
+
let initialChecklist;
|
|
124
|
+
const report = await withExecutables(values, () => setup(values, current => {
|
|
125
|
+
initialChecklist = setupChecklist(current, configuredLicense());
|
|
126
|
+
console.error(`Current setup\n${initialChecklist}`);
|
|
127
|
+
console.error(`Config: ${userConfigFile()}\n`);
|
|
128
|
+
}));
|
|
96
129
|
if (values.json)
|
|
97
130
|
console.log(JSON.stringify(report));
|
|
98
131
|
else {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
132
|
+
const checklist = setupChecklist(report, configuredLicense());
|
|
133
|
+
if (initialChecklist !== checklist) {
|
|
134
|
+
console.log(`Setup status\n${checklist}`);
|
|
135
|
+
if (initialChecklist === undefined) {
|
|
136
|
+
console.log(`Config: ${report.config_file}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const missing = (name) => report.checks.some(check => check.name === name && !check.ready);
|
|
140
|
+
const next = [];
|
|
141
|
+
if (missing('ffmpeg') || missing('ffprobe'))
|
|
142
|
+
next.push(process.platform === 'darwin'
|
|
143
|
+
? 'FFmpeg: install with brew install ffmpeg (or run setup --install), or pass --ffmpeg and --ffprobe with their paths.'
|
|
144
|
+
: 'Install FFmpeg with libx264 and ffprobe, or pass --ffmpeg and --ffprobe with their paths.');
|
|
145
|
+
if (missing('browser'))
|
|
146
|
+
next.push('Chromium: run setup --presentation slidev --install, or pass --browser <path>.');
|
|
147
|
+
if (missing('python') && !report.providers['edge-tts']?.deferred)
|
|
148
|
+
next.push('Edge TTS: run setup --provider edge-tts --install, or pass --python <venv-python>.');
|
|
149
|
+
if (missing('elevenlabs-key') && !report.providers.elevenlabs?.deferred)
|
|
150
|
+
next.push('ElevenLabs: run setup --provider elevenlabs to save your API key for all projects.');
|
|
151
|
+
for (const check of report.presentations.powerpoint?.checks ?? []) {
|
|
152
|
+
if (!check.ready && check.name !== 'platform')
|
|
153
|
+
next.push(check.detail);
|
|
154
|
+
}
|
|
155
|
+
if (next.length)
|
|
156
|
+
console.log(`\nNext steps\n${next.map(step => ` ${step}`).join('\n')}`);
|
|
105
157
|
for (const error of report.installation_errors)
|
|
106
158
|
console.log(error);
|
|
107
159
|
if (Object.keys(report.saved_paths).length)
|
|
108
160
|
console.log(`Saved executable paths to ${report.config_file}`);
|
|
109
|
-
console.log(
|
|
110
|
-
console.log(report.status === 'ready' ? 'The selected workflow is ready.' : 'The selected workflow needs the dependencies listed above.');
|
|
161
|
+
console.log(report.status === 'ready' ? '\nSetup ready.' : '\nSetup incomplete.');
|
|
111
162
|
}
|
|
112
163
|
if (report.status !== 'ready')
|
|
113
164
|
process.exitCode = 3;
|
|
@@ -115,8 +166,13 @@ impressum displays the provider's contact details.
|
|
|
115
166
|
else {
|
|
116
167
|
requireCondition(commands.includes(command) && positionals.length === 1, 'COMMAND', 'Run slidevideo --help for available commands');
|
|
117
168
|
requireCondition(!['presentation', 'provider', 'voice-id', 'install', 'manual', 'license'].some(key => key in values), 'OPTION', 'Presentation, provider, voice ID, install and license options require setup');
|
|
118
|
-
|
|
119
|
-
|
|
169
|
+
let timeout;
|
|
170
|
+
if (values['timeout-minutes'] !== undefined) {
|
|
171
|
+
const raw = values['timeout-minutes'].trim();
|
|
172
|
+
const minutes = Number(raw);
|
|
173
|
+
requireCondition(/^(?:\d+(?:\.\d+)?|\.\d+)$/.test(raw) && Number.isFinite(minutes) && minutes > 0 && minutes <= 180, 'TIMEOUT', '--timeout-minutes must be a positive number up to 180');
|
|
174
|
+
timeout = Math.ceil(minutes * 60_000);
|
|
175
|
+
}
|
|
120
176
|
requireCondition(!values.output || ['assemble', 'build'].includes(command), 'OPTION', '--output requires assemble or build');
|
|
121
177
|
requireCondition(!values.resume || command === 'build', 'OPTION', '--resume requires build');
|
|
122
178
|
requireCondition(!values['cache-dir'] || ['tts', 'build', 'play'].includes(command), 'OPTION', '--cache-dir requires play, tts or build');
|
|
@@ -126,7 +182,7 @@ impressum displays the provider's contact details.
|
|
|
126
182
|
await withExecutables(values, async () => {
|
|
127
183
|
if (command === 'play') {
|
|
128
184
|
requireCondition(values.storyboard, 'STORYBOARD_REQUIRED', 'play requires --storyboard');
|
|
129
|
-
requireCondition(values.run === undefined && values['timeout-
|
|
185
|
+
requireCondition(values.run === undefined && values['timeout-minutes'] === undefined, 'OPTION', 'play takes --storyboard, --cache-dir and --port; Ctrl+C stops the server');
|
|
130
186
|
const port = Number(values.port ?? 0);
|
|
131
187
|
requireCondition(values.port === undefined || /^\d+$/.test(values.port) && Number.isInteger(port) && port <= 65535, 'PREVIEW_PORT', '--port must be between 0 and 65535');
|
|
132
188
|
await servePreview(values.storyboard, values['cache-dir'], port, (url, approximate) => {
|
|
@@ -165,14 +221,13 @@ impressum displays the provider's contact details.
|
|
|
165
221
|
catch (error) {
|
|
166
222
|
const failure = error instanceof ProductionError ? error : new ProductionError('INTERNAL', error instanceof Error ? error.message : String(error), error instanceof TypeError ? 2 : 1);
|
|
167
223
|
let run;
|
|
168
|
-
|
|
169
|
-
if (runIndex >= 0 && process.argv[runIndex + 1]) {
|
|
224
|
+
if (runDirectory) {
|
|
170
225
|
try {
|
|
171
|
-
run = await json(join(resolve(
|
|
226
|
+
run = await json(join(resolve(runDirectory), 'manifest.json'));
|
|
172
227
|
}
|
|
173
228
|
catch { }
|
|
174
229
|
}
|
|
175
|
-
const result = { version: 1, command, status: 'failed', run_id: run?.run_id, completed_stages: Object.entries(run?.stages ?? {}).filter(([, stage]) => stage?.status === 'completed').map(([name]) => name), artifacts: run ? { manifest: join(resolve(
|
|
230
|
+
const result = { version: 1, command, status: 'failed', run_id: run?.run_id, completed_stages: Object.entries(run?.stages ?? {}).filter(([, stage]) => stage?.status === 'completed').map(([name]) => name), artifacts: run ? { manifest: join(resolve(runDirectory), 'manifest.json') } : {}, timing_status: 'not_accepted', warnings: [], errors: [{ stage: command, code: failure.code, message: failure.message, ...failure.context }] };
|
|
176
231
|
const diagnostic = jsonMode ? JSON.stringify(result) : `${failure.code}: ${failure.message}`;
|
|
177
232
|
if (previewReady)
|
|
178
233
|
console.error(diagnostic);
|
package/dist/compositor.d.ts
CHANGED
|
@@ -1,18 +1,45 @@
|
|
|
1
1
|
import { type Canvas, type Image } from '@napi-rs/canvas';
|
|
2
2
|
import type { Rectangle, Schedule, Storyboard } from './contracts.js';
|
|
3
3
|
import type { AppliedAnnotation } from './annotations.js';
|
|
4
|
-
type FrameLayer = {
|
|
4
|
+
export type FrameLayer = {
|
|
5
5
|
image: Image | Canvas;
|
|
6
6
|
rectangle: Rectangle;
|
|
7
7
|
opacityAt?: (time: number) => number;
|
|
8
8
|
opacity: number;
|
|
9
9
|
};
|
|
10
|
+
export type ActiveInterval = {
|
|
11
|
+
start: number;
|
|
12
|
+
end: number;
|
|
13
|
+
};
|
|
14
|
+
export type CompositorPlan = {
|
|
15
|
+
kind: 'none';
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'sparse';
|
|
18
|
+
intervals: ActiveInterval[];
|
|
19
|
+
selectedFrames: number;
|
|
20
|
+
activeFrames: number;
|
|
21
|
+
betweenExpr: string;
|
|
22
|
+
ptsExpr: string;
|
|
23
|
+
canvasLayers: FrameLayer[];
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'full';
|
|
26
|
+
activeFrames: number;
|
|
27
|
+
canvasLayers: FrameLayer[];
|
|
28
|
+
};
|
|
10
29
|
export declare function frameLayers(output: Storyboard['output'], schedule: Schedule, licensed: boolean, hashes?: Record<string, string>): Promise<FrameLayer[]>;
|
|
11
30
|
export declare function writeStaticFrameLayers(file: string, output: Storyboard['output'], layers: FrameLayer[]): Promise<void>;
|
|
12
31
|
export declare function visibleFrameLayerBounds(layers: FrameLayer[], frame: number, fps: number, audioOrigin: number): Rectangle[];
|
|
13
|
-
export declare function
|
|
32
|
+
export declare function splitFrameLayers(layers: FrameLayer[]): {
|
|
33
|
+
canvasLayers: FrameLayer[];
|
|
34
|
+
staticTopLayers: FrameLayer[];
|
|
35
|
+
};
|
|
36
|
+
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: Storyboard['output'], applications: AppliedAnnotation[], plan: Exclude<CompositorPlan, {
|
|
38
|
+
kind: 'none';
|
|
39
|
+
}>, frameCount: number, audioOrigin: number): Promise<{
|
|
14
40
|
renderer: string;
|
|
15
41
|
version: string;
|
|
16
42
|
frames: number;
|
|
43
|
+
composited_frames: number;
|
|
44
|
+
mode: "sparse" | "full";
|
|
17
45
|
}>;
|
|
18
|
-
export {};
|