@vibeo/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/dist/commands/create.d.ts +6 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +18 -107
- 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 +19 -122
- 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
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare const TEMPLATE_NAMES: string[];
|
|
2
|
+
export declare function createProject(name: string, template: string): Promise<{
|
|
3
|
+
project: string;
|
|
4
|
+
template: string;
|
|
5
|
+
files: string[];
|
|
6
|
+
}>;
|
|
2
7
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AA8NA,eAAO,MAAM,cAAc,UAAyB,CAAC;AAErD,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA+DjE"}
|
package/dist/commands/create.js
CHANGED
|
@@ -2,7 +2,7 @@ import { resolve, join } from "node:path";
|
|
|
2
2
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
// ---------------------------------------------------------------------------
|
|
5
|
-
// Embedded templates
|
|
5
|
+
// Embedded templates
|
|
6
6
|
// ---------------------------------------------------------------------------
|
|
7
7
|
const TEMPLATE_BASIC = `import React from "react";
|
|
8
8
|
import {
|
|
@@ -207,95 +207,24 @@ export function Root() {
|
|
|
207
207
|
`;
|
|
208
208
|
// ---------------------------------------------------------------------------
|
|
209
209
|
const TEMPLATES = {
|
|
210
|
-
basic: {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
},
|
|
214
|
-
"audio-reactive": {
|
|
215
|
-
description: "Audio visualization with frequency bars and amplitude-driven effects",
|
|
216
|
-
source: TEMPLATE_AUDIO_REACTIVE,
|
|
217
|
-
},
|
|
218
|
-
transitions: {
|
|
219
|
-
description: "Scene transitions (fade, slide) between multiple scenes",
|
|
220
|
-
source: TEMPLATE_TRANSITIONS,
|
|
221
|
-
},
|
|
222
|
-
subtitles: {
|
|
223
|
-
description: "Video with SRT subtitle overlay",
|
|
224
|
-
source: TEMPLATE_SUBTITLES,
|
|
225
|
-
},
|
|
210
|
+
basic: { description: "Minimal composition with text animation and two scenes", source: TEMPLATE_BASIC },
|
|
211
|
+
"audio-reactive": { description: "Audio visualization with frequency bars", source: TEMPLATE_AUDIO_REACTIVE },
|
|
212
|
+
transitions: { description: "Scene transitions (fade, slide)", source: TEMPLATE_TRANSITIONS },
|
|
213
|
+
subtitles: { description: "Video with SRT subtitle overlay", source: TEMPLATE_SUBTITLES },
|
|
226
214
|
};
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
else if (arg.startsWith("--template=")) {
|
|
237
|
-
result.template = arg.slice("--template=".length);
|
|
238
|
-
}
|
|
239
|
-
else if (arg === "--help" || arg === "-h") {
|
|
240
|
-
printHelp();
|
|
241
|
-
process.exit(0);
|
|
242
|
-
}
|
|
243
|
-
else if (!arg.startsWith("-") && !result.name) {
|
|
244
|
-
result.name = arg;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
return result;
|
|
248
|
-
}
|
|
249
|
-
function printHelp() {
|
|
250
|
-
console.log(`
|
|
251
|
-
vibeo create - Create a new Vibeo project
|
|
252
|
-
|
|
253
|
-
Usage:
|
|
254
|
-
vibeo create <project-name> [options]
|
|
255
|
-
|
|
256
|
-
Options:
|
|
257
|
-
--template <name> Template to use (default: basic)
|
|
258
|
-
--help Show this help
|
|
259
|
-
|
|
260
|
-
Templates:`);
|
|
261
|
-
for (const [name, { description }] of Object.entries(TEMPLATES)) {
|
|
262
|
-
console.log(` ${name.padEnd(18)} ${description}`);
|
|
263
|
-
}
|
|
264
|
-
console.log(`
|
|
265
|
-
Examples:
|
|
266
|
-
vibeo create my-video
|
|
267
|
-
vibeo create music-viz --template audio-reactive
|
|
268
|
-
vibeo create intro --template transitions
|
|
269
|
-
`);
|
|
270
|
-
}
|
|
271
|
-
export async function createCommand(args) {
|
|
272
|
-
const parsed = parseArgs(args);
|
|
273
|
-
if (!parsed.name) {
|
|
274
|
-
console.error("Error: project name is required\n");
|
|
275
|
-
printHelp();
|
|
276
|
-
process.exit(1);
|
|
277
|
-
}
|
|
278
|
-
const template = TEMPLATES[parsed.template];
|
|
279
|
-
if (!template) {
|
|
280
|
-
console.error(`Error: unknown template "${parsed.template}"`);
|
|
281
|
-
console.error(`Available: ${Object.keys(TEMPLATES).join(", ")}`);
|
|
282
|
-
process.exit(1);
|
|
283
|
-
}
|
|
284
|
-
const projectDir = resolve(parsed.name);
|
|
285
|
-
if (existsSync(projectDir)) {
|
|
286
|
-
console.error(`Error: directory "${parsed.name}" already exists`);
|
|
287
|
-
process.exit(1);
|
|
288
|
-
}
|
|
289
|
-
console.log(`\nCreating Vibeo project: ${parsed.name}`);
|
|
290
|
-
console.log(`Template: ${parsed.template}\n`);
|
|
291
|
-
// Create project structure
|
|
215
|
+
export const TEMPLATE_NAMES = Object.keys(TEMPLATES);
|
|
216
|
+
export async function createProject(name, template) {
|
|
217
|
+
const tmpl = TEMPLATES[template];
|
|
218
|
+
if (!tmpl)
|
|
219
|
+
throw new Error(`Unknown template: ${template}`);
|
|
220
|
+
const projectDir = resolve(name);
|
|
221
|
+
if (existsSync(projectDir))
|
|
222
|
+
throw new Error(`Directory "${name}" already exists`);
|
|
292
223
|
await mkdir(join(projectDir, "src"), { recursive: true });
|
|
293
224
|
await mkdir(join(projectDir, "public"), { recursive: true });
|
|
294
|
-
|
|
295
|
-
await writeFile(join(projectDir, "src", "index.tsx"), template.source);
|
|
296
|
-
// Write package.json
|
|
225
|
+
await writeFile(join(projectDir, "src", "index.tsx"), tmpl.source);
|
|
297
226
|
const pkg = {
|
|
298
|
-
name
|
|
227
|
+
name,
|
|
299
228
|
version: "0.0.1",
|
|
300
229
|
private: true,
|
|
301
230
|
type: "module",
|
|
@@ -322,7 +251,6 @@ export async function createCommand(args) {
|
|
|
322
251
|
},
|
|
323
252
|
};
|
|
324
253
|
await writeFile(join(projectDir, "package.json"), JSON.stringify(pkg, null, 2) + "\n");
|
|
325
|
-
// Write tsconfig.json
|
|
326
254
|
const tsconfig = {
|
|
327
255
|
compilerOptions: {
|
|
328
256
|
target: "ES2022",
|
|
@@ -340,25 +268,8 @@ export async function createCommand(args) {
|
|
|
340
268
|
include: ["src"],
|
|
341
269
|
};
|
|
342
270
|
await writeFile(join(projectDir, "tsconfig.json"), JSON.stringify(tsconfig, null, 2) + "\n");
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
out/
|
|
347
|
-
*.tmp
|
|
348
|
-
.DS_Store
|
|
349
|
-
`);
|
|
350
|
-
console.log(` Created ${parsed.name}/`);
|
|
351
|
-
console.log(` ├── src/index.tsx`);
|
|
352
|
-
console.log(` ├── public/`);
|
|
353
|
-
console.log(` ├── package.json`);
|
|
354
|
-
console.log(` ├── tsconfig.json`);
|
|
355
|
-
console.log(` └── .gitignore`);
|
|
356
|
-
console.log(`
|
|
357
|
-
Next steps:
|
|
358
|
-
cd ${parsed.name}
|
|
359
|
-
bun install
|
|
360
|
-
bun run dev # preview in browser
|
|
361
|
-
bun run build # render to video
|
|
362
|
-
`);
|
|
271
|
+
await writeFile(join(projectDir, ".gitignore"), "node_modules/\ndist/\nout/\n*.tmp\n.DS_Store\n");
|
|
272
|
+
const files = ["src/index.tsx", "package.json", "tsconfig.json", ".gitignore", "public/"];
|
|
273
|
+
return { project: name, template, files };
|
|
363
274
|
}
|
|
364
275
|
//# sourceMappingURL=create.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,8EAA8E;AAC9E,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmD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IAAI;SAChB;QACD,OAAO,EAAE,CAAC,KAAK,CAAC;KACjB,CAAC;IACF,MAAM,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAE7F,MAAM,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,EAAE,gDAAgD,CAAC,CAAC;IAElG,MAAM,KAAK,GAAG,CAAC,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAC1F,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC5C,CAAC"}
|
package/dist/commands/list.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
interface CompositionMeta {
|
|
2
|
+
id: string;
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
fps: number;
|
|
6
|
+
durationInFrames: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function listCompositions(entry: string): Promise<CompositionMeta[]>;
|
|
9
|
+
export {};
|
|
6
10
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAGA,UAAU,eAAe;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CA4BhF"}
|
package/dist/commands/list.js
CHANGED
|
@@ -1,62 +1,13 @@
|
|
|
1
|
-
import { resolve } from "node:path";
|
|
2
1
|
import { bundle } from "@vibeo/renderer";
|
|
3
2
|
import { launchBrowser, createPage, closeBrowser } from "@vibeo/renderer";
|
|
4
|
-
function
|
|
5
|
-
const result = {
|
|
6
|
-
entry: "",
|
|
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 === "--help" || arg === "-h") {
|
|
19
|
-
printHelp();
|
|
20
|
-
process.exit(0);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return result;
|
|
24
|
-
}
|
|
25
|
-
function printHelp() {
|
|
26
|
-
console.log(`
|
|
27
|
-
vibeo list - List registered compositions
|
|
28
|
-
|
|
29
|
-
Usage:
|
|
30
|
-
vibeo list --entry <path>
|
|
31
|
-
|
|
32
|
-
Required:
|
|
33
|
-
--entry <path> Path to the root file with compositions
|
|
34
|
-
|
|
35
|
-
Options:
|
|
36
|
-
--help Show this help
|
|
37
|
-
`);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Bundle the entry, launch a browser to evaluate it,
|
|
41
|
-
* extract registered compositions, and print a table.
|
|
42
|
-
*/
|
|
43
|
-
export async function listCommand(args) {
|
|
44
|
-
const parsed = parseArgs(args);
|
|
45
|
-
if (!parsed.entry) {
|
|
46
|
-
console.error("Error: --entry is required");
|
|
47
|
-
printHelp();
|
|
48
|
-
process.exit(1);
|
|
49
|
-
}
|
|
50
|
-
const entry = resolve(parsed.entry);
|
|
3
|
+
export async function listCompositions(entry) {
|
|
51
4
|
console.log(`Bundling ${entry}...`);
|
|
52
5
|
const bundleResult = await bundle(entry);
|
|
53
6
|
try {
|
|
54
7
|
const browser = await launchBrowser();
|
|
55
8
|
const page = await createPage(browser, 1920, 1080);
|
|
56
9
|
await page.goto(bundleResult.url, { waitUntil: "networkidle" });
|
|
57
|
-
// Wait briefly for React to register compositions
|
|
58
10
|
await page.waitForTimeout(2000);
|
|
59
|
-
// Extract composition data from the page
|
|
60
11
|
const compositions = await page.evaluate(() => {
|
|
61
12
|
const win = window;
|
|
62
13
|
if (typeof win.vibeo_getCompositions === "function") {
|
|
@@ -66,36 +17,10 @@ export async function listCommand(args) {
|
|
|
66
17
|
});
|
|
67
18
|
await page.close();
|
|
68
19
|
await closeBrowser();
|
|
69
|
-
|
|
70
|
-
console.log("\nNo compositions found.");
|
|
71
|
-
console.log("Make sure your entry file exports compositions via <Composition /> components.");
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
// Print table
|
|
75
|
-
console.log("\nRegistered compositions:\n");
|
|
76
|
-
console.log(padRight("ID", 25) +
|
|
77
|
-
padRight("Width", 8) +
|
|
78
|
-
padRight("Height", 8) +
|
|
79
|
-
padRight("FPS", 6) +
|
|
80
|
-
padRight("Frames", 8) +
|
|
81
|
-
"Duration");
|
|
82
|
-
console.log("-".repeat(70));
|
|
83
|
-
for (const comp of compositions) {
|
|
84
|
-
const duration = (comp.durationInFrames / comp.fps).toFixed(1) + "s";
|
|
85
|
-
console.log(padRight(comp.id, 25) +
|
|
86
|
-
padRight(String(comp.width), 8) +
|
|
87
|
-
padRight(String(comp.height), 8) +
|
|
88
|
-
padRight(String(comp.fps), 6) +
|
|
89
|
-
padRight(String(comp.durationInFrames), 8) +
|
|
90
|
-
duration);
|
|
91
|
-
}
|
|
92
|
-
console.log();
|
|
20
|
+
return compositions;
|
|
93
21
|
}
|
|
94
22
|
finally {
|
|
95
23
|
await bundleResult.cleanup();
|
|
96
24
|
}
|
|
97
25
|
}
|
|
98
|
-
function padRight(str, len) {
|
|
99
|
-
return str.length >= len ? str : str + " ".repeat(len - str.length);
|
|
100
|
-
}
|
|
101
26
|
//# sourceMappingURL=list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU1E,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,KAAa;IAClD,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,KAAK,CAAC,CAAC;IACpC,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC;IAEzC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,aAAa,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAEnD,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;QAChE,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAEhC,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;YAC5C,MAAM,GAAG,GAAG,MAEX,CAAC;YACF,IAAI,OAAO,GAAG,CAAC,qBAAqB,KAAK,UAAU,EAAE,CAAC;gBACpD,OAAO,GAAG,CAAC,qBAAqB,EAAE,CAAC;YACrC,CAAC;YACD,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QACnB,MAAM,YAAY,EAAE,CAAC;QAErB,OAAO,YAAY,CAAC;IACtB,CAAC;YAAS,CAAC;QACT,MAAM,YAAY,CAAC,OAAO,EAAE,CAAC;IAC/B,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/commands/preview.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/commands/preview.ts"],"names":[],"mappings":"AAEA,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB9E"}
|
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
|