Skip to content

🎥 Make videos programmatically with React

Ffmpeg download for linux arm64

Patric Salvisberg83e00ac8b053
diff --git a/packages/renderer/src/ffmpeg-flags.ts b/packages/renderer/src/ffmpeg-flags.ts
index 2d5639a219..58481492c9 100644
--- a/packages/renderer/src/ffmpeg-flags.ts
+++ b/packages/renderer/src/ffmpeg-flags.ts
@@ -72,6 +72,7 @@ export const getFfmpegVersion = async (options: {
};
export const downloadFfmpeg = async (): Promise<void> => {
+ // implement callback instead
const decoyFunction = () => {
return undefined;
};
@@ -89,23 +90,22 @@ export const downloadFfmpeg = async (): Promise<void> => {
console.log(destinationPath);
let url: string;
- const isWin = os.platform() === 'win32';
-
- if (isWin) {
+ if (os.platform() === 'win32') {
url =
'https://remotion-ffmpeg-binaries.s3.eu-central-1.amazonaws.com/ffmpeg-win-x86.exe';
- } else if (process.arch === 'x64') {
+ } else if (os.platform() === 'darwin') {
url =
- 'https://remotion-ffmpeg-binaries.s3.eu-central-1.amazonaws.com/ffmpeg-macos-arm64';
+ process.arch === 'arm64'
+ ? 'https://remotion-ffmpeg-binaries.s3.eu-central-1.amazonaws.com/ffmpeg-macos-arm64'
+ : 'https://remotion-ffmpeg-binaries.s3.eu-central-1.amazonaws.com/ffmpeg-macos-x86';
} else {
- console.log('download for x86');
url =
- 'https://remotion-ffmpeg-binaries.s3.eu-central-1.amazonaws.com/ffmpeg-macos-x86';
+ 'https://remotion-ffmpeg-binaries.s3.eu-central-1.amazonaws.com/ffmpeg-linux-amd64';
}
try {
await _downloadFile(url, destinationPath, decoyFunction);
- if (!isWin) {
+ if (os.platform() !== 'win32') {
fs.chmodSync(destinationPath, '755');
}
} catch (error) {
@@ -152,7 +152,5 @@ export const getExecutableFfmpeg = async (
);
}
- await downloadFfmpeg();
-
return getFfmpegBinaryFromNodeModules();
};
diff --git a/packages/renderer/src/validate-ffmpeg.ts b/packages/renderer/src/validate-ffmpeg.ts
index c48ed6f765..c3b7fcdd0a 100644
--- a/packages/renderer/src/validate-ffmpeg.ts
+++ b/packages/renderer/src/validate-ffmpeg.ts
@@ -45,11 +45,7 @@ export const ffmpegInNodeModules = (): Promise<boolean> => {
process.cwd(),
'node_modules/.ffmpeg/ffmpeg'
);
- console.log(
- 'does ffmpeg exist in node modules? ',
- expectedFfmpegPath,
- fs.existsSync(expectedFfmpegPath)
- );
+
return fs.existsSync(expectedFfmpegPath);
};
@@ -65,7 +61,11 @@ export const validateFfmpeg = async (
(await binaryExists('ffmpeg', customFfmpegBinary)) ||
(await ffmpegInNodeModules());
if (!ffmpegExists) {
- if (os.platform() === 'darwin' || os.platform() === 'win32') {
+ if (
+ os.platform() === 'darwin' ||
+ os.platform() === 'win32' ||
+ (os.platform() === 'linux' && process.arch === 'arm64')
+ ) {
await downloadFfmpeg();
return validateFfmpeg(customFfmpegBinary);
}
@@ -76,7 +76,6 @@ export const validateFfmpeg = async (
process.exit(1);
}
- // ------------should be removed after ffmpeg nodemodules implementation--//
console.error('It looks like FFMPEG is not installed');
if (os.platform() === 'darwin' && (await isHomebrewInstalled())) {
console.error('Run `brew install ffmpeg` to install ffmpeg');