Skip to content

🎥 Make videos programmatically with React

no linux 2023

Jonny Burgerc40df5569b8f
diff --git a/packages/renderer/src/browser/BrowserFetcher.ts b/packages/renderer/src/browser/BrowserFetcher.ts
index a8699afdbf..4bf7207831 100644
--- a/packages/renderer/src/browser/BrowserFetcher.ts
+++ b/packages/renderer/src/browser/BrowserFetcher.ts
@@ -29,6 +29,7 @@ import {ChromeMode} from '../options/chrome-mode';
import type {DownloadBrowserProgressFn} from '../options/on-browser-download';
import {
getChromeDownloadUrl,
+ isAmazonLinux2023,
logDownloadUrl,
type Platform,
TESTED_VERSION,
@@ -183,22 +184,33 @@ export const downloadBrowser = async ({
abortSignal: new AbortController().signal,
});
await extractZip(archivePath, {dir: outputPath});
- const chromePath = path.join(outputPath, 'chrome-linux', 'chrome');
- const chromeHeadlessShellPath = path.join(
- outputPath,
- 'chrome-linux',
- 'chrome-headless-shell',
- );
- if (fs.existsSync(chromePath)) {
- fs.renameSync(chromePath, chromeHeadlessShellPath);
- }
- const chromeLinuxFolder = path.join(outputPath, 'chrome-linux');
- if (fs.existsSync(chromeLinuxFolder)) {
- fs.renameSync(
- chromeLinuxFolder,
- path.join(outputPath, 'chrome-headless-shell-linux-arm64'),
- );
+ const possibleSubdirs = [
+ 'chrome-linux',
+ 'chrome-headless-shell-linux64',
+ 'chromium-headless-shell-amazon-linux2023-arm64',
+ 'chromium-headless-shell-amazon-linux2023-x64',
+ ];
+
+ for (const subdir of possibleSubdirs) {
+ const chromeLinuxFolder = path.join(outputPath, subdir);
+ const chromePath = path.join(chromeLinuxFolder, 'chrome');
+
+ if (fs.existsSync(chromePath)) {
+ const chromeHeadlessShellPath = path.join(
+ chromeLinuxFolder,
+ 'chrome-headless-shell',
+ );
+
+ fs.renameSync(chromePath, chromeHeadlessShellPath);
+ }
+
+ if (fs.existsSync(chromeLinuxFolder)) {
+ fs.renameSync(
+ chromeLinuxFolder,
+ path.join(outputPath, 'chrome-headless-shell-' + platform),
+ );
+ }
}
} catch (err) {
return Promise.reject(err);
@@ -248,7 +260,7 @@ const getExecutablePath = (chromeMode: ChromeMode) => {
`chrome-headless-shell-${platform}`,
platform === 'win64'
? 'chrome-headless-shell.exe'
- : platform === 'linux-arm64'
+ : platform === 'linux-arm64' || isAmazonLinux2023()
? 'headless_shell'
: 'chrome-headless-shell',
);
diff --git a/packages/renderer/src/browser/get-chrome-download-url.ts b/packages/renderer/src/browser/get-chrome-download-url.ts
index d01dbd06f8..9a7110ab0b 100644
--- a/packages/renderer/src/browser/get-chrome-download-url.ts
+++ b/packages/renderer/src/browser/get-chrome-download-url.ts
@@ -16,7 +16,7 @@ export type Platform =
| 'mac-arm64'
| 'win64';
-const isAmazonLinux2023 = (): boolean => {
+export const isAmazonLinux2023 = (): boolean => {
if (os.platform() !== 'linux') {
return false;
}
@@ -129,6 +129,12 @@ export function getChromeDownloadUrl({
}
if (chromeMode === 'headless-shell') {
+ // Amazon Linux 2023 needs a special build.
+ // This binary is compatible with older glibc (no 2.35 requirement).
+ if (isAmazonLinux2023() && platform === 'linux64' && !version) {
+ return `https://remotion.media/chromium-headless-shell-amazon-linux-x64-144.0.7559.20.zip`;
+ }
+
if (platform === 'linux64' && version === null) {
if (canUseRemotionMediaBinaries()) {
return `https://remotion.media/chromium-headless-shell-linux-x64-${TESTED_VERSION}.zip?clearcache`;