Skip to content

🎥 Make videos programmatically with React

update docs

Jonny Burger8acf5bfd541a
diff --git a/packages/cli/src/browser-download-bar.ts b/packages/cli/src/browser-download-bar.ts
index df7afc7410..744bbb7fcd 100644
--- a/packages/cli/src/browser-download-bar.ts
+++ b/packages/cli/src/browser-download-bar.ts
@@ -42,7 +42,7 @@ export const defaultBrowserDownloadProgress = ({
if (chromeMode === 'chrome-for-testing') {
Log.info(
{indent, logLevel},
- 'Downloading Chrome for Testing https://www.remotion.dev/docs/miscellaneous/chrome-headless-shell',
+ 'Downloading Chrome for Testing https://www.remotion.dev/chrome-for-testing',
);
} else {
Log.info(
diff --git a/packages/docs/docs/miscellaneous/chrome-headless-shell.mdx b/packages/docs/docs/miscellaneous/chrome-headless-shell.mdx
index 2740c70f2a..faa92c1766 100644
--- a/packages/docs/docs/miscellaneous/chrome-headless-shell.mdx
+++ b/packages/docs/docs/miscellaneous/chrome-headless-shell.mdx
@@ -5,15 +5,9 @@ title: Chrome Headless Shell
crumb: 'FAQ'
---
-# Chrome Headless Shell and Chrome for Testing<AvailableFrom v="4.0.247"/>
+# Installing Chrome <AvailableFrom v="4.0.247"/>
-There are two modes that Remotion can use to render videos:
-
-- **Chrome Headless Shell**: Is faster for CPU-bound video rendering, and requires less dependencies and setup.
-- **Chrome for Testing**: Is faster for GPU-bound video rendering. Emulates a display surface and therefore requires more dependencies and
-
-From v4.0.208, Remotion will download [Chrome Headless Shell](https://developer.chrome.com/blog/chrome-headless-shell) before the first render.
-This will future-proof your Remotion project, because headless mode will be removed in a future version of Chrome.
+Remotion is automatically installing "Chrome Headless Shell" into your `node_modules` in order to render videos.
## Supported platforms
@@ -21,11 +15,12 @@ The following platforms are supported:
- macOS (x64 and arm64)
- Windows (x64)
-- Linux (x64 and arm64) - [install the Linux dependencies](/docs/miscellaneous/linux-dependencies)
+- Linux x64 - [install the Linux dependencies](/docs/miscellaneous/linux-dependencies)
+- Linux arm64 - only for "Chrome Headless Shell"
-## Ensure Headless Shell is available
+## Ensure Chrome is installed
-There are two ways to ensure Chrome Headless Shell is available:
+There are two ways to ensure Chrome Headless Shell is installed:
- [`npx remotion browser ensure`](/docs/cli/browser/ensure) on the command line
- [`ensureBrowser()`](/docs/renderer/ensure-browser) as a Node.js / Bun API
@@ -33,36 +28,68 @@ There are two ways to ensure Chrome Headless Shell is available:
It is recommended use call these functions if you do server-side rendering.
That way, if a request comes in wanting to render a video, the browser is already downloaded and ready to go.
-## Bring your own binary
+## Using Chrome for Testing instead
-If you don't want Chrome Headless Shell to get installed or your platform is not supported, you need to specify your own Chromium-based browser:
+There are two flavors ("modes") that Remotion can use to render videos:
-- Using the [`setBrowserExecutable()`](/docs/config#setbrowserexecutable) option in the config file (for the CLI)
-- Using the [`browserExecutable`](/docs/renderer/render-media) option in [`renderMedia()`](/docs/renderer/render-media) and other SSR APIs
+- **Chrome Headless Shell**: Is faster for CPU-bound video rendering, and requires less dependencies and setup.
+- **Chrome for Testing**: Is faster for GPU-bound video rendering. Emulates a display surface and therefore requires more dependencies and resources.
-In [Lambda](/docs/lambda) and [Cloud Run](/docs/cloudrun), a version of Chrome is already installed, so you don't need to do anything.
+You should use Chrome for Testing **only** if you want to set up a [GPU-accelerated rendering environment on Linux](/docs/miscellaneous/cloud-gpu).
-:::note
-In a future version of Chrome, headless mode in the desktop browser will stop being supported and you will need to use the Chrome Headless Shell.
-:::
+In order to use Chrome for testing instead:
+
+**In the CLI**: Pass `--chrome-mode="chrome-for-testing"` to `npx remotion render`, `npx remotion benchmark`, `npx remotion compositions` and `npx remotion still`.
+
+**In the API**: Pass `chromeMode: 'chrome-for-testing'` to your `renderFrames()`, `renderMedia()`, `renderStill()`, `selectComposition()` and `getComposition()` calls.
+
+**In the Studio**: Select "Chrome for Testing" in the "Chrome Mode" dropdown in the "Advanced" tab.
+
+**In the config file (only applies to the CLI and Studio)**: Set `Config.setChromeMode('chrome-for-testing')` in your `remotion.config.ts` file.
+
+**In Lambda and Cloud Run**: Not applicable, as Chrome for Testing is not supported.
## Download location
-Chrome Headless Shell will download to
+Chrome Headless Shell will download to this folder:
```
node_modules/.remotion/chrome-headless-shell/[platform]/chrome-headless-shell-[platform]
```
+An executable `./chrome-headless-shell` (`.\chrome-headless-shell.exe` on Windows) will be created.
+
+<hr />
+
+Chrome for Testing will download to this folder:
+
+```
+node_modules/.remotion/chrome-for-testing/[platform]
+```
+
+The file structure inside this folder is varies by OS.
+
+<hr />
+
`platform` can be one of `mac-arm64`, `mac-x64`, `linux64`, `linux-arm64` or `win64`.
-At this path, a folder with the necessary files will be created.
-An executable `./chrome-headless-shell` (`.\chrome-headless-shell.exe` on Windows) will be created.
+## Bring your own binary
+
+If you don't want Chrome Headless Shell or Chrome for Testing to get installed or your platform is not supported, you need to specify your own Chromium-based browser:
+
+- Using the [`setBrowserExecutable()`](/docs/config#setbrowserexecutable) option in the config file (for the CLI)
+- Using the [`browserExecutable`](/docs/renderer/render-media) option in [`renderMedia()`](/docs/renderer/render-media) and other SSR APIs
-## Why this change?
+In [Lambda](/docs/lambda) and [Cloud Run](/docs/cloudrun), a version of Chrome is already installed, so you don't need to do anything.
+
+:::note
+In a future version of Chrome, headless mode in the desktop browser will stop being supported and you will need to use the Chrome Headless Shell.
+:::
+
+## Why does Remotion manage Chrome?
Remotion previously used the desktop version of Chrome that many users had already installed.
-This workflow is bound to break at some point, which is why Remotion is not picking up the desktop version of Chrome anymore.
+This workflow broke at some point, because Chrome removed the headless mode and extracted it to "Chrome Headless Shell".
## Best practices
@@ -103,6 +130,14 @@ If you are using [Remotion Lambda](/docs/lambda) or [Cloud Run](/docs/cloudrun),
## Previous changes
+### Added option to install Chrome Headless Shell (v4.0.247)
+
+In order to enable GPU-accelerated workloads on Linux, Remotion now allows you to install Chrome for Testing.
+
+### Migrated to Chrome Headless Shell
+
+Because Chrome removed the headless mode from the desktop browser, Remotion now uses Chrome Headless Shell.
+
### Thorium (v4.0.18 - v4.0.135)
In these versions, if no local browser can be found, an instance of [Thorium](https://thorium.rocks/) is downloaded.
diff --git a/packages/docs/docs/miscellaneous/cloud-gpu-docker.mdx b/packages/docs/docs/miscellaneous/cloud-gpu-docker.mdx
index a84531f208..62be166fe8 100644
--- a/packages/docs/docs/miscellaneous/cloud-gpu-docker.mdx
+++ b/packages/docs/docs/miscellaneous/cloud-gpu-docker.mdx
@@ -2,9 +2,14 @@
image: /generated/articles-docs-miscellaneous-cloud-gpu-docker.png
title: Setup EC2 for Docker with GPU
sidebar_label: GPU in the cloud (Docker)
-crumb: "FAQ"
+crumb: 'FAQ'
---
+:::note
+The guide is outdated and will not work anymore.
+As of now, the [bare GPU guide](/docs/miscellaneous/cloud-gpu) is up to date.
+:::
+
Follow these steps closely to render videos on EC2 in a Docker container.
These steps are opinionated, but specify a reference that works.
@@ -20,8 +25,7 @@ We recommend to first follow these instructions and make changes once you have a
## Setup EC2 for Docker with GPU
-<Step>1</Step> Follow the instructions for <a href="/docs/miscellaneous/cloud-gpu">GPUs on EC2</a>
-. You can skip installing Chrome, Node.js and cloning the repo to render a video.
+<Step>1</Step> Follow the instructions for <a href="/docs/miscellaneous/cloud-gpu">GPUs on EC2</a>. You can skip installing Chrome, Node.js and cloning the repo to render a video.
<Step>2</Step> Install NVIDIA Container toolkit:
@@ -61,9 +65,7 @@ sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
```
-<Step>5</Step> Create two files, <code>Dockerfile</code> and <code>entrypoint.sh</code>
-. You can for example create them using the <code>nano ./file-to-create</code> command.
-Use <kbd>Ctrl</kbd>
+<Step>5</Step> Create two files, <code>Dockerfile</code> and <code>entrypoint.sh</code>. You can for example create them using the <code>nano ./file-to-create</code> command. Use <kbd>Ctrl</kbd>
<kbd>X</kbd> to save and quit. <br />
```bash title="Dockerfile"
@@ -108,12 +110,12 @@ Use the [`npx remotion gpu`](/docs/cli/gpu) command to get the output of `chrome
<Credits
contributors={[
{
- username: "UmungoBungo",
- contribution: "Workflow author",
+ username: 'UmungoBungo',
+ contribution: 'Workflow author',
},
{
- username: "kaf-lamed-beyt",
- contribution: "Writeup",
+ username: 'kaf-lamed-beyt',
+ contribution: 'Writeup',
},
]}
/>
diff --git a/packages/docs/docs/miscellaneous/cloud-gpu.mdx b/packages/docs/docs/miscellaneous/cloud-gpu.mdx
index d2d73e72d2..8b213dc1f6 100644
--- a/packages/docs/docs/miscellaneous/cloud-gpu.mdx
+++ b/packages/docs/docs/miscellaneous/cloud-gpu.mdx
@@ -2,11 +2,15 @@
image: /generated/articles-docs-miscellaneous-cloud-gpu.png
sidebar_label: GPU in the cloud (bare)
title: Using the GPU in the cloud
-crumb: "FAQ"
+crumb: 'FAQ'
---
Here is an example workflow for how to use the GPU in the cloud to render your videos using EC2 instances.
+## Update Remotion
+
+Ensure you are using Remotion v4.0.248 or later for this guide to work.
+
## Launch an EC2 instance
<Step>1</Step> <strong>Ensure you are allowed to use a GPU</strong>
@@ -18,8 +22,14 @@ You may also click [here](https://us-east-1.console.aws.amazon.com/servicequotas
<Step>2</Step> <strong>Launch an EC2 instance</strong>
-[Click here launch an EC2 instance on `us-east-1`](https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#LaunchInstances:).
-Select "Browse more AMIs", search for `ami-053b0d53c279acc90`, select the "Community AMIs" tab and select the image with the right AMI ("ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-20230516").
+[Click here to launch an EC2 instance on `us-east-1`](https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#LaunchInstances:).
+
+Select "Browse more AMIs", search for `ami-053b0d53c279acc90`, select the "Community AMIs" tab and select the image with the right AMI (`ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-20230516`).
+
+:::note
+It might take up to 30 seconds until the search finds the AMI and it is **not the first result.**
+:::
+
We recommend the `g4dn.xlarge` size - note that this instance costs $375 per month with the default configuration.
If you get a message "Subscribing to AMI is taking longer than expected", it is normal. You may need to wait a few minutes.
@@ -33,6 +43,25 @@ sudo bash -c "apt update && export DEBIAN_FRONTEND=noninteractive && export NEED
The instance will restart and therefore disconnect. Wait a few moments and then reconnect.
+Install the [Linux Dependencies](/docs/miscellaneous/linux-dependencies) for Remotion:
+
+```bash title="Install Linux Dependencies"
+sudo apt install -y \
+ libnss3 \
+ libdbus-1-3 \
+ libatk1.0-0 \
+ libasound2 \
+ libxrandr2 \
+ libxkbcommon-dev \
+ libxfixes3 \
+ libxcomposite1 \
+ libxdamage1 \
+ libgbm-dev \
+ libatk-bridge2.0-0
+```
+
+Set up GPU drivers:
+
```bash title="Install libvulkan"
sudo apt install -y build-essential libvulkan1
```
@@ -60,13 +89,6 @@ sudo systemctl enable nvidia-smi.service
sudo systemctl start nvidia-smi.service
```
-```bash title="Install Chrome"
-curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor -o /usr/share/keyrings/googlechrom-keyring.gpg
-echo "deb [arch=amd64 signed-by=/usr/share/keyrings/googlechrom-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
-sudo apt update
-sudo apt install -y google-chrome-stable curl gnupg ca-certificates
-```
-
```bash title="Install Node.js"
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
@@ -78,27 +100,39 @@ sudo apt-get update
sudo apt-get install nodejs -y
```
-<Step>4</Step> <strong>Render a video with the GPU</strong><br/>
+<p>
+ <Step>4</Step> <strong>Render a video with the GPU</strong>
+</p>
```bash title="Clone a Remotion GPU demo"
git clone https://github.com/remotion-dev/gpu-scene
cd gpu-scene
npm i
-npx remotion render --browser-executable=/usr/bin/google-chrome-stable --gl=angle-egl --enable-multiprocess-on-linux
+npx remotion gpu --chrome-mode="chrome-for-testing" --gl=vulkan # Verify content is hardware accelerated
+npx remotion render --chrome-mode="chrome-for-testing" --gl=vulkan # Render a test video
```
+With `--chrome-mode="chrome-for-testing"`, a flavor of Chrome is used that emulates a display, which can make use of the GPU.
+With `--gl=vulkan`, Chrome uses the right OpenGL renderer.
+
+:::note
+Warnings such as ` vkCreateInstance() failed: -7` and `Failed to create and initialize Vulkan implementation.` may show up, however, the render should be significantly faster.
+:::
+
## See also
- [Run this in a Docker container](/docs/miscellaneous/cloud-gpu-docker)
- [How To Enable Hardware Acceleration on Chrome, Chromium & Puppeteer on AWS in Headless mode](https://mirzabilal.com/how-to-enable-hardware-acceleration-on-chrome-chromium-puppeteer-on-aws-in-headless-mode), on which this document is based on.
-<Credits contributors={[
-{
-username: "bilalmughal",
-contribution: "Research and writing"
-},
-{
-username: "UmungoBungo",
-contribution: "Research"
-},
-]} />
+<Credits
+ contributors={[
+ {
+ username: 'bilalmughal',
+ contribution: 'Research and writing',
+ },
+ {
+ username: 'UmungoBungo',
+ contribution: 'Research',
+ },
+ ]}
+/>
diff --git a/packages/docs/docs/miscellaneous/linux-dependencies.mdx b/packages/docs/docs/miscellaneous/linux-dependencies.mdx
index c9e33b3fc0..165a6334a7 100644
--- a/packages/docs/docs/miscellaneous/linux-dependencies.mdx
+++ b/packages/docs/docs/miscellaneous/linux-dependencies.mdx
@@ -10,7 +10,7 @@ If you are on Linux, Chrome Headless Shell requires some shared libraries to be
## Ubuntu 24.04
```bash
-RUN apt install -y \
+apt install -y \
libnss3 \
libdbus-1-3 \
libatk1.0-0 \
@@ -27,7 +27,7 @@ RUN apt install -y \
## Older versions of Ubuntu
```bash
-RUN apt install -y \
+apt install -y \
libnss3 \
libdbus-1-3 \
libatk1.0-0 \
@@ -44,7 +44,7 @@ RUN apt install -y \
## Debian
```bash
-RUN apt install -y \
+apt install -y \
libnss3 \
libdbus-1-3 \
libatk1.0-0 \
@@ -64,7 +64,7 @@ RUN apt install -y \
## Amazon Linux 2023
```bash
-RUN yum install -y \
+yum install -y \
mesa-libgbm \
libX11 \
libXrandr\
diff --git a/packages/docs/vercel.json b/packages/docs/vercel.json
index 1af8895d4e..863a7d02d5 100644
--- a/packages/docs/vercel.json
+++ b/packages/docs/vercel.json
@@ -327,6 +327,11 @@
"destination": "/docs/miscellaneous/chrome-headless-shell",
"permanent": false
},
+ {
+ "source": "/chrome-for-testing",
+ "destination": "/docs/miscellaneous/chrome-headless-shell#using-chrome-for-testing-instead",
+ "permanent": false
+ },
{
"source": "/media-parser",
"destination": "/docs/media-parser",
diff --git a/packages/renderer/src/browser/browser-download-progress-bar.ts b/packages/renderer/src/browser/browser-download-progress-bar.ts
index dc5dac0db9..faa9190264 100644
--- a/packages/renderer/src/browser/browser-download-progress-bar.ts
+++ b/packages/renderer/src/browser/browser-download-progress-bar.ts
@@ -17,12 +17,12 @@ export const defaultBrowserDownloadProgress =
if (chromeMode === 'chrome-for-testing') {
Log.info(
{indent, logLevel},
- 'Downloading Chrome for Testing https://www.remotion.dev/docs/miscellaneous/chrome-headless-shell',
+ 'Downloading Chrome for Testing https://www.remotion.dev/chrome-for-testing',
);
} else {
Log.info(
{indent, logLevel},
- 'Downloading Chrome Headless Shell https://www.remotion.dev/docs/miscellaneous/chrome-headless-shell',
+ 'Downloading Chrome Headless Shell https://www.remotion.dev/chrome-headless-shell',
);
}
Log.info(
diff --git a/packages/renderer/src/options/chrome-mode.tsx b/packages/renderer/src/options/chrome-mode.tsx
index b5947a2edf..204a14be73 100644
--- a/packages/renderer/src/options/chrome-mode.tsx
+++ b/packages/renderer/src/options/chrome-mode.tsx
@@ -31,7 +31,7 @@ export const chromeModeOption = {
</>
);
},
- docLink: 'https://www.remotion.dev/docs/miscellaneous/chrome-headless-shell',
+ docLink: 'https://www.remotion.dev/chrome-for-testing',
getValue: ({commandLine}) => {
if (commandLine[cliFlag]) {
if (