Skip to content

🎥 Make videos programmatically with React

update docs

Jonny Burger281194815ecf
diff --git a/packages/docs/docs/gpu.md b/packages/docs/docs/gpu.md
index 75c3d90545..8d21d50ce5 100644
--- a/packages/docs/docs/gpu.md
+++ b/packages/docs/docs/gpu.md
@@ -6,28 +6,42 @@ sidebar_label: Using the GPU
crumb: "Need for Speed"
---
-Some types of content in Remotion can benefit from a GPU being available on the machine that is used for rendering. That is:
+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.
-- WebGL content (Three.JS, Skia, P5.js, Mapbox etc.)
-- 2D Canvas graphics
-- GPU-accelerated CSS properties such as `box-shadow`, `text-shadow`, `background-image: linear-gradient()`, `background-image: radial-gradient()`, `filter: blur()`, `filter: drop-shadow()`
+## Content accelerated by the 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
+- 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.
-## Use `--gl=angle` for local renders
+## Content not accelerated by the GPU
+
+Contrary to popular belief, the following content is not accelerated by the GPU:
-Since Chrome 98, the GPU can be used in headless mode. Adding `--gl=angle` (or `{chromiumOptions: {gl: "angle"}}` for the Node.JS APIs), we find that a video rendered on a `<canvas>` on macOS is many times faster compared to rendering without the flag.
+- `<Video>`
+- `<OffthreadVideo>`
+- [Canvas pixel manipulation](/docs/video-manipulation)
-However, there seems to be memory leak from Chrome that may kill a long render, therefore we don't set `angle` as default. We recommend to render long videos that use the GPU in multiple parts.
+Furthermore, the encoding of the video is not accelerated by the GPU at this point.
-## Use `--gl=swangle` for Lambda
+## Use the `--gl` flag to enable the GPU during rendering
-Since Lambda does not have a GPU, the content has to be rendered using software. You can still render all types of content without having a GPU, it will just be slower. The best way to do so is by passing `--gl=swangle` if you are rendering using the CLI, or passing `{chromiumOptions: {gl: "swangle"}}` if using the Node.JS APIs.
+See [here](/docs/gl-options) for recommendations which OpenGL backend you should use during rendering.
-## Considerations
+## GPU for server-side rendering
-For rendering content that can benefit from a GPU, you might want to choose a cloud rendering solution to which a GPU can be attached to over AWS Lambda (which does not have a GPU). Most bigger cloud providers have some GPU-enabled VPS offerings. Apple M1 VPS instances might also be able to accelerate graphics rendering and be more economical than VPS instances with desktop graphic cards.
+[See here](/docs/miscellaneous/cloud-gpu) for an example on how to use the GPU during server-side rendering.
## Using the GPU on Lambda
diff --git a/packages/docs/docs/open-gl.md b/packages/docs/docs/open-gl.md
index 201287ef20..2f279573ab 100644
--- a/packages/docs/docs/open-gl.md
+++ b/packages/docs/docs/open-gl.md
@@ -9,24 +9,32 @@ When rendering a video in Remotion, different [GL](https://en.wikipedia.org/wiki
The following renderer backends are supported in Remotion:
-- <code>null</code> - default
+- <code>null</code> - default, lets Chrome decide
- <code>angle</code>
- <code>egl</code>
- <code>swiftshader</code>
- <code>vulkan</code> (from Remotion v4.0.41)
+- <code>angle-egl</code> (from Remotion v4.0.52)
- <code>swangle</code> - default on Lambda
-## Using the GPU
+## Recommended renderers
-In cases where a GPU could be beneficial for rendering, it can often make sense to use the <code>angle</code> renderer. An in-depth explanation when and how to use it is given in [this article](/docs/gpu).
+<Step>1</Step> If you use WebGL/Three.js:
-Memory leaks are a known problem with <code>angle</code>. We recommend to split up long renders into multiple parts when rendering large videos, since sometimes renders can fail due to memory leaks.
+- On a desktop, `angle` is recommended
+- On a [cloud instance with a GPU](/docs/miscellaneous/cloud-gpu), `angle-egl` is recommended
+- On Lambda, use `swangle` (default on Lambda)
+- On a machine with no GPU, `swangle` is recommended. Rendering might be slow.
-It's also worth mentioning, that currently GitHub Actions will fail when using <code>angle</code>, since actions don't have a GPU.
+<Step>2</Step> If you don't use WebGL/Three.js, the default renderer (<code>null</code> on local, <code>swangle</code> on Lambda) are the best choice.<br/>
+
+## Using the GPU
-## The <code>angle</code> alternative if there is no GPU available
+In cases where a GPU could be beneficial for rendering, it can often make sense to use the <code>angle</code> renderer (<code>angle-egl</code> on Linux). An in-depth explanation when and how to use it is given in [this article](/docs/gpu).
-If you are rendering in an environment which has no GPU, the <code>angle</code> renderer can't be used and <code>swangle</code> should be utilized instead.
+⚠️ Memory leaks are a known problem with <code>angle</code>. We recommend to split up long renders into multiple parts when rendering large videos, since sometimes renders can fail due to memory leaks.
+
+Currently, GitHub Actions will fail when using <code>angle</code>, since Actions runners don't have a GPU.
## Selecting the renderer backend
@@ -36,7 +44,7 @@ The renderer backend can be set in different ways:
In [`getCompositions()`](/docs/renderer/get-compositions#gl), [`renderStill()`](/docs/renderer/render-still#gl), [`renderMedia()`](/docs/renderer/render-media#gl), [`renderFrames()`](/docs/renderer/render-frames#gl), [`getCompositionsOnLambda()`](/docs/lambda/getcompositionsonlambda#gl), [`renderStillOnLambda()`](/docs/lambda/renderstillonlambda#gl) and [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda#gl), you can pass [`chromiumOptions.gl`](/docs/renderer/render-still#gl).
-### Via config file
+### Via Config file
```tsx twoslash
import { Config } from "@remotion/cli/config";
@@ -47,25 +55,16 @@ Config.setChromiumOpenGlRenderer("angle");
```
:::note
-Prior to `v3.3.39`, the option was called `Config.Puppeteer.setChromiumOpenGlRenderer()`.
+The config file only applies to CLI commands.
:::
-### Via CLI flag
-
-Pass [`--gl=swiftshader`](/docs/cli) in one of the following commands: [`remotion render`](/docs/cli/render), [`remotion compositions`](/docs/cli/compositions), [`remotion still`](/docs/cli/still), [`remotion lambda render`](/docs/lambda/cli/render), [`remotion lambda still`](/docs/lambda/cli/still), [`remotion lambda compositions`](/docs/lambda/cli/compositions).
-
:::note
-If a CLI flag gets passed, the settings defined in the <code>remotion.config.ts</code> will be overwritten.
+Prior to `v3.3.39`, the option was called `Config.Puppeteer.setChromiumOpenGlRenderer()`.
:::
-## Recommended renderers
-
-Generaly speaking, in most cases the default renderer (<code>null</code> on local, <code>swangle</code> on Lambda) are the best choice.
-
-If you use ThreeJS, <code>angle</code> (<code>swangle</code> on Lambda) has to be used.
+### Via CLI flag
-Based on our research online, it seems that <code>swiftshader</code> is an old mode and <code>swangle</code> is the successor.
-Therefore, if you thought about using <code>swiftshader</code>, we recommend to use the <code>swangle</code> instead.
+Pass [`--gl=[angle,swangle,...]`](/docs/cli) in one of the following commands: [`remotion render`](/docs/cli/render), [`remotion compositions`](/docs/cli/compositions), [`remotion still`](/docs/cli/still), [`remotion lambda render`](/docs/lambda/cli/render), [`remotion lambda still`](/docs/lambda/cli/still), [`remotion lambda compositions`](/docs/lambda/cli/compositions).
## See also