Capítulo 164 de 988
You have two options for rendering your videos on Vercel:
const DISK = 10240;
const RAM = 2048;
const REGION = 'eu-central-1';
const SITE_NAME = 'https://remotion-helloworld.vercel.app';
const TIMEOUT = 120;
export const POST = async (req: Request, res: NextResponse) => {
if (!process.env.AWS_ACCESS_KEY_ID && !process.env.REMOTION_AWS_ACCESS_KEY_ID) {
throw new TypeError('Set up Remotion Lambda to render videos. See the README.md for how to do so.');
}
if (!process.env.AWS_SECRET_ACCESS_KEY && !process.env.REMOTION_AWS_SECRET_ACCESS_KEY) {
throw new TypeError('The environment variable REMOTION_AWS_SECRET_ACCESS_KEY is missing. Add it to your .env file.');
}
const body = await req.json();
const result = await renderMediaOnLambda({
codec: 'h264',
functionName: speculateFunctionName({
diskSizeInMb: DISK,
memorySizeInMb: RAM,
timeoutInSeconds: TIMEOUT,
}),
region: REGION as AwsRegion,
serveUrl: SITE_NAME,
composition: body.id,
inputProps: body.inputProps,
downloadBehavior: {
type: 'download',
fileName: 'video.mp4',
},
});
return result;
};