packages/docs/docs/recorder/lambda-rendering.mdx
If you want to render long videos faster or you want to render different versions of your videos at the same time, you can take advantage of @remotion/lambda.
First you need to set up Remotion Lambda.
Follow steps 1-7 of the instructions shown here.
:::note Your site will get a URL that is publicly accessible. Make sure to keep it private and do not share it with anyone. :::
Add the following function and site deployment commands as well as the render command into a shell script you can execute each time you want to render a video:
bunx remotion lambda functions deploy --memory=3009
bunx remotion lambda sites create --site-name=remotion-recorder --enable-folder-expiry
bunx remotion lambda render remotion-recorder <composition-id> --delete-after="7-days"
Explanation:
remotion-recorder, you may choose a different name if you like. The --enable-folder-expiry flag will make it possible to render videos that automatically delete. If a site with this name already existed, it will update it.--delete-after flag will delete the video after the specified time, you may remove this flag if you want to keep the video.You may use --props to override the default props that you set in your composition.
Here is a script to render a video for all platforms:
bunx remotion lambda render --props='{"platform": "youtube", "layout": "landscape"}' remotion-recorder <composition-id>
bunx remotion lambda render --props='{"platform": "x", "layout": "square"}' remotion-recorder <composition-id>
bunx remotion lambda render --props='{"platform": "linkedin", "layout": "square"}' remotion-recorder <composition-id>
For rendering our videos, we create a TypeScript file and run it with bun lambda.ts.
import {$} from 'bun';
const siteName = 'our-recorder';
const compositionId = 'installwhispercpp';
const configs = [
{
canvasLayout: 'square',
platform: 'linkedin',
},
{
canvasLayout: 'square',
platform: 'x',
},
{
canvasLayout: 'landscape',
platform: 'youtube',
},
];
await $`bunx remotion lambda sites create --site-name=${siteName}`;
for (const config of configs) {
await $`bunx remotion lambda render ${siteName} ${compositionId} --props='${JSON.stringify(config)}'`;
}