@vibeo/cli 0.1.1 → 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/dist/commands/create.d.ts +6 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +232 -130
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/list.d.ts +9 -5
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +2 -77
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/preview.d.ts +1 -4
- package/dist/commands/preview.d.ts.map +1 -1
- package/dist/commands/preview.js +1 -57
- package/dist/commands/preview.js.map +1 -1
- package/dist/commands/render.d.ts +17 -4
- package/dist/commands/render.d.ts.map +1 -1
- package/dist/commands/render.js +22 -154
- package/dist/commands/render.js.map +1 -1
- package/dist/index.js +103 -57
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/src/commands/create.ts +228 -134
- package/src/commands/list.ts +2 -98
- package/src/commands/preview.ts +1 -66
- package/src/commands/render.ts +26 -149
- package/src/index.ts +104 -57
package/dist/commands/preview.js
CHANGED
|
@@ -1,66 +1,10 @@
|
|
|
1
|
-
import { resolve } from "node:path";
|
|
2
1
|
import { bundle } from "@vibeo/renderer";
|
|
3
|
-
function
|
|
4
|
-
const result = {
|
|
5
|
-
entry: "",
|
|
6
|
-
port: 3000,
|
|
7
|
-
};
|
|
8
|
-
for (let i = 0; i < args.length; i++) {
|
|
9
|
-
const arg = args[i];
|
|
10
|
-
const next = args[i + 1];
|
|
11
|
-
if (arg === "--entry" && next) {
|
|
12
|
-
result.entry = next;
|
|
13
|
-
i++;
|
|
14
|
-
}
|
|
15
|
-
else if (arg.startsWith("--entry=")) {
|
|
16
|
-
result.entry = arg.slice("--entry=".length);
|
|
17
|
-
}
|
|
18
|
-
else if (arg === "--port" && next) {
|
|
19
|
-
result.port = parseInt(next, 10);
|
|
20
|
-
i++;
|
|
21
|
-
}
|
|
22
|
-
else if (arg.startsWith("--port=")) {
|
|
23
|
-
result.port = parseInt(arg.slice("--port=".length), 10);
|
|
24
|
-
}
|
|
25
|
-
else if (arg === "--help" || arg === "-h") {
|
|
26
|
-
printHelp();
|
|
27
|
-
process.exit(0);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
|
-
function printHelp() {
|
|
33
|
-
console.log(`
|
|
34
|
-
vibeo preview - Start a dev server with live preview
|
|
35
|
-
|
|
36
|
-
Usage:
|
|
37
|
-
vibeo preview --entry <path> [options]
|
|
38
|
-
|
|
39
|
-
Required:
|
|
40
|
-
--entry <path> Path to the root file with compositions
|
|
41
|
-
|
|
42
|
-
Options:
|
|
43
|
-
--port <number> Port for the dev server (default: 3000)
|
|
44
|
-
--help Show this help
|
|
45
|
-
`);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Start a dev server hosting the Player with hot reload.
|
|
49
|
-
*/
|
|
50
|
-
export async function previewCommand(args) {
|
|
51
|
-
const parsed = parseArgs(args);
|
|
52
|
-
if (!parsed.entry) {
|
|
53
|
-
console.error("Error: --entry is required");
|
|
54
|
-
printHelp();
|
|
55
|
-
process.exit(1);
|
|
56
|
-
}
|
|
57
|
-
const entry = resolve(parsed.entry);
|
|
2
|
+
export async function startPreview(entry, _port) {
|
|
58
3
|
console.log(`Starting preview server...`);
|
|
59
4
|
console.log(` Entry: ${entry}`);
|
|
60
5
|
const bundleResult = await bundle(entry);
|
|
61
6
|
console.log(`\n Preview running at ${bundleResult.url}`);
|
|
62
7
|
console.log(` Press Ctrl+C to stop\n`);
|
|
63
|
-
// Keep the process alive until interrupted
|
|
64
8
|
const shutdown = async () => {
|
|
65
9
|
console.log("\nShutting down preview server...");
|
|
66
10
|
await bundleResult.cleanup();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../src/commands/preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../src/commands/preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,KAAa,EAAE,KAAa;IAC7D,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,EAAE,CAAC,CAAC;IAEjC,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC;IAEzC,OAAO,CAAC,GAAG,CAAC,0BAA0B,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;IAExC,MAAM,QAAQ,GAAG,KAAK,IAAI,EAAE;QAC1B,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;QACjD,MAAM,YAAY,CAAC,OAAO,EAAE,CAAC;QAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAEhC,gBAAgB;IAChB,MAAM,IAAI,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { Codec, ImageFormat } from "@vibeo/renderer";
|
|
2
|
+
interface RenderOptions {
|
|
3
|
+
entry: string;
|
|
4
|
+
composition: string;
|
|
5
|
+
output: string | undefined;
|
|
6
|
+
fps: number | null;
|
|
7
|
+
frames: string | null;
|
|
8
|
+
codec: Codec;
|
|
9
|
+
concurrency: number;
|
|
10
|
+
imageFormat: ImageFormat;
|
|
11
|
+
quality: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function renderVideo(opts: RenderOptions): Promise<{
|
|
14
|
+
output: string;
|
|
15
|
+
elapsed: string;
|
|
16
|
+
}>;
|
|
17
|
+
export {};
|
|
5
18
|
//# sourceMappingURL=render.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/commands/render.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/commands/render.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAkB,MAAM,iBAAiB,CAAC;AAE1E,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB;AAuBD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CA2C9C"}
|
package/dist/commands/render.js
CHANGED
|
@@ -1,114 +1,5 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
|
-
import {
|
|
3
|
-
import { parseFrameRange } from "@vibeo/renderer";
|
|
4
|
-
import { renderComposition } from "@vibeo/renderer";
|
|
5
|
-
function parseArgs(args) {
|
|
6
|
-
const result = {
|
|
7
|
-
entry: "",
|
|
8
|
-
composition: "",
|
|
9
|
-
output: null,
|
|
10
|
-
fps: null,
|
|
11
|
-
frames: null,
|
|
12
|
-
codec: "h264",
|
|
13
|
-
concurrency: Math.max(1, Math.floor(availableParallelism() / 2)),
|
|
14
|
-
imageFormat: "png",
|
|
15
|
-
quality: 80,
|
|
16
|
-
};
|
|
17
|
-
for (let i = 0; i < args.length; i++) {
|
|
18
|
-
const arg = args[i];
|
|
19
|
-
const next = args[i + 1];
|
|
20
|
-
if (arg === "--entry" && next) {
|
|
21
|
-
result.entry = next;
|
|
22
|
-
i++;
|
|
23
|
-
}
|
|
24
|
-
else if (arg.startsWith("--entry=")) {
|
|
25
|
-
result.entry = arg.slice("--entry=".length);
|
|
26
|
-
}
|
|
27
|
-
else if (arg === "--composition" && next) {
|
|
28
|
-
result.composition = next;
|
|
29
|
-
i++;
|
|
30
|
-
}
|
|
31
|
-
else if (arg.startsWith("--composition=")) {
|
|
32
|
-
result.composition = arg.slice("--composition=".length);
|
|
33
|
-
}
|
|
34
|
-
else if (arg === "--output" && next) {
|
|
35
|
-
result.output = next;
|
|
36
|
-
i++;
|
|
37
|
-
}
|
|
38
|
-
else if (arg.startsWith("--output=")) {
|
|
39
|
-
result.output = arg.slice("--output=".length);
|
|
40
|
-
}
|
|
41
|
-
else if (arg === "--fps" && next) {
|
|
42
|
-
result.fps = parseInt(next, 10);
|
|
43
|
-
i++;
|
|
44
|
-
}
|
|
45
|
-
else if (arg.startsWith("--fps=")) {
|
|
46
|
-
result.fps = parseInt(arg.slice("--fps=".length), 10);
|
|
47
|
-
}
|
|
48
|
-
else if (arg === "--frames" && next) {
|
|
49
|
-
result.frames = next;
|
|
50
|
-
i++;
|
|
51
|
-
}
|
|
52
|
-
else if (arg.startsWith("--frames=")) {
|
|
53
|
-
result.frames = arg.slice("--frames=".length);
|
|
54
|
-
}
|
|
55
|
-
else if (arg === "--codec" && next) {
|
|
56
|
-
result.codec = next;
|
|
57
|
-
i++;
|
|
58
|
-
}
|
|
59
|
-
else if (arg.startsWith("--codec=")) {
|
|
60
|
-
result.codec = arg.slice("--codec=".length);
|
|
61
|
-
}
|
|
62
|
-
else if (arg === "--concurrency" && next) {
|
|
63
|
-
result.concurrency = parseInt(next, 10);
|
|
64
|
-
i++;
|
|
65
|
-
}
|
|
66
|
-
else if (arg.startsWith("--concurrency=")) {
|
|
67
|
-
result.concurrency = parseInt(arg.slice("--concurrency=".length), 10);
|
|
68
|
-
}
|
|
69
|
-
else if (arg === "--image-format" && next) {
|
|
70
|
-
result.imageFormat = next;
|
|
71
|
-
i++;
|
|
72
|
-
}
|
|
73
|
-
else if (arg.startsWith("--image-format=")) {
|
|
74
|
-
result.imageFormat = arg.slice("--image-format=".length);
|
|
75
|
-
}
|
|
76
|
-
else if (arg === "--quality" && next) {
|
|
77
|
-
result.quality = parseInt(next, 10);
|
|
78
|
-
i++;
|
|
79
|
-
}
|
|
80
|
-
else if (arg.startsWith("--quality=")) {
|
|
81
|
-
result.quality = parseInt(arg.slice("--quality=".length), 10);
|
|
82
|
-
}
|
|
83
|
-
else if (arg === "--help" || arg === "-h") {
|
|
84
|
-
printHelp();
|
|
85
|
-
process.exit(0);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return result;
|
|
89
|
-
}
|
|
90
|
-
function printHelp() {
|
|
91
|
-
console.log(`
|
|
92
|
-
vibeo render - Render a composition to video
|
|
93
|
-
|
|
94
|
-
Usage:
|
|
95
|
-
vibeo render --entry <path> --composition <id> [options]
|
|
96
|
-
|
|
97
|
-
Required:
|
|
98
|
-
--entry <path> Path to the root file with compositions
|
|
99
|
-
--composition <id> Composition ID to render
|
|
100
|
-
|
|
101
|
-
Options:
|
|
102
|
-
--output <path> Output file path (default: out/<compositionId>.mp4)
|
|
103
|
-
--fps <number> Override fps
|
|
104
|
-
--frames <range> Frame range "start-end" (e.g., "0-100")
|
|
105
|
-
--codec <codec> h264 | h265 | vp9 | prores (default: h264)
|
|
106
|
-
--concurrency <number> Parallel browser tabs (default: cpu count / 2)
|
|
107
|
-
--image-format <format> png | jpeg (default: png)
|
|
108
|
-
--quality <number> 0-100 for jpeg quality / crf (default: 80)
|
|
109
|
-
--help Show this help
|
|
110
|
-
`);
|
|
111
|
-
}
|
|
2
|
+
import { parseFrameRange, renderComposition } from "@vibeo/renderer";
|
|
112
3
|
function formatTime(ms) {
|
|
113
4
|
const seconds = Math.floor(ms / 1000);
|
|
114
5
|
const minutes = Math.floor(seconds / 60);
|
|
@@ -125,63 +16,40 @@ function renderProgressBar(progress) {
|
|
|
125
16
|
const eta = etaMs !== null ? ` ETA ${formatTime(etaMs)}` : "";
|
|
126
17
|
process.stdout.write(`\r [${bar}] ${pct}% (${framesRendered}/${totalFrames})${eta} `);
|
|
127
18
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
printHelp();
|
|
136
|
-
process.exit(1);
|
|
137
|
-
}
|
|
138
|
-
if (!parsed.composition) {
|
|
139
|
-
console.error("Error: --composition is required");
|
|
140
|
-
printHelp();
|
|
141
|
-
process.exit(1);
|
|
142
|
-
}
|
|
143
|
-
const entry = resolve(parsed.entry);
|
|
144
|
-
const compositionId = parsed.composition;
|
|
145
|
-
// TODO: In a full implementation, we would bundle the entry, extract
|
|
146
|
-
// composition metadata, and use it here. For now we require the user
|
|
147
|
-
// to have the composition info available.
|
|
148
|
-
// This is a simplified flow that demonstrates the pipeline.
|
|
149
|
-
const ext = parsed.codec === "vp9" ? "webm" : parsed.codec === "prores" ? "mov" : "mp4";
|
|
150
|
-
const output = parsed.output
|
|
151
|
-
? resolve(parsed.output)
|
|
152
|
-
: resolve(`out/${compositionId}.${ext}`);
|
|
153
|
-
console.log(`\nRendering composition "${compositionId}"`);
|
|
154
|
-
console.log(` Entry: ${entry}`);
|
|
19
|
+
export async function renderVideo(opts) {
|
|
20
|
+
const ext = opts.codec === "vp9" ? "webm" : opts.codec === "prores" ? "mov" : "mp4";
|
|
21
|
+
const output = opts.output
|
|
22
|
+
? resolve(opts.output)
|
|
23
|
+
: resolve(`out/${opts.composition}.${ext}`);
|
|
24
|
+
console.log(`\nRendering composition "${opts.composition}"`);
|
|
25
|
+
console.log(` Entry: ${opts.entry}`);
|
|
155
26
|
console.log(` Output: ${output}`);
|
|
156
|
-
console.log(` Codec: ${
|
|
157
|
-
console.log(`
|
|
158
|
-
console.log(` Concurrency: ${parsed.concurrency}`);
|
|
27
|
+
console.log(` Codec: ${opts.codec}`);
|
|
28
|
+
console.log(` Concurrency: ${opts.concurrency}`);
|
|
159
29
|
console.log();
|
|
160
|
-
// For a full render, we need composition info from the bundle.
|
|
161
|
-
// This would normally be extracted by bundling and evaluating the entry.
|
|
162
|
-
// Here we set up the render config and delegate to renderComposition.
|
|
163
30
|
const compositionInfo = {
|
|
164
31
|
width: 1920,
|
|
165
32
|
height: 1080,
|
|
166
|
-
fps:
|
|
33
|
+
fps: opts.fps ?? 30,
|
|
167
34
|
durationInFrames: 300,
|
|
168
35
|
};
|
|
169
|
-
const frameRange = parseFrameRange(
|
|
36
|
+
const frameRange = parseFrameRange(opts.frames, compositionInfo.durationInFrames);
|
|
170
37
|
const startTime = Date.now();
|
|
171
38
|
await renderComposition({
|
|
172
|
-
entry,
|
|
173
|
-
compositionId,
|
|
39
|
+
entry: opts.entry,
|
|
40
|
+
compositionId: opts.composition,
|
|
174
41
|
outputPath: output,
|
|
175
|
-
codec:
|
|
176
|
-
imageFormat:
|
|
177
|
-
quality:
|
|
178
|
-
fps:
|
|
42
|
+
codec: opts.codec,
|
|
43
|
+
imageFormat: opts.imageFormat,
|
|
44
|
+
quality: opts.quality,
|
|
45
|
+
fps: opts.fps,
|
|
179
46
|
frameRange,
|
|
180
|
-
concurrency:
|
|
47
|
+
concurrency: opts.concurrency,
|
|
181
48
|
pixelFormat: "yuv420p",
|
|
182
49
|
onProgress: renderProgressBar,
|
|
183
50
|
}, compositionInfo);
|
|
184
|
-
const elapsed = Date.now() - startTime;
|
|
185
|
-
console.log(`\n\nDone in ${
|
|
51
|
+
const elapsed = formatTime(Date.now() - startTime);
|
|
52
|
+
console.log(`\n\nDone in ${elapsed}. Output: ${output}`);
|
|
53
|
+
return { output, elapsed };
|
|
186
54
|
}
|
|
187
55
|
//# sourceMappingURL=render.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/commands/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/commands/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAerE,SAAS,UAAU,CAAC,EAAU;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACzC,MAAM,CAAC,GAAG,OAAO,GAAG,EAAE,CAAC;IACvB,OAAO,GAAG,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AACpD,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAwB;IACjD,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC;IACjE,MAAM,QAAQ,GAAG,EAAE,CAAC;IACpB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAChC,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7D,MAAM,GAAG,GAAG,CAAC,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G,IAAI,EAAE;QACnB,gBAAgB,EAAE,GAAG;KACtB,CAAC;IAEF,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;IAClF,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,MAAM,iBAAiB,CACrB;QACE,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,aAAa,EAAE,IAAI,CAAC,WAAW;QAC/B,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,UAAU;QACV,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,WAAW,EAAE,SAAS;QACtB,UAAU,EAAE,iBAAiB;KAC9B,EACD,eAAe,CAChB,CAAC;IAEF,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,CAAC;IACnD,OAAO,CAAC,GAAG,CAAC,eAAe,OAAO,aAAa,MAAM,EAAE,CAAC,CAAC;IACzD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,59 +1,105 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
list List registered compositions
|
|
19
|
-
|
|
20
|
-
Options:
|
|
21
|
-
--help Show help for a command
|
|
22
|
-
|
|
23
|
-
Examples:
|
|
24
|
-
vibeo create my-video
|
|
25
|
-
vibeo create music-viz --template audio-reactive
|
|
26
|
-
vibeo render --entry src/index.tsx --composition MyComp --output out.mp4
|
|
27
|
-
vibeo preview --entry src/index.tsx
|
|
28
|
-
vibeo list --entry src/index.tsx
|
|
29
|
-
`);
|
|
30
|
-
}
|
|
31
|
-
async function main() {
|
|
32
|
-
if (!command || command === "--help" || command === "-h") {
|
|
33
|
-
printUsage();
|
|
34
|
-
process.exit(0);
|
|
35
|
-
}
|
|
36
|
-
switch (command) {
|
|
37
|
-
case "create":
|
|
38
|
-
await createCommand(args.slice(1));
|
|
39
|
-
break;
|
|
40
|
-
case "render":
|
|
41
|
-
await renderCommand(args.slice(1));
|
|
42
|
-
break;
|
|
43
|
-
case "preview":
|
|
44
|
-
await previewCommand(args.slice(1));
|
|
45
|
-
break;
|
|
46
|
-
case "list":
|
|
47
|
-
await listCommand(args.slice(1));
|
|
48
|
-
break;
|
|
49
|
-
default:
|
|
50
|
-
console.error(`Unknown command: ${command}`);
|
|
51
|
-
printUsage();
|
|
52
|
-
process.exit(1);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
main().catch((err) => {
|
|
56
|
-
console.error(err);
|
|
57
|
-
process.exit(1);
|
|
1
|
+
import { Cli, z } from "incur";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { availableParallelism } from "node:os";
|
|
4
|
+
import { createProject } from "./commands/create.js";
|
|
5
|
+
import { startPreview } from "./commands/preview.js";
|
|
6
|
+
import { listCompositions } from "./commands/list.js";
|
|
7
|
+
import { renderVideo } from "./commands/render.js";
|
|
8
|
+
const cli = Cli.create("vibeo", {
|
|
9
|
+
description: "React-based programmatic video framework CLI",
|
|
10
|
+
sync: {
|
|
11
|
+
suggestions: [
|
|
12
|
+
"create a new video project",
|
|
13
|
+
"preview a composition in the browser",
|
|
14
|
+
"render a composition to video",
|
|
15
|
+
"list all registered compositions",
|
|
16
|
+
],
|
|
17
|
+
},
|
|
58
18
|
});
|
|
19
|
+
cli.command("create", {
|
|
20
|
+
description: "Create a new Vibeo project from a template",
|
|
21
|
+
args: z.object({
|
|
22
|
+
name: z.string().describe("Project directory name"),
|
|
23
|
+
}),
|
|
24
|
+
options: z.object({
|
|
25
|
+
template: z
|
|
26
|
+
.enum(["basic", "audio-reactive", "transitions", "subtitles"])
|
|
27
|
+
.default("basic")
|
|
28
|
+
.describe("Template to scaffold from"),
|
|
29
|
+
}),
|
|
30
|
+
examples: [
|
|
31
|
+
{ args: { name: "my-video" }, description: "Create with basic template" },
|
|
32
|
+
{ args: { name: "viz" }, options: { template: "audio-reactive" }, description: "Create with audio-reactive template" },
|
|
33
|
+
],
|
|
34
|
+
async run(c) {
|
|
35
|
+
return await createProject(c.args.name, c.options.template);
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
cli.command("preview", {
|
|
39
|
+
description: "Start a dev server with live preview in the browser",
|
|
40
|
+
options: z.object({
|
|
41
|
+
entry: z.string().describe("Path to the root file with compositions"),
|
|
42
|
+
port: z.number().default(3000).describe("Port for the dev server"),
|
|
43
|
+
}),
|
|
44
|
+
examples: [
|
|
45
|
+
{ options: { entry: "src/index.tsx" }, description: "Preview on default port" },
|
|
46
|
+
],
|
|
47
|
+
async run(c) {
|
|
48
|
+
await startPreview(resolve(c.options.entry), c.options.port);
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
cli.command("render", {
|
|
52
|
+
description: "Render a composition to a video file",
|
|
53
|
+
options: z.object({
|
|
54
|
+
entry: z.string().describe("Path to the root file with compositions"),
|
|
55
|
+
composition: z.string().describe("Composition ID to render"),
|
|
56
|
+
output: z.string().optional().describe("Output file path (default: out/<id>.mp4)"),
|
|
57
|
+
fps: z.number().optional().describe("Override frames per second"),
|
|
58
|
+
frames: z.string().optional().describe('Frame range, e.g. "0-100" or "50"'),
|
|
59
|
+
codec: z
|
|
60
|
+
.enum(["h264", "h265", "vp9", "prores"])
|
|
61
|
+
.default("h264")
|
|
62
|
+
.describe("Video codec"),
|
|
63
|
+
concurrency: z
|
|
64
|
+
.number()
|
|
65
|
+
.default(Math.max(1, Math.floor(availableParallelism() / 2)))
|
|
66
|
+
.describe("Number of parallel browser tabs"),
|
|
67
|
+
imageFormat: z
|
|
68
|
+
.enum(["png", "jpeg"])
|
|
69
|
+
.default("png")
|
|
70
|
+
.describe("Intermediate frame image format"),
|
|
71
|
+
quality: z.number().default(80).describe("JPEG quality / CRF value (0-100)"),
|
|
72
|
+
}),
|
|
73
|
+
examples: [
|
|
74
|
+
{ options: { entry: "src/index.tsx", composition: "MyComp" }, description: "Render with defaults" },
|
|
75
|
+
{ options: { entry: "src/index.tsx", composition: "MyComp", codec: "vp9", frames: "0-100" }, description: "Render a frame range as WebM" },
|
|
76
|
+
],
|
|
77
|
+
async run(c) {
|
|
78
|
+
return await renderVideo({
|
|
79
|
+
entry: resolve(c.options.entry),
|
|
80
|
+
composition: c.options.composition,
|
|
81
|
+
output: c.options.output,
|
|
82
|
+
fps: c.options.fps ?? null,
|
|
83
|
+
frames: c.options.frames ?? null,
|
|
84
|
+
codec: c.options.codec,
|
|
85
|
+
concurrency: c.options.concurrency,
|
|
86
|
+
imageFormat: c.options.imageFormat,
|
|
87
|
+
quality: c.options.quality,
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
cli.command("list", {
|
|
92
|
+
description: "List registered compositions in an entry file",
|
|
93
|
+
options: z.object({
|
|
94
|
+
entry: z.string().describe("Path to the root file with compositions"),
|
|
95
|
+
}),
|
|
96
|
+
examples: [
|
|
97
|
+
{ options: { entry: "src/index.tsx" }, description: "List all compositions" },
|
|
98
|
+
],
|
|
99
|
+
async run(c) {
|
|
100
|
+
const compositions = await listCompositions(resolve(c.options.entry));
|
|
101
|
+
return { compositions };
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
cli.serve();
|
|
59
105
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src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
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
+
"@vibeo/audio": "0.1.0",
|
|
17
18
|
"@vibeo/core": "0.1.0",
|
|
18
|
-
"@vibeo/renderer": "0.1.0",
|
|
19
19
|
"@vibeo/player": "0.1.0",
|
|
20
|
-
"@vibeo/
|
|
20
|
+
"@vibeo/renderer": "0.1.0",
|
|
21
|
+
"incur": "^0.3.13"
|
|
21
22
|
},
|
|
22
23
|
"files": [
|
|
23
24
|
"bin",
|