Skip to content

🎥 Make videos programmatically with React

ffmpeg stuff

Jonny Burger202327229c06
diff --git a/packages/lambda/src/admin/bundle-lambda.ts b/packages/lambda/src/admin/bundle-lambda.ts
index 6adc722076..6fdd00bc88 100644
--- a/packages/lambda/src/admin/bundle-lambda.ts
+++ b/packages/lambda/src/admin/bundle-lambda.ts
@@ -1,5 +1,5 @@
import {BundlerInternals} from '@remotion/bundler';
-import {binaryPath} from '@remotion/compositor-linux-arm64-gnu';
+import {binaryPath, ffmpegCwd} from '@remotion/compositor-linux-arm64-gnu';
import fs from 'node:fs';
import path from 'node:path';
import {quit} from '../cli/helpers/quit';
@@ -38,6 +38,8 @@ const bundleLambda = async () => {
const compositorFile = `${outdir}/compositor`;
fs.copyFileSync(binaryPath, compositorFile);
+ fs.cpSync(ffmpegCwd, `${outdir}/ffmpeg`, {recursive: true});
+
await zl.archiveFolder(outdir, FUNCTION_ZIP_ARM64);
fs.rmSync(outdir, {recursive: true});
diff --git a/packages/lambda/src/functions/helpers/get-chromium-executable-path.ts b/packages/lambda/src/functions/helpers/get-chromium-executable-path.ts
index 55b357098c..ad382839dc 100644
--- a/packages/lambda/src/functions/helpers/get-chromium-executable-path.ts
+++ b/packages/lambda/src/functions/helpers/get-chromium-executable-path.ts
@@ -2,15 +2,10 @@ if (
/^AWS_Lambda_nodejs(?:18)[.]x$/.test(process.env.AWS_EXECUTION_ENV ?? '') ===
true
) {
- if (process.env.FONTCONFIG_PATH === undefined) {
- process.env.FONTCONFIG_PATH = '/opt';
- process.env.FONTCONFIG_FILE = '/opt/fonts.conf';
- }
+ process.env.FONTCONFIG_PATH = '/opt';
+ process.env.FONTCONFIG_FILE = '/opt/fonts.conf';
- process.env.LD_LIBRARY_PATH = '/opt/lib:/opt/bin';
- process.env.FFMPEG_BIN_PATH = '/opt/ffmpeg/remotion/bin/ffmpeg';
- process.env.FFPROBE_BIN_PATH = '/opt/ffmpeg/remotion/bin/ffprobe';
- process.env.FFMPEG_CWD = '/opt/ffmpeg';
+ process.env.READ_ONLY_FS = '1';
process.env.COMPOSITOR_PATH = './compositor';
}
diff --git a/packages/lambda/src/shared/hosted-layers.ts b/packages/lambda/src/shared/hosted-layers.ts
index 73fce5b690..6192c98235 100644
--- a/packages/lambda/src/shared/hosted-layers.ts
+++ b/packages/lambda/src/shared/hosted-layers.ts
@@ -13,11 +13,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:ap-northeast-1:678892195805:layer:remotion-binaries-fonts-arm64',
version: 8,
},
- {
- layerArn:
- 'arn:aws:lambda:ap-northeast-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 10,
- },
{
layerArn:
'arn:aws:lambda:ap-northeast-1:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -30,11 +25,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:ap-south-1:678892195805:layer:remotion-binaries-fonts-arm64',
version: 8,
},
- {
- layerArn:
- 'arn:aws:lambda:ap-south-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 10,
- },
{
layerArn:
'arn:aws:lambda:ap-south-1:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -47,11 +37,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:ap-southeast-1:678892195805:layer:remotion-binaries-fonts-arm64',
version: 8,
},
- {
- layerArn:
- 'arn:aws:lambda:ap-southeast-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 10,
- },
{
layerArn:
'arn:aws:lambda:ap-southeast-1:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -64,11 +49,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:ap-southeast-2:678892195805:layer:remotion-binaries-fonts-arm64',
version: 8,
},
- {
- layerArn:
- 'arn:aws:lambda:ap-southeast-2:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 10,
- },
{
layerArn:
'arn:aws:lambda:ap-southeast-2:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -81,11 +61,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:eu-central-1:678892195805:layer:remotion-binaries-fonts-arm64',
version: 17,
},
- {
- layerArn:
- 'arn:aws:lambda:eu-central-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 11,
- },
{
layerArn:
'arn:aws:lambda:eu-central-1:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -98,11 +73,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:eu-west-1:678892195805:layer:remotion-binaries-fonts-arm64',
version: 9,
},
- {
- layerArn:
- 'arn:aws:lambda:eu-west-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 10,
- },
{
layerArn:
'arn:aws:lambda:eu-west-1:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -115,11 +85,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:eu-west-2:678892195805:layer:remotion-binaries-fonts-arm64',
version: 8,
},
- {
- layerArn:
- 'arn:aws:lambda:eu-west-2:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 10,
- },
{
layerArn:
'arn:aws:lambda:eu-west-2:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -132,11 +97,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:us-east-1:678892195805:layer:remotion-binaries-fonts-arm64',
version: 13,
},
- {
- layerArn:
- 'arn:aws:lambda:us-east-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 19,
- },
{
layerArn:
'arn:aws:lambda:us-east-1:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -149,11 +109,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:us-east-2:678892195805:layer:remotion-binaries-fonts-arm64',
version: 8,
},
- {
- layerArn:
- 'arn:aws:lambda:us-east-2:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 10,
- },
{
layerArn:
'arn:aws:lambda:us-east-2:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -166,11 +121,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:us-west-2:678892195805:layer:remotion-binaries-fonts-arm64',
version: 8,
},
- {
- layerArn:
- 'arn:aws:lambda:us-west-2:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 10,
- },
{
layerArn:
'arn:aws:lambda:us-west-2:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -183,11 +133,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:af-south-1:678892195805:layer:remotion-binaries-fonts-arm64',
version: 5,
},
- {
- layerArn:
- 'arn:aws:lambda:af-south-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 3,
- },
{
layerArn:
'arn:aws:lambda:af-south-1:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -200,11 +145,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:ap-east-1:678892195805:layer:remotion-binaries-fonts-arm64',
version: 5,
},
- {
- layerArn:
- 'arn:aws:lambda:ap-east-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 3,
- },
{
layerArn:
'arn:aws:lambda:ap-east-1:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -217,11 +157,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:ap-northeast-2:678892195805:layer:remotion-binaries-fonts-arm64',
version: 5,
},
- {
- layerArn:
- 'arn:aws:lambda:ap-northeast-2:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 3,
- },
{
layerArn:
'arn:aws:lambda:ap-northeast-2:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -234,11 +169,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:ap-northeast-3:678892195805:layer:remotion-binaries-fonts-arm64',
version: 5,
},
- {
- layerArn:
- 'arn:aws:lambda:ap-northeast-3:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 3,
- },
{
layerArn:
'arn:aws:lambda:ap-northeast-3:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -251,11 +181,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:ca-central-1:678892195805:layer:remotion-binaries-fonts-arm64',
version: 5,
},
- {
- layerArn:
- 'arn:aws:lambda:ca-central-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 3,
- },
{
layerArn:
'arn:aws:lambda:ca-central-1:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -268,11 +193,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:eu-north-1:678892195805:layer:remotion-binaries-fonts-arm64',
version: 5,
},
- {
- layerArn:
- 'arn:aws:lambda:eu-north-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 3,
- },
{
layerArn:
'arn:aws:lambda:eu-north-1:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -285,11 +205,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:eu-south-1:678892195805:layer:remotion-binaries-fonts-arm64',
version: 5,
},
- {
- layerArn:
- 'arn:aws:lambda:eu-south-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 3,
- },
{
layerArn:
'arn:aws:lambda:eu-south-1:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -302,11 +217,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:eu-west-3:678892195805:layer:remotion-binaries-fonts-arm64',
version: 5,
},
- {
- layerArn:
- 'arn:aws:lambda:eu-west-3:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 3,
- },
{
layerArn:
'arn:aws:lambda:eu-west-3:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -319,11 +229,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:me-south-1:678892195805:layer:remotion-binaries-fonts-arm64',
version: 5,
},
- {
- layerArn:
- 'arn:aws:lambda:me-south-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 3,
- },
{
layerArn:
'arn:aws:lambda:me-south-1:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -336,11 +241,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:sa-east-1:678892195805:layer:remotion-binaries-fonts-arm64',
version: 5,
},
- {
- layerArn:
- 'arn:aws:lambda:sa-east-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 3,
- },
{
layerArn:
'arn:aws:lambda:sa-east-1:678892195805:layer:remotion-binaries-chromium-arm64',
@@ -353,11 +253,6 @@ export const hostedLayers: HostedLayers = {
'arn:aws:lambda:us-west-1:678892195805:layer:remotion-binaries-fonts-arm64',
version: 5,
},
- {
- layerArn:
- 'arn:aws:lambda:us-west-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',
- version: 3,
- },
{
layerArn:
'arn:aws:lambda:us-west-1:678892195805:layer:remotion-binaries-chromium-arm64',
diff --git a/packages/renderer/src/compositor/get-executable-path.ts b/packages/renderer/src/compositor/get-executable-path.ts
index f76ecf07fc..19ab829b06 100644
--- a/packages/renderer/src/compositor/get-executable-path.ts
+++ b/packages/renderer/src/compositor/get-executable-path.ts
@@ -9,20 +9,8 @@ function isMusl() {
export const getExecutablePath = (
type: 'compositor' | 'ffmpeg' | 'ffprobe' | 'ffmpeg-cwd'
): string => {
- if (type === 'ffmpeg' && process.env.FFMPEG_BIN_PATH) {
- return '/opt/ffmpeg/remotion/bin/ffmpeg';
- }
-
- if (type === 'ffprobe' && process.env.FFPROBE_BIN_PATH) {
- return '/opt/ffmpeg/remotion/bin/ffprobe';
- }
-
- if (type === 'ffmpeg-cwd' && process.env.FFMPEG_CWD) {
- return '/opt/ffmpeg';
- }
-
if (type === 'compositor' && process.env.COMPOSITOR_PATH) {
- return './compositor';
+ return process.env.COMPOSITOR_PATH;
}
const key =