@remotion/lambda
在 AWS Lambda 上渲染 Remotion 视频。这是渲染 Remotion 视频最快且最可扩展的方式。 你只在渲染时支付费用,使其非常具有成本效益。
🌐 Render Remotion videos on AWS Lambda. This is the fastest and most scalable way to render Remotion videos.
You only pay while you are rendering, making it very cost-effective.
我什么时候应该使用它?
🌐 When should I use it?
- 你的视频在全高清下少于80分钟。 大约直到15分钟的AWS超时限制被触发
- 你保持在(AWS Lambda 并发限制)以内,或者你正在向AWS申请增加。
- 你可以在 支持的区域 使用亚马逊网络服务。
如果这些限制中的任何一项对你来说是致命的,可以采用普通的服务器端渲染或考虑使用Cloud Run。 另请参阅:服务器端渲染选项比较
🌐 If one of those constraints is a dealbreaker for you, resort to normal server-side rendering or consider using Cloud Run.
See also: Comparison of server-side rendering options
它是如何运作的
🌐 How it works
- 在 AWS 上创建了一个 Lambda 函数和一个 S3 存储桶。
- 一个 Remotion 项目被部署到 S3 存储桶作为网站。
- Lambda 函数被调用并打开 Remotion 项目。
- 许多 Lambda 函数被并行创建,每个函数渲染视频的一小部分
- 初始的 Lambda 函数下载视频并将它们拼接在一起。
- 最终视频被上传到 S3 并可以下载。
🌐 See in more detail: How Remotion Lambda works
架构
🌐 Architecture
- Lambda 函数:需要一个包含 Chromium 的层,目前由 Remotion 托管。只需要一个 Lambda 函数,但它可以执行不同的操作。
- S3 存储桶:存储项目、渲染结果以及渲染元数据。
- CLI:允许从命令行控制整体架构。通过将
@remotion/lambda添加到项目中来安装。 - Node.JS API:具有与 CLI 相同的功能,但在编程上更易于使用
设置 / 安装
🌐 Setup / Installation
地区选择
🌐 Region selection
以下区域可用于 Remotion Lambda:
🌐 The following regions are available for Remotion Lambda:
eu-central-1eu-central-2eu-west-1eu-west-2eu-west-3eu-south-1eu-north-1us-east-1us-east-2us-west-1us-west-2af-south-1ap-south-1ap-east-1ap-southeast-1ap-southeast-2ap-northeast-1ap-northeast-2ap-northeast-3ap-southeast-4ap-southeast-5ca-central-1me-south-1sa-east-1
限制
🌐 Limitations
- 在 Lambda 函数中,你只有最多 10GB 的存储可用。这必须足够存储分开的块和合并后的输出,因此输出文件最多只能约 5GB,这将限制最大视频长度为大约 2 小时的全高清(Full HD)视频。
- Lambda 默认每个区域有 1000 个并发 Lambda 的全局限制,尽管可以增加。
成本
🌐 Cost
我们的大多数用户只需花费几分钱就能渲染几分钟的视频。具体成本取决于地区、分配的内存、视频类型、并行化以及其他参数。对于每次渲染,我们会估算成本并显示给你。你可能还需要一个 Remotion 许可证(见下文)。
🌐 Most of our users render multiple minutes of video for just a few pennies. The exact cost is dependent on the region, assigned memory, type of video, parallelization and other parameters. For each render, we estimate a cost and display it to you. You might also need a Remotion license (see below).
AWS 权限
🌐 AWS permissions
Remotion Lambda 需要你创建一个 AWS 账户并创建一个附带某些权限的用户。我们仅需要操作 Remotion Lambda 所需的最少权限。
🌐 Remotion Lambda requires you to create an AWS account and create a user with some permissions attached to it. We require only the minimal amount of permissions required for operating Remotion Lambda.
命令行接口
🌐 CLI
你可以使用 npx remotion lambda 命令来控制 Remotion Lambda。
🌐 You can control Remotion Lambda using the npx remotion lambda command.
Node.JS API
你可以使用 Node.JS API 控制所有可以使用 CLI 完成的操作。参考资料请点击这里。
🌐 Everything you can do using the CLI, you can also control using Node.JS APIs. See the reference here.
许可证
🌐 License
适用标准 Remotion 许可: https://github.com/remotion-dev/remotion/blob/main/LICENSE.md
🌐 The standard Remotion license applies: https://github.com/remotion-dev/remotion/blob/main/LICENSE.md
需要许可证并使用云渲染的公司必须使用云渲染单元进行设置。请访问: https://remotion.pro/license
🌐 Companies needing a license and using cloud rendering must set it up with Cloud Rendering Units. Please visit: https://remotion.pro/license
卸载
🌐 Uninstalling
我们让你轻松地从 AWS 账户中删除所有 Remotion 资源,而不会留下任何痕迹或产生额外费用。
🌐 We make it easy to remove all Remotion resources from your AWS account without leaving any traces or causing further costs.
