tommy24 commited on
Commit
94587b2
·
verified ·
1 Parent(s): 20229ac

Update remotion/render.mjs

Browse files
Files changed (1) hide show
  1. 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 bundled = await bundle({
7
- entryPoint: require.resolve('./src/index.tsx'),
8
- });
9
 
10
  const inputProps = {
11
- script: {
12
- title: "Sample Video",
13
- targetAudience: "General",
14
- summary: "Sample render",
15
- scenes: [
16
- { title: "Scene 1", duration: 2 },
17
- { title: "Scene 2", duration: 3 },
18
- ],
19
- config: {
20
- visualTheme: "STOMP",
21
- primaryColor: "#FFFFFF",
22
- musicTrack: "STOMP",
23
- aspectRatio: "16:9"
24
- }
25
  }
 
26
  };
27
 
28
- console.log('=== VIDEO SCRIPT PASSED TO COMPOSITION ===', inputProps);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  const composition = await selectComposition({
31
- serveUrl: bundled,
32
- id: 'VideoComposition', // MUST MATCH index.tsx
33
- inputProps,
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
- codec: 'h264',
43
- composition,
44
- serveUrl: bundled,
45
- outputLocation: `out/${composition.id}.mp4`,
46
- chromiumOptions: {
47
- enableMultiProcessOnLinux: true,
48
- args: ['--no-sandbox', '--disable-setuid-sandbox'],
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!`);