我可以在边缘渲染视频吗?
边缘运行时,例如 Vercel Edge 函数和 Cloudflare Workers,承诺将改变我们未来的计算方式。
🌐 Edge runtimes such as Vercel Edge functions and Cloudflare Workers promise to change how we compute in the future.
不幸的是,由于在边缘函数中施加了非常严格的限制,目前无法在“edge”上渲染 Remotion 视频,并且在可预见的未来也很可能无法实现。
🌐 Unfortunately, it is not possible to render Remotion videos on the “edge” and will most likely not be possible in the foreseeable future due to very heavy constraints being placed in edge functions.
以下限制目前使得无法在边缘设备上播放视频:
🌐 The following constraints currently make it impossible to render videos on the edge:
- 缺少文件系统 API:
fs模块在边缘不可用。 - 有限的执行时间: 在 Vercel 上,边缘函数必须在 30 秒内响应;在 Cloudflare Workers 上,函数只能运行 10 毫秒。
- 代码大小限制:在 Vercel 上,函数的最大大小为 4MB,在 Cloudflare Workers 上为 5MB。由于 Chrome 和 FFmpeg 是依赖,Remotion 目前大约需要 150MB 的空间。
- 内存限制: Vercel Edge Functions 仅提供 128MB 的 RAM。Remotion 目前在 2GB 以上的 RAM 下效果最佳。