在 R2 中使用 Remotion Lambda
Cloudflare 的 R2 是存储渲染结果的流行方式,因为没有出口费用。
🌐 R2 by Cloudflare is a popular way to store renders because there are no egress fees.
创建一个 Cloudflare 存储桶,并设置一个具有 对象读写 权限的 API 密钥。
🌐 Create a Cloudflare bucket and set up an API key with Object Read & Write permissions.
使用 s3OutputProvider 将渲染的视频存储在 R2 中:
🌐 Use an s3OutputProvider to store the rendered video in R2:
const {bucketName , renderId , cloudWatchMainLogs } = await renderMediaOnLambda ({
serveUrl : 'https://remotion-helloworld.vercel.app',
// FIXME: Add your function specs here
functionName : speculateFunctionName ({
diskSizeInMb : 2048,
memorySizeInMb : 2048,
timeoutInSeconds : 120,
}),
composition : 'HelloWorld',
region : 'eu-central-1',
codec : 'h264',
outName : {
// FIXME: Use the bucket name from your Cloudflare Storage settings
bucketName : 'remotion-test-bucket',
key : 'out.mp4',
s3OutputProvider : {
// FIXME: Use the endpoint from your Cloudflare Storage settings
endpoint : 'https://2fe488b3b0f4deee223aef7464784c46.r2.cloudflarestorage.com',
// FIXME: Use the Access Key from your Cloudflare settings
accessKeyId : process .env .R2_ACCESS_KEY_ID ?? '',
// FIXME: Use the Secret Access Key from your Cloudflare settings
secretAccessKey : process .env .R2_SECRET_ACCESS_KEY ?? '',
},
},
});将网站和资源存储在 R2 中
🌐 Storing the site and assets in R2
许多 Remotion 用户将他们的 bundle 和任何资源(如输入视频)存储在 R2 中,以避免 S3 带宽成本。
另请参阅
🌐 See also