forked from fix/vaultys-remotion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrender.js
44 lines (34 loc) · 1.14 KB
/
render.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { bundle } from "@remotion/bundler";
import { getCompositions, renderMedia } from "@remotion/renderer";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const webpackOverride = (currentConfiguration) => currentConfiguration;
const start = async () => {
const compositionId = "QRCodeVideo";
const entry = "./src/index.tsx";
console.log("Creating a Webpack bundle of the video");
const bundleLocation = await bundle(path.resolve(entry), () => undefined, {
webpackOverride,
});
const inputProps = {};
const comps = await getCompositions(bundleLocation, {
inputProps,
});
const composition = comps.find((c) => c.id === compositionId);
if (!composition) {
throw new Error(`No composition with the ID ${compositionId} found.`);
}
const outputLocation = `out/${compositionId}2.gif`;
console.log("Attempting to render:", outputLocation);
await renderMedia({
composition,
serveUrl: bundleLocation,
codec: "gif",
outputLocation,
inputProps,
});
console.log("Render done!");
};
start();