Skip to main content

服务器端渲染选项比较

此页面比较了在云中渲染视频的4种选项:

🌐 This page compares 4 options for rendering videos in the cloud:

这些选项故意各不相同,各有不同的取舍,以便你可以选择最适合你使用场景的那一个。

🌐 These options are deliberately distinct with different tradeoffs, so that you can choose the one that best fits your use case.

总体推荐

🌐 Overall recommendation

我们推荐大多数人使用 Remotion Lambda,因为它在速度、设置简便性、成熟度、总体成本和可扩展性之间具有最佳的平衡。

🌐 We recommend Remotion Lambda for most people as it has the best tradeoff for speed, ease of setup, maturity, total cost and scalability.

如果你已经是 Vercel 客户,并且想要最简单的设置,Vercel Sandbox 是一个不错的选择。

🌐 If you are already a Vercel customer and want the simplest setup, Vercel Sandbox is a great choice.

渲染视频数量最多的 Remotion 客户使用 Remotion Lambda 解决方案。

🌐 The Remotion customers with the highest amount of videos rendered use the Remotion Lambda solution.

速度

🌐 Speed

Remotion Lambda 是最快的选项,因为它实现了分布式渲染——视频被分成更小的块,并在多个 Lambda 函数上并行渲染。

🌐 Remotion Lambda is the fastest option, because it implements distributed rendering - the video gets divided into smaller chunks and rendered in parallel across multiple Lambda functions.

Vercel Sandbox、Cloud Run 和自定义服务器不支持分布式渲染,因此渲染发生在一台物理机器上。

🌐 Vercel Sandbox, Cloud Run, and custom servers do not support distributed rendering, so rendering happens on one physical machine.

Vercel Sandbox 目前由于虚拟机配置、安装系统依赖以及在每次渲染时下载浏览器,启动时间较长。我们计划通过 Vercel Sandbox 快照来改善这一点。

🌐 Vercel Sandbox currently has longer cold starts due to VM provisioning, installing system dependencies and downloading a browser on each render. We plan to improve this with Vercel Sandbox snapshots.

从头实现自定义分布式渲染解决方案具有挑战性,我们目前尚未提供文档。

🌐 Implementing a custom distributed rendering solution from scratch is challenging and we do not yet provide documentation.

成本

🌐 Cost

在 Remotion Lambda 上计算比其他选项更昂贵。 然而,只有在实际渲染视频时才会产生费用。 根据你渲染的视频数量,总成本使用 Lambda 可能会更低或更高。

🌐 Compute on Remotion Lambda is more expensive than other options. However, costs are only incurred when you actually render videos. Depending on the amount of videos you render, the total cost might be lower or higher with Lambda.

Vercel Sandbox 的定价基于使用量。你只需为虚拟机运行的时间付费。详情请参见 Vercel Sandbox 定价

🌐 Vercel Sandbox pricing is based on usage. You only pay for the time the VM is running. See Vercel Sandbox pricing for details.

Cloud Run 比 Lambda 更便宜,因为没有分布式渲染,也没有随之而来的开销。你也不需要为 Cloud Run 实例空闲的时间付费。

🌐 Cloud Run is cheaper than Lambda because there is no distributed rendering and no overhead that comes with it. You also don't pay for the time that the Cloud Run instance is idle.

运行服务器的计算成本迄今为止是最便宜的。然而,你也需要为服务器空闲的时间付费。

🌐 Running a server has by far the cheapest compute cost. However, you also pay for the time that the server is idle.

结论:你渲染的视频越多,一个长期运行的服务器对你可能就越有价值。

🌐 Conclusion: The more videos you render, the more a long-running server might be worth for you.

易于设置

🌐 Ease of setup

Vercel Sandbox 是最容易设置的。你只需一个 Vercel 账户和一个 Blob 存储。推送即可部署。

🌐 Vercel Sandbox is the easiest to set up. You only need a Vercel account and a Blob store. Push to deploy.

