Skip to content

🎥 Make videos programmatically with React

`@remotion/renderer`: Replace Thorium with Chrome Headless Shell

Jonny Burgere11a2c59b0ad
diff --git a/packages/docs/docs/media-playback-error.md b/packages/docs/docs/media-playback-error.mdx
similarity index 93%
rename from packages/docs/docs/media-playback-error.md
rename to packages/docs/docs/media-playback-error.mdx
index 2ad3fb4600..26a4552b6e 100644
--- a/packages/docs/docs/media-playback-error.md
+++ b/packages/docs/docs/media-playback-error.mdx
@@ -29,7 +29,7 @@ Unlike Google Chrome, the Chromium Browser does not include proprietary codecs.
**Workaround 2**: Convert videos to WebM, [use Chrome instead of Chromium](/docs/config#setbrowserexecutable), or use [`<OffthreadVideo>`](/docs/offthreadvideo).
:::note
-Until `v4.0.17`, Remotion would download Chromium if no local browser was found. Starting from `v4.0.18`, Remotion will download [Thorium](https://thorium.rocks/) instead, which includes the codecs needed to render videos.
+Since `v4.0.18`, [downloads a browser](/docs/miscellaneous/chrome-headless-shell) that includes codecs automatically if you don't have a local browser.
:::
## Invalid source
diff --git a/packages/docs/docs/miscellaneous/thorium-browser.md b/packages/docs/docs/miscellaneous/chrome-headless-shell.md
similarity index 58%
rename from packages/docs/docs/miscellaneous/thorium-browser.md
rename to packages/docs/docs/miscellaneous/chrome-headless-shell.md
index 7286e47f99..a3f221ed9f 100644
--- a/packages/docs/docs/miscellaneous/thorium-browser.md
+++ b/packages/docs/docs/miscellaneous/chrome-headless-shell.md
@@ -1,28 +1,36 @@
---
-image: /generated/articles-docs-miscellaneous-thorium-browser.png
-sidebar_label: Thorium browser
-title: Thorium browser
+image: /generated/articles-docs-miscellaneous-chrome-headless-shell.png
+sidebar_label: Chromium Headless Shell
+title: Chrome Headless Shell
crumb: "FAQ"
---
-Starting from `v4.0.18`, if no local browser can be found, an instance of [Thorium](https://thorium.rocks/) will be downloaded.
-In previous versions, Remotion would download the free version of Chromium, which would not include codecs for the proprietary H.264 and H.265 codecs.
-This would often lead to problems when using the [`<Video>`](/docs/video) tag.
+Remotion will download [Chrome Headless Shell](https://developer.chrome.com/blog/chrome-headless-shell) if no local browser can be found and an API for rendering videos is used.
-Thorium is a free and open-source browser forked off Chromium, which includes the codecs needed to render videos.
The following platforms are supported:
- Linux (x64)
- Windows (x64)
- macOS (x64 and arm64)
-If you don't want Thorium to get downloaded or your platform is not supported, you need to specify your own Chromium-based browser:
+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:
- 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
In [Lambda](/docs/lambda) and [Cloud Run](/docs/cloudrun), a version of Chrome is already installed, so you don't need to do anything.
+## For versions 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.
+
+Thorium is a free and open-source browser forked off Chromium, which includes the codecs needed to render videos.
+
+## Versions before v4.0.18
+
+In previous versions, Remotion would download the free version of Chromium, which would not include codecs for the proprietary H.264 and H.265 codecs.
+This would often lead to problems when using the [`<Video>`](/docs/video) tag.
+
## See also
- [Media playback error](/docs/media-playback-error)
diff --git a/packages/docs/docs/miscellaneous/video-formats.md b/packages/docs/docs/miscellaneous/video-formats.md
index 7364b7fdc3..0891fc52f6 100644
--- a/packages/docs/docs/miscellaneous/video-formats.md
+++ b/packages/docs/docs/miscellaneous/video-formats.md
@@ -14,7 +14,7 @@ During rendering this means that the Chrome codecs are supported. In the [Remoti
Codec support varies between browsers and changes from time to time. Refer to this [MDN article](https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Video_codecs) for browser support.
:::note
-Prior to v4.0.18, if you did not have a local copy of Chrome, Remotion would download a copy of Chromium which [would not support the proprietary H.264 and H.265 codecs](/docs/miscellaneous/thorium-browser).
+Prior to v4.0.18, if you did not have a local copy of Chrome, Remotion would download a copy of Chromium which [would not support the proprietary H.264 and H.265 codecs](/docs/miscellaneous/chrome-headless-shell).
:::
**Codecs supported for [`<OffthreadVideo>`](/docs/offthreadvideo)**: The same support that applies to `<Video>` applies to `<OffthreadVideo>` as well, however, more codecs can be supported during rendering since FFmpeg is used under the hood to read the video file. We however don't maintain an exact list of supported video codecs.
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index f74b917650..aa61578215 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -843,7 +843,7 @@ module.exports = {
"security",
"chromium-flags",
"miscellaneous/changing-temp-dir",
- "miscellaneous/thorium-browser",
+ "miscellaneous/chrome-headless-shell",
"gl-options",
"bun",
"standalone",
diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.ts
index a0970d4225..7c0fc33fe7 100644
--- a/packages/docs/src/data/articles.ts
+++ b/packages/docs/src/data/articles.ts
@@ -1457,8 +1457,8 @@ export const articles = [
},
{
id: "layout-utils/best-practices",
- title: "Best practices for using @remotion/layout-utils",
- relativePath: "docs/layout-utils/best-practices.md",
+ title: "Best practices for @remotion/layout-utils",
+ relativePath: "docs/layout-utils/best-practices.mdx",
compId: "articles-docs-layout-utils-best-practices",
crumb: "@remotion/layout-utils",
},
@@ -1570,7 +1570,7 @@ export const articles = [
{
id: "media-playback-error",
title: "Could not play video/audio with src",
- relativePath: "docs/media-playback-error.md",
+ relativePath: "docs/media-playback-error.mdx",
compId: "articles-docs-media-playback-error",
crumb: "Troubleshooting",
},
@@ -1602,6 +1602,13 @@ export const articles = [
compId: "articles-docs-miscellaneous-changing-temp-dir",
crumb: "Advanced configuration",
},
+ {
+ id: "miscellaneous/chrome-headless-shell",
+ title: "Chrome Headless Shell",
+ relativePath: "docs/miscellaneous/chrome-headless-shell.md",
+ compId: "articles-docs-miscellaneous-chrome-headless-shell",
+ crumb: "FAQ",
+ },
{
id: "miscellaneous/cloud-gpu-docker",
title: "Setup EC2 for Docker with GPU",
@@ -1702,13 +1709,6 @@ export const articles = [
compId: "articles-docs-miscellaneous-snippets-use-delay-render",
crumb: "Snippets",
},
- {
- id: "miscellaneous/thorium-browser",
- title: "Thorium browser",
- relativePath: "docs/miscellaneous/thorium-browser.md",
- compId: "articles-docs-miscellaneous-thorium-browser",
- crumb: "FAQ",
- },
{
id: "typescript-aliases",
title: "TypeScript aliases",
diff --git a/packages/docs/static/generated/articles-docs-miscellaneous-chrome-headless-shell.png b/packages/docs/static/generated/articles-docs-miscellaneous-chrome-headless-shell.png
new file mode 100644
index 0000000000..2f1a7a44a9
Binary files /dev/null and b/packages/docs/static/generated/articles-docs-miscellaneous-chrome-headless-shell.png differ
diff --git a/packages/renderer/src/browser/BrowserFetcher.ts b/packages/renderer/src/browser/BrowserFetcher.ts
index 226980d7fc..5fe5cf65da 100644
--- a/packages/renderer/src/browser/BrowserFetcher.ts
+++ b/packages/renderer/src/browser/BrowserFetcher.ts
@@ -31,17 +31,18 @@ import {getDownloadsCacheDir} from './get-download-destination';
const downloadURLs: Record<Platform, string> = {
linux:
- 'https://github.com/Alex313031/thorium/releases/download/M117.0.5938.157/thorium-browser_117.0.5938.157_amd64.zip',
- mac: 'https://github.com/Alex313031/Thorium-MacOS/releases/download/M116.0.5845.169/Thorium_MacOS_X64.dmg',
- mac_arm:
- 'https://github.com/Alex313031/Thorium-MacOS/releases/download/M116.0.5845.169/Thorium_MacOS_ARM.dmg',
+ 'https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.86/linux64/chrome-headless-shell-linux64.zip',
+ 'mac-x64':
+ 'https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.86/mac-x64/chrome-headless-shell-mac-x64.zip',
+ 'mac-arm64':
+ 'https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.86/mac-arm64/chrome-headless-shell-mac-arm64.zip',
win64:
- 'https://github.com/Alex313031/Thorium-Win/releases/download/M117.0.5938.157/Thorium_117.0.5938.157.zip',
+ 'https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.86/win64/chrome-headless-shell-win64.zip',
};
-type Platform = 'linux' | 'mac' | 'mac_arm' | 'win64';
+type Platform = 'linux' | 'mac-x64' | 'mac-arm64' | 'win64';
-function getThoriumDownloadUrl(platform: Platform): string {
+function getChromeDownloadUrl(platform: Platform): string {
return downloadURLs[platform];
}
@@ -69,7 +70,7 @@ const getPlatform = (): Platform => {
const platform = os.platform();
switch (platform) {
case 'darwin':
- return os.arch() === 'arm64' ? 'mac_arm' : 'mac';
+ return os.arch() === 'arm64' ? 'mac-arm64' : 'mac-x64';
case 'linux':
return 'linux';
case 'win32':
@@ -79,7 +80,7 @@ const getPlatform = (): Platform => {
}
};
-const destination = '.thorium';
+const destination = '.chrome_headless_shell';
const getDownloadsFolder = () => {
return path.join(getDownloadsCacheDir(), destination);
@@ -90,7 +91,7 @@ export const downloadBrowser = async (options: {
indent: boolean;
}): Promise<BrowserFetcherRevisionInfo | undefined> => {
const platform = getPlatform();
- const downloadURL = getThoriumDownloadUrl(platform);
+ const downloadURL = getChromeDownloadUrl(platform);
const fileName = downloadURL.split('/').pop();
assert(fileName, `A malformed download URL was found: ${downloadURL}.`);
const downloadsFolder = getDownloadsFolder();
@@ -127,7 +128,7 @@ export const downloadBrowser = async (options: {
Log.info(
{indent: options.indent, logLevel: options.logLevel},
- `Downloading Thorium - ${toMegabytes(
+ `Downloading Chrome Headless Shell - ${toMegabytes(
progress.downloaded,
)}/${toMegabytes(progress.totalSize as number)}`,
);
@@ -158,16 +159,24 @@ const getExecutablePath = () => {
const platform = getPlatform();
const folderPath = getFolderPath(downloadsFolder, platform);
- if (platform === 'mac' || platform === 'mac_arm') {
- return path.join(folderPath, 'Thorium.app', 'Contents', 'MacOS', 'Thorium');
- }
-
- if (platform === 'linux') {
- return path.join(folderPath, 'thorium');
+ if (
+ platform === 'mac-x64' ||
+ platform === 'mac-arm64' ||
+ platform === 'linux'
+ ) {
+ return path.join(
+ folderPath,
+ `chrome-headless-shell-${platform}`,
+ 'chrome-headless-shell',
+ );
}
if (platform === 'win64') {
- return path.join(folderPath, 'BIN', 'thorium.exe');
+ return path.join(
+ folderPath,
+ `chrome-headless-shell-${platform}`,
+ 'chrome-headless-shell.exe',
+ );
}
throw new Error('Can not download browser for platform: ' + platform);
@@ -179,7 +188,7 @@ export const getRevisionInfo = (): BrowserFetcherRevisionInfo => {
const platform = getPlatform();
const folderPath = getFolderPath(downloadsFolder, platform);
- const url = getThoriumDownloadUrl(platform);
+ const url = getChromeDownloadUrl(platform);
const local = fs.existsSync(folderPath);
return {
executablePath,
diff --git a/vercel.json b/vercel.json
index e54cd83815..cc8d201ee2 100644
--- a/vercel.json
+++ b/vercel.json
@@ -302,6 +302,11 @@
"destination": "/blog/faster-lambda",
"permanent": false
},
+ {
+ "source": "/docs/miscellaneous/thorium-browser",
+ "destination": "/docs/miscellaneous/chrome-headless-shell",
+ "permanent": false
+ },
{
"source": "/recorder",
"destination": "/docs/recorder",