Skip to main content

使用GPU

Remotion 中的一些类型的内容可以从用于渲染的机器上有可用的 GPU 中受益。默认情况下,在许多情况下,GPU 在无头模式下是禁用的,这可能导致渲染时间显著增加。

🌐 Some types of content in Remotion can benefit from a GPU being available on the machine that is used for rendering.
By default in many cases, the GPU is disabled in headless mode, which can lead to a significant slowdown in rendering time.

由 GPU 加速的内容

🌐 Content accelerated by the GPU

  • WebGL 内容(Three.JS、Skia、P5.js、Mapbox 等)
  • box-shadow
  • text-shadow
  • background-image: linear-gradient()
  • background-image: radial-gradient()
  • filter: blur()
  • filter: drop-shadow()
  • transform
  • 许多二维画布操作

如果有 GPU 可用,在 Remotion Studio 或 Remotion Player 中它应该默认启用。 然而,在无头模式下,Chromium 会禁用 GPU,从而导致渲染时间显著变慢。

🌐 If a GPU is available, it should be enabled by default while in the Remotion Studio or Remotion Player.
However, in headless mode, Chromium disables the GPU, leading to a significant slowdown in rendering time.

未由 GPU 加速的内容

🌐 Content not accelerated by the GPU

与普遍看法相反,以下内容并不由 GPU 加速:

🌐 Contrary to popular belief, the following content is not accelerated by the GPU:

此外,此时视频的编码并没有被 GPU 加速。

🌐 Furthermore, the encoding of the video is not accelerated by the GPU at this point.

使用 --gl 标志在渲染期间启用 GPU

🌐 Use the --gl flag to enable the GPU during rendering

请参见 这里 了解在渲染过程中应该使用哪种 OpenGL 后端的建议。

🌐 See here for recommendations which OpenGL backend you should use during rendering.

用于服务器端渲染的GPU

🌐 GPU for server-side rendering

查看这里 了解在服务器端渲染中如何使用 GPU 的示例。

在 Lambda 上使用 GPU

🌐 Using the GPU on Lambda

AWS Lambda 实例没有 GPU,所以无法使用它。

🌐 AWS Lambda instances have no GPU, so it is not possible to use it.

你的经历是什么?

🌐 What are your experiences?

我们非常希望了解并记录更多关于 GPU 的发现。请告诉我们,我们会修改这份文档!

🌐 We'd love to learn and document more findings about the GPU. Let us know and we will amend this document!

另请参阅

🌐 See also