Remotion Lambda 和 Cloud Run 也很容易设置。 Remotion Lambda 已集成在我们的 SaaS 模板中,因此你可以非常快速地开始使用。

🌐 Remotion Lambda and Cloud Run are also fast to set up. Remotion Lambda is built into our SaaS templates, so you can get started very quickly.

使用 Node.JS API 需要你自己搭建服务器并自行管理某些事项:

🌐 Using the Node.JS APIs requires you to set up a server yourself and manage certain things yourself:

  • 排队渲染
  • 应对流量激增
  • 进度报告和错误处理
  • 设置日志记录
  • 服务器配置

总体来说,这是一个很大的努力,只推荐给那些致力于使用 Remotion 并希望获得最大灵活性的团队。

🌐 This is a big effort overall and is only recommended for teams who are committed to using Remotion and want the most flexibility.

功能集

🌐 Feature set

Remotion Lambda 目前具有 Cloud Run 所没有的以下功能:

🌐 Remotion Lambda currently has the following features that Cloud Run does not have:

  • 分布式渲染
  • 网络钩子
  • 苹果表情符号
  • 投票进展
  • 费用估算
  • 带有效期的渲染
  • 从 PHP、Go 和 Python 渲染

使用 Vercel Sandbox 或 Node.JS API 进行渲染也不包含这些功能,但你可以基于提供的低级 API 构建它们。

🌐 Rendering with Vercel Sandbox or the Node.JS APIs does not come with these features either, but you may build them based on top of the low-level APIs that are provided.

图形处理器

🌐 GPU

大多数渲染在 GPU 加速下不会变得更快。参见:哪些内容可以从 GPU 中受益?

🌐 Most renders do not become faster with GPU acceleration. See: Which content benefits from a GPU?.

我们有关于配置支持 GPU 加速的服务器的指南,但 Remotion 目前尚不支持。

🌐 We have guides for configuring a server with GPU acceleration, but it is not yet supported by Remotion.

Remotion Lambda 和 Vercel Sandbox 没有 GPU。你只能使用 CPU 渲染。

🌐 Remotion Lambda and Vercel Sandbox do not have GPUs. You are limited to CPU-only rendering.

我们尚未测试带有 GPU 加速的 Cloud Run。可以将 GPU 添加到 Cloud Run 实例中——我们很想听听你的反馈。

🌐 We have not tested Cloud Run with GPU acceleration. It is possible add a GPU to the Cloud Run instance - we are curious to hear your feedback.

稳定

🌐 Stability

我们对 Remotion Lambda 和 Node.js API 的架构感到满意,并且长期致力于此。

🌐 We are happy with the architecture of Remotion Lambda and Node.js APIs and are committed to it in the long-term.

Vercel Sandbox 支持是新的。我们正在积极改进它,计划添加的功能包括用于更快冷启动的快照以及支持更好编解码器的自定义 Chrome 构建。

🌐 Vercel Sandbox support is new. We are actively improving it with planned features like snapshots for faster cold starts and custom Chrome builds for better codec support.

Cloud Run 目前处于 Alpha 阶段,我们正在考虑将其迁移到一个重用 Remotion Lambda 代码的模型。这将使我们能够更好地匹配 Remotion Lambda 的功能,并实现分布式渲染。

🌐 Cloud Run is in Alpha and we are considering moving it to a model which re-uses the code of Remotion Lambda. This would allow us to better match the features of Remotion Lambda and enable distributed rendering.

目前,Cloud Run 的开发受到限制,因为每次更改都需要构建一个新的 Docker 镜像,这使得测试变慢。因此,我们目前只对现有的 Cloud Run 产品进行必要的更改。

🌐 Currently, the development of Cloud Run is hindered because a new Docker image needs to be built for each change, making testing slow. Therefore, we are currently only making essential changes to the current Cloud Run product.