🎥 Make videos programmatically with React
debug information
Jonny Burger034905a398b2
diff --git a/packages/cli/src/ffmpeg.ts b/packages/cli/src/ffmpeg.tsindex 9556d11694..313fd07b3a 100644--- a/packages/cli/src/ffmpeg.ts+++ b/packages/cli/src/ffmpeg.ts@@ -2,17 +2,25 @@ import {RenderInternals} from '@remotion/renderer';import {spawnSync} from 'child_process';export const ffmpegCommand = (_root: string, args: string[]) => {- const done = spawnSync(RenderInternals.getExecutablePath('ffmpeg'), args, {- ...RenderInternals.callFfExtraOptions(),- stdio: 'inherit',- });+ const done = spawnSync(+ RenderInternals.getExecutablePath('ffmpeg', false),+ args,+ {+ ...RenderInternals.callFfExtraOptions(),+ stdio: 'inherit',+ }+ );process.exit(done.status as number);};export const ffprobeCommand = (_root: string, args: string[]) => {- const done = spawnSync(RenderInternals.getExecutablePath('ffprobe'), args, {- ...RenderInternals.callFfExtraOptions(),- stdio: 'inherit',- });+ const done = spawnSync(+ RenderInternals.getExecutablePath('ffprobe', false),+ args,+ {+ ...RenderInternals.callFfExtraOptions(),+ stdio: 'inherit',+ }+ );process.exit(done.status as number);};diff --git a/packages/lambda/src/api/create-function.ts b/packages/lambda/src/api/create-function.tsindex 49bf99d9fe..cc47ceefc8 100644--- a/packages/lambda/src/api/create-function.ts+++ b/packages/lambda/src/api/create-function.ts@@ -115,7 +115,8 @@ export const createFunction = async ({new PutRuntimeManagementConfigCommand({FunctionName,UpdateRuntimeOn: 'Manual',- RuntimeVersionArn: `arn:aws:lambda:${region}::runtime:69000d3430a08938bcab71617dffcb8ea551a2cbc36c59f38c52a1ea087e461b`,+ // TODO: soften the error message+ RuntimeVersionArn: `arn:aws:lambda:${region}::runtime:b97ad873eb5228db2e7d5727cd116734cc24c92ff1381739c4400c095404a2d3`,}));} catch (err) {diff --git a/packages/lambda/src/shared/hosted-layers.ts b/packages/lambda/src/shared/hosted-layers.tsindex fead0cc2c4..70646dc0d7 100644--- a/packages/lambda/src/shared/hosted-layers.ts+++ b/packages/lambda/src/shared/hosted-layers.ts@@ -11,252 +11,357 @@ export const hostedLayers: HostedLayers = {{layerArn:'arn:aws:lambda:ap-northeast-1:678892195805:layer:remotion-binaries-fonts-arm64',- version: 6,+ version: 7,+ },+ {+ layerArn:+ 'arn:aws:lambda:ap-northeast-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 9,},{layerArn:'arn:aws:lambda:ap-northeast-1:678892195805:layer:remotion-binaries-chromium-arm64',- version: 10,+ version: 11,},],'ap-south-1': [{layerArn:'arn:aws:lambda:ap-south-1:678892195805:layer:remotion-binaries-fonts-arm64',- version: 6,+ version: 7,+ },+ {+ layerArn:+ 'arn:aws:lambda:ap-south-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 9,},{layerArn:'arn:aws:lambda:ap-south-1:678892195805:layer:remotion-binaries-chromium-arm64',- version: 10,+ version: 11,},],'ap-southeast-1': [{layerArn:'arn:aws:lambda:ap-southeast-1:678892195805:layer:remotion-binaries-fonts-arm64',- version: 6,+ version: 7,+ },+ {+ layerArn:+ 'arn:aws:lambda:ap-southeast-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 9,},{layerArn:'arn:aws:lambda:ap-southeast-1:678892195805:layer:remotion-binaries-chromium-arm64',- version: 10,+ version: 11,},],'ap-southeast-2': [{layerArn:'arn:aws:lambda:ap-southeast-2:678892195805:layer:remotion-binaries-fonts-arm64',- version: 6,+ version: 7,+ },+ {+ layerArn:+ 'arn:aws:lambda:ap-southeast-2:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 9,},{layerArn:'arn:aws:lambda:ap-southeast-2:678892195805:layer:remotion-binaries-chromium-arm64',- version: 10,+ version: 11,},],'eu-central-1': [{layerArn:'arn:aws:lambda:eu-central-1:678892195805:layer:remotion-binaries-fonts-arm64',- version: 12,+ version: 14,+ },+ {+ layerArn:+ 'arn:aws:lambda:eu-central-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 9,},{layerArn:'arn:aws:lambda:eu-central-1:678892195805:layer:remotion-binaries-chromium-arm64',- version: 15,+ version: 16,},],'eu-west-1': [{layerArn:'arn:aws:lambda:eu-west-1:678892195805:layer:remotion-binaries-fonts-arm64',- version: 6,+ version: 7,+ },+ {+ layerArn:+ 'arn:aws:lambda:eu-west-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 9,},{layerArn:'arn:aws:lambda:eu-west-1:678892195805:layer:remotion-binaries-chromium-arm64',- version: 10,+ version: 11,},],'eu-west-2': [{layerArn:'arn:aws:lambda:eu-west-2:678892195805:layer:remotion-binaries-fonts-arm64',- version: 6,+ version: 7,+ },+ {+ layerArn:+ 'arn:aws:lambda:eu-west-2:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 9,},{layerArn:'arn:aws:lambda:eu-west-2:678892195805:layer:remotion-binaries-chromium-arm64',- version: 10,+ version: 11,},],'us-east-1': [{layerArn:'arn:aws:lambda:us-east-1:678892195805:layer:remotion-binaries-fonts-arm64',- version: 11,+ version: 12,+ },+ {+ layerArn:+ 'arn:aws:lambda:us-east-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 18,},{layerArn:'arn:aws:lambda:us-east-1:678892195805:layer:remotion-binaries-chromium-arm64',- version: 19,+ version: 20,},],'us-east-2': [{layerArn:'arn:aws:lambda:us-east-2:678892195805:layer:remotion-binaries-fonts-arm64',- version: 6,+ version: 7,+ },+ {+ layerArn:+ 'arn:aws:lambda:us-east-2:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 9,},{layerArn:'arn:aws:lambda:us-east-2:678892195805:layer:remotion-binaries-chromium-arm64',- version: 10,+ version: 11,},],'us-west-2': [{layerArn:'arn:aws:lambda:us-west-2:678892195805:layer:remotion-binaries-fonts-arm64',- version: 6,+ version: 7,+ },+ {+ layerArn:+ 'arn:aws:lambda:us-west-2:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 9,},{layerArn:'arn:aws:lambda:us-west-2:678892195805:layer:remotion-binaries-chromium-arm64',- version: 10,+ version: 11,},],'af-south-1': [{layerArn:'arn:aws:lambda:af-south-1:678892195805:layer:remotion-binaries-fonts-arm64',- version: 3,+ version: 4,+ },+ {+ layerArn:+ 'arn:aws:lambda:af-south-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 2,},{layerArn:'arn:aws:lambda:af-south-1:678892195805:layer:remotion-binaries-chromium-arm64',- version: 3,+ version: 4,},],'ap-east-1': [{layerArn:'arn:aws:lambda:ap-east-1:678892195805:layer:remotion-binaries-fonts-arm64',- version: 3,+ version: 4,+ },+ {+ layerArn:+ 'arn:aws:lambda:ap-east-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 2,},{layerArn:'arn:aws:lambda:ap-east-1:678892195805:layer:remotion-binaries-chromium-arm64',- version: 3,+ version: 4,},],'ap-northeast-2': [{layerArn:'arn:aws:lambda:ap-northeast-2:678892195805:layer:remotion-binaries-fonts-arm64',- version: 3,+ version: 4,+ },+ {+ layerArn:+ 'arn:aws:lambda:ap-northeast-2:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 2,},{layerArn:'arn:aws:lambda:ap-northeast-2:678892195805:layer:remotion-binaries-chromium-arm64',- version: 3,+ version: 4,},],'ap-northeast-3': [{layerArn:'arn:aws:lambda:ap-northeast-3:678892195805:layer:remotion-binaries-fonts-arm64',- version: 3,+ version: 4,+ },+ {+ layerArn:+ 'arn:aws:lambda:ap-northeast-3:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 2,},{layerArn:'arn:aws:lambda:ap-northeast-3:678892195805:layer:remotion-binaries-chromium-arm64',- version: 3,+ version: 4,},],'ca-central-1': [{layerArn:'arn:aws:lambda:ca-central-1:678892195805:layer:remotion-binaries-fonts-arm64',- version: 3,+ version: 4,+ },+ {+ layerArn:+ 'arn:aws:lambda:ca-central-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 2,},{layerArn:'arn:aws:lambda:ca-central-1:678892195805:layer:remotion-binaries-chromium-arm64',- version: 3,+ version: 4,},],'eu-north-1': [{layerArn:'arn:aws:lambda:eu-north-1:678892195805:layer:remotion-binaries-fonts-arm64',- version: 3,+ version: 4,+ },+ {+ layerArn:+ 'arn:aws:lambda:eu-north-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 2,},{layerArn:'arn:aws:lambda:eu-north-1:678892195805:layer:remotion-binaries-chromium-arm64',- version: 3,+ version: 4,},],'eu-south-1': [{layerArn:'arn:aws:lambda:eu-south-1:678892195805:layer:remotion-binaries-fonts-arm64',- version: 3,+ version: 4,+ },+ {+ layerArn:+ 'arn:aws:lambda:eu-south-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 2,},{layerArn:'arn:aws:lambda:eu-south-1:678892195805:layer:remotion-binaries-chromium-arm64',- version: 3,+ version: 4,},],'eu-west-3': [{layerArn:'arn:aws:lambda:eu-west-3:678892195805:layer:remotion-binaries-fonts-arm64',- version: 3,+ version: 4,+ },+ {+ layerArn:+ 'arn:aws:lambda:eu-west-3:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 2,},{layerArn:'arn:aws:lambda:eu-west-3:678892195805:layer:remotion-binaries-chromium-arm64',- version: 3,+ version: 4,},],'me-south-1': [{layerArn:'arn:aws:lambda:me-south-1:678892195805:layer:remotion-binaries-fonts-arm64',- version: 3,+ version: 4,+ },+ {+ layerArn:+ 'arn:aws:lambda:me-south-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 2,},{layerArn:'arn:aws:lambda:me-south-1:678892195805:layer:remotion-binaries-chromium-arm64',- version: 3,+ version: 4,},],'sa-east-1': [{layerArn:'arn:aws:lambda:sa-east-1:678892195805:layer:remotion-binaries-fonts-arm64',- version: 3,+ version: 4,+ },+ {+ layerArn:+ 'arn:aws:lambda:sa-east-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 2,},{layerArn:'arn:aws:lambda:sa-east-1:678892195805:layer:remotion-binaries-chromium-arm64',- version: 3,+ version: 4,},],'us-west-1': [{layerArn:'arn:aws:lambda:us-west-1:678892195805:layer:remotion-binaries-fonts-arm64',- version: 3,+ version: 4,+ },+ {+ layerArn:+ 'arn:aws:lambda:us-west-1:678892195805:layer:remotion-binaries-ffmpeg-arm64',+ version: 2,},{layerArn:'arn:aws:lambda:us-west-1:678892195805:layer:remotion-binaries-chromium-arm64',- version: 3,+ version: 4,},],};diff --git a/packages/renderer/src/call-ffmpeg.ts b/packages/renderer/src/call-ffmpeg.tsindex 210c323c30..e4340db89c 100644--- a/packages/renderer/src/call-ffmpeg.ts+++ b/packages/renderer/src/call-ffmpeg.ts@@ -1,10 +1,37 @@+import {execSync} from 'child_process';import execa from 'execa';+import fs from 'fs';import path from 'path';import {getExecutablePath} from './compositor/get-executable-path';import {truthy} from './truthy';export const callFfExtraOptions = () => {- const lib = path.join(getExecutablePath('ffmpeg-cwd'), 'remotion', 'lib');+ const isLambda = /^AWS_Lambda_nodejs(?:18)[.]x$/.test(+ process.env.AWS_EXECUTION_ENV ?? ''+ );+ const lib = path.join(+ getExecutablePath('ffmpeg-cwd', isLambda),+ 'remotion',+ 'lib'+ );++ console.log({lib});+ console.log({files: fs.readdirSync(lib)});+ execSync('ldd ' + lib + '/libavdevice.so', {+ cwd: lib,+ stdio: 'inherit',+ env: {+ LD_LIBRARY_PATH: `${process.env.LD_LIBRARY_PATH};${lib}`,+ },+ });++ console.log('deps');+ execSync('ldd ' + '/opt/ffmpeg/remotion/bin/ffmpeg', {+ cwd: lib,+ stdio: 'inherit',+ env: {LD_LIBRARY_PATH: `${process.env.LD_LIBRARY_PATH};${lib}`},+ });+ console.log('deps2');return {env:@@ -17,7 +44,7 @@ export const callFfExtraOptions = () => {PATH: `${process.env.PATH};${lib}`,}: {- LD_LIBRARY_PATH: lib,+ LD_LIBRARY_PATH: `${process.env.LD_LIBRARY_PATH};${lib}`,},};};@@ -27,7 +54,10 @@ export const callFf = (args: (string | null)[],options?: execa.Options<string>) => {- return execa(getExecutablePath(bin), args.filter(truthy), {+ const isLambda = /^AWS_Lambda_nodejs(?:18)[.]x$/.test(+ process.env.AWS_EXECUTION_ENV ?? ''+ );+ return execa(getExecutablePath(bin, isLambda), args.filter(truthy), {...callFfExtraOptions(),...options,});diff --git a/packages/renderer/src/compositor/compose.ts b/packages/renderer/src/compositor/compose.tsindex 208c43c30c..23c25066f5 100644--- a/packages/renderer/src/compositor/compose.ts+++ b/packages/renderer/src/compositor/compose.ts@@ -33,7 +33,10 @@ export const compose = async ({downloadMap: DownloadMap;output: string;}) => {- const bin = getExecutablePath('compositor');+ const isLambda = /^AWS_Lambda_nodejs(?:18)[.]x$/.test(+ process.env.AWS_EXECUTION_ENV ?? ''+ );+ const bin = getExecutablePath('compositor', isLambda);const hash = getCompositorHash({height, width, layers, imageFormat});if (downloadMap.compositorCache[hash]) {@@ -51,6 +54,7 @@ export const compose = async ({};await new Promise<void>((resolve, reject) => {+ console.log(bin, callFfExtraOptions());const child = spawn(bin, {...callFfExtraOptions()});child.stdin.write(JSON.stringify(payload));child.stdin.end();@@ -63,7 +67,7 @@ export const compose = async ({resolve();} else {const message = Buffer.concat(stderrChunks).toString('utf-8');-+ console.log({message});const parsed = JSON.parse(message) as ErrorPayload;const err = new Error(parsed.error);diff --git a/packages/renderer/src/compositor/get-executable-path.ts b/packages/renderer/src/compositor/get-executable-path.tsindex e4f6e8a4f2..ada70cdc06 100644--- a/packages/renderer/src/compositor/get-executable-path.ts+++ b/packages/renderer/src/compositor/get-executable-path.ts@@ -22,7 +22,10 @@ export const getExecutablePath = (if (type === 'ffmpeg-cwd') {return '/opt/ffmpeg';}- // Fallthrough for compositor++ if (type === 'compositor') {+ return './compositor';+ }}const key =diff --git a/packages/renderer/src/prespawn-ffmpeg.ts b/packages/renderer/src/prespawn-ffmpeg.tsindex c8bc9cdbc6..74d6cbba02 100644--- a/packages/renderer/src/prespawn-ffmpeg.ts+++ b/packages/renderer/src/prespawn-ffmpeg.ts@@ -70,7 +70,10 @@ export const prespawnFfmpeg = (options: PreStitcherOptions) => {const supportsCrf = codec !== 'prores';if (options.verbose) {- console.log('[verbose] ffmpeg', getExecutablePath('ffmpeg'));+ const isLambda = /^AWS_Lambda_nodejs(?:18)[.]x$/.test(+ process.env.AWS_EXECUTION_ENV ?? ''+ );+ console.log('[verbose] ffmpeg', getExecutablePath('ffmpeg', isLambda));console.log('[verbose] encoder', encoderName);console.log('[verbose] pixelFormat', pixelFormat);if (supportsCrf) {diff --git a/packages/renderer/src/stitch-frames-to-video.ts b/packages/renderer/src/stitch-frames-to-video.tsindex 211d9f145f..efd889cfda 100644--- a/packages/renderer/src/stitch-frames-to-video.ts+++ b/packages/renderer/src/stitch-frames-to-video.ts@@ -228,7 +228,10 @@ const spawnFfmpeg = async ();if (options.verbose) {- console.log('[verbose] ffmpeg', getExecutablePath('ffmpeg'));+ const isLambda = /^AWS_Lambda_nodejs(?:18)[.]x$/.test(+ process.env.AWS_EXECUTION_ENV ?? ''+ );+ console.log('[verbose] ffmpeg', getExecutablePath('ffmpeg', isLambda));console.log('[verbose] encoder', encoderName);console.log('[verbose] audioCodec', resolvedAudioCodec);console.log('[verbose] pixelFormat', pixelFormat);