Update remotion/render.mjs
Browse files- remotion/render.mjs +42 -35
remotion/render.mjs
CHANGED
|
@@ -1,53 +1,60 @@
|
|
| 1 |
import { bundle } from '@remotion/bundler';
|
| 2 |
import { renderMedia, selectComposition } from '@remotion/renderer';
|
| 3 |
import { createRequire } from 'node:module';
|
| 4 |
-
const require = createRequire(import.meta.url);
|
| 5 |
|
| 6 |
-
const
|
| 7 |
-
entryPoint: require.resolve('./src/index.tsx'),
|
| 8 |
-
});
|
| 9 |
|
| 10 |
const inputProps = {
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
}
|
| 25 |
}
|
|
|
|
| 26 |
};
|
| 27 |
|
| 28 |
-
console.log('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
const composition = await selectComposition({
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
onBrowserDownload: (progress) => {
|
| 35 |
-
console.log(`Chrome download progress: ${progress.percent.toFixed(2)}%`);
|
| 36 |
-
},
|
| 37 |
});
|
| 38 |
|
| 39 |
console.log('Starting render...');
|
| 40 |
|
| 41 |
await renderMedia({
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
inputProps,
|
| 51 |
});
|
| 52 |
|
| 53 |
-
console.log(`Rendered composition ${composition.id}
|
|
|
|
| 1 |
import { bundle } from '@remotion/bundler';
|
| 2 |
import { renderMedia, selectComposition } from '@remotion/renderer';
|
| 3 |
import { createRequire } from 'node:module';
|
|
|
|
| 4 |
|
| 5 |
+
const require = createRequire(import.meta.url);
|
|
|
|
|
|
|
| 6 |
|
| 7 |
const inputProps = {
|
| 8 |
+
script: {
|
| 9 |
+
title: "Sample Video",
|
| 10 |
+
targetAudience: "General",
|
| 11 |
+
summary: "Sample render",
|
| 12 |
+
scenes: [
|
| 13 |
+
{ title: "Hello World", duration: 3, voiceover: "Welcome to Remotion!", codeSnippet: "DemoComponent" },
|
| 14 |
+
{ title: "Second Scene", duration: 2, voiceover: "This is scene two." }
|
| 15 |
+
],
|
| 16 |
+
config: {
|
| 17 |
+
visualTheme: "STOMP",
|
| 18 |
+
primaryColor: "#FFFFFF",
|
| 19 |
+
musicTrack: "STOMP",
|
| 20 |
+
aspectRatio: "16:9"
|
|
|
|
| 21 |
}
|
| 22 |
+
}
|
| 23 |
};
|
| 24 |
|
| 25 |
+
console.log('Bundling your Remotion project...');
|
| 26 |
+
|
| 27 |
+
const bundled = await bundle({
|
| 28 |
+
entryPoint: require.resolve('./src/index.tsx'), // your main TSX
|
| 29 |
+
webpackOverride: (config) => config,
|
| 30 |
+
onBrowserDownload: (progress) => {
|
| 31 |
+
if (progress && typeof progress.percent === 'number') {
|
| 32 |
+
console.log(`Chrome download progress: ${progress.percent.toFixed(2)}%`);
|
| 33 |
+
} else {
|
| 34 |
+
console.log('Chrome download progress: N/A');
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
});
|
| 38 |
+
|
| 39 |
+
console.log('Selecting composition...');
|
| 40 |
|
| 41 |
const composition = await selectComposition({
|
| 42 |
+
serveUrl: bundled,
|
| 43 |
+
id: 'VideoComposition', // must match your index.tsx Composition id
|
| 44 |
+
inputProps,
|
|
|
|
|
|
|
|
|
|
| 45 |
});
|
| 46 |
|
| 47 |
console.log('Starting render...');
|
| 48 |
|
| 49 |
await renderMedia({
|
| 50 |
+
codec: 'h264',
|
| 51 |
+
composition,
|
| 52 |
+
serveUrl: bundled,
|
| 53 |
+
outputLocation: `out/${composition.id}.mp4`,
|
| 54 |
+
chromiumOptions: {
|
| 55 |
+
enableMultiProcessOnLinux: true,
|
| 56 |
+
},
|
| 57 |
+
inputProps,
|
|
|
|
| 58 |
});
|
| 59 |
|
| 60 |
+
console.log(`Rendered composition ${composition.id} successfully!`);
|