Skip to main content

使用 Vercel Sandbox 渲染

Vercel Sandbox 允许你按需渲染视频,而无需管理 Lambda 或 AWS 基础设施。每次渲染都会产生一个临时的 Linux 虚拟机,并且可以完全访问 Remotion 渲染器。

🌐 Vercel Sandbox allows you to render videos on-demand without managing Lambda or AWS infrastructure.
Each render spawns an ephemeral Linux VM with full access to the Remotion renderer.

作为参考实现,我们创建了一个模板:Next.js 沙盒模板

🌐 As a reference implementation, we have created a template: Next.js Sandbox Template.

入门模板

🌐 Starter Template

使用我们的 Next.js 模板 快速入门。 你可以通过下面的按钮一键部署:

🌐 Use our Next.js template to get started quickly. You can deploy with one-click using the button below:

或者,访问 Vercel 模板市场上的 Remotion on Vercel 模板

🌐 Or, visit the Remotion on Vercel template on Vercel's template marketplace.

手册

🌐 Manual

使用 Vercel 模板:

🌐 Use the Vercel template:

npx create-video@latest --template vercel

将它推送到 Vercel。

🌐 Push it to Vercel.

然后,在你的 Vercel 仪表板中,在“存储”下,创建一个新的 Blob 存储并将其连接到项目。
重新部署以使更改生效。

🌐 Then, in your Vercel dashboard, under "Storage", create a new Blob store and connect it to the project.
Redeploy for the changes to take effect.

note

该模板不包含速率限制或缓存。在公开发布应用之前,请先实现这些功能,并设置 Vercel 支出管理 以控制成本。沙箱快照、渲染视频及其他 Vercel Blob 数据会永久保留——在不再需要时请删除它们。

@remotion/vercel

🌐 @remotion/vercel package

[@remotion/vercel](/docs/vercel/api) 包提供了一个用于在 Vercel Sandbox 上呈现 Remotion 视频的编程 API。该模板在底层使用了这个包。

🌐 The @remotion/vercel package provides a programmatic API for rendering Remotion videos on Vercel Sandbox. The template uses this package under the hood.

优势

🌐 Advantages

这是设置 Remotion 服务器端渲染的最简单方法。你只需要一个 Vercel 账户并连接一个 Blob 存储,然后你只需推送部署即可。

🌐 This is the easiest way to setup Remotion server-side rendering. You only need one Vercel account and connect a blob storage - then you just push to deploy.

Vercel 默认比 Lambda 的限制更高,因此你可以一次渲染比新建的 AWS 账户更多的视频。

🌐 Vercel has higher limits than Lambda by default, so you can render more videos at once than with a fresh AWS account.

在专业计划中允许 2000 个并发沙箱可以实现大规模扩展。

🌐 Allowing for 2000 concurrent sandboxes on the Pro Plan allows for massive scale.

限制

🌐 Limitations

渲染发生在单台机器上,而不是分布式系统上,因此比 Lambda 慢。

🌐 Rendering happens on a single machine rather than a distributed system, so it is slower than Lambda.

沙盒很大,包含 Chrome 和 FFmpeg,并且启动需要几秒钟。

🌐 The Sandbox is heavy, containing Chrome and FFmpeg and takes a few seconds to start up.

限制

🌐 Limits

Vercel Sandbox 在 Hobby 计划中的超时限制为 45 分钟,在 Pro 和 Enterprise 计划中为 5 小时。
并发方面,Hobby 的限制是 10 个同时渲染,Pro 和 Enterprise 为 2000 个。

🌐 The timeout limit for Vercel Sandbox is 45 minutes on the Hobby plan, and 5 hours on the Pro and Enterprise plans.
For concurrency, the limit is 10 simultaneous renders on Hobby, and 2000 on Pro and Enterprise.

更多详情,请参见:Vercel Sandbox 定价

🌐 For more details, see: Vercel Sandbox pricing

源代码

🌐 Source Code

有关实现细节,请参阅 模板源代码

🌐 See the template source code for implementation details.

另请参阅

🌐 See also