Using the 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.
Content accelerated by the GPU
- WebGL content (Three.JS, Skia, P5.js, Mapbox etc.)
box-shadow
text-shadow
background-image: linear-gradient()
background-image: radial-gradient()
filter: blur()
filter: drop-shadow()
transform
- Many 2D Canvas operations
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.
Content not accelerated by the GPU
Contrary to popular belief, the following content is not accelerated by the GPU:
<Video>
<OffthreadVideo>
- Canvas pixel manipulation
Furthermore, the encoding of the video is not accelerated by the GPU at this point.
Use the --gl
flag to enable the GPU during rendering
See here for recommendations which OpenGL backend you should use during rendering.
GPU for server-side rendering
See here for an example on how to use the GPU during server-side rendering.
Using the GPU on Lambda
AWS Lambda instances have no GPU, so it is not possible to use it.
What are your experiences?
We'd love to learn and document more findings about the GPU. Let us know and we will amend this document!