🎥 Make videos programmatically with React
awesome
Jonny Burgerf539ec3fd70a
diff --git a/packages/lambda/src/functions/aws-server-implementation.ts b/packages/lambda/src/functions/aws-server-implementation.tsindex 6b1a13c060..7367850482 100644--- a/packages/lambda/src/functions/aws-server-implementation.ts+++ b/packages/lambda/src/functions/aws-server-implementation.ts@@ -22,4 +22,7 @@ export const serverAwsImplementation: ServerProviderSpecifics = {return process.env.AWS_LAMBDA_FUNCTION_NAME;},+ getCurrentMemorySizeInMb: () => {+ return Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE);+ },};diff --git a/packages/lambda/src/test/integration/renders/old-version.test.ts b/packages/lambda/src/test/integration/renders/old-version.test.tsindex 13c4ced49b..a8290987fd 100644--- a/packages/lambda/src/test/integration/renders/old-version.test.ts+++ b/packages/lambda/src/test/integration/renders/old-version.test.ts@@ -22,7 +22,7 @@ test('Should fail when using an incompatible version', async () => {crf: 9,envVariables: {},frameRange: [0, 12],- framesPerLambda: 8,+ framesPerFunction: 8,imageFormat: 'png',inputProps: {type: 'payload',@@ -40,7 +40,7 @@ test('Should fail when using an incompatible version', async () => {timeoutInMilliseconds: 12000,numberOfGifLoops: null,everyNthFrame: 1,- concurrencyPerLambda: 1,+ concurrencyPerFunction: 1,downloadBehavior: {type: 'play-in-browser',},diff --git a/packages/lambda/src/test/integration/webhooks.test.ts b/packages/lambda/src/test/integration/webhooks.test.tsindex b4dee22318..21f4b9f70c 100644--- a/packages/lambda/src/test/integration/webhooks.test.ts+++ b/packages/lambda/src/test/integration/webhooks.test.ts@@ -189,7 +189,7 @@ describe('Webhooks', () => {crf: 9,envVariables: {},frameRange: [0, 10],- framesPerLambda: 8,+ framesPerFunction: 8,imageFormat: 'png',inputProps: {type: 'payload',@@ -207,7 +207,7 @@ describe('Webhooks', () => {timeoutInMilliseconds: 3000,numberOfGifLoops: null,everyNthFrame: 1,- concurrencyPerLambda: 1,+ concurrencyPerFunction: 1,downloadBehavior: {type: 'play-in-browser',},diff --git a/packages/lambda/src/test/mock-implementation.ts b/packages/lambda/src/test/mock-implementation.tsindex 908469460f..a0eb66f853 100644--- a/packages/lambda/src/test/mock-implementation.ts+++ b/packages/lambda/src/test/mock-implementation.ts@@ -182,4 +182,5 @@ export const mockServerImplementation: ServerProviderSpecifics = {memorySizeInMb: 3009,timeoutInSeconds: 120,}),+ getCurrentMemorySizeInMb: () => 3009,};diff --git a/packages/serverless/src/constants.ts b/packages/serverless/src/constants.tsindex 7083f4b8f6..4597fa00ec 100644--- a/packages/serverless/src/constants.ts+++ b/packages/serverless/src/constants.ts@@ -174,7 +174,7 @@ export type ServerlessPayloads<Provider extends CloudProvider> = {type: ServerlessRoutines.launch;serveUrl: string;composition: string;- framesPerLambda: number | null;+ framesPerFunction: number | null;bucketName: string;inputProps: SerializedInputProps;renderId: string;@@ -197,7 +197,7 @@ export type ServerlessPayloads<Provider extends CloudProvider> = {scale: number;everyNthFrame: number;numberOfGifLoops: number | null;- concurrencyPerLambda: number;+ concurrencyPerFunction: number;downloadBehavior: DownloadBehavior;muted: boolean;overwrite: boolean;diff --git a/packages/serverless/src/handlers/launch.ts b/packages/serverless/src/handlers/launch.tsindex 3d1fbfc33d..1b53229bb1 100644--- a/packages/serverless/src/handlers/launch.ts+++ b/packages/serverless/src/handlers/launch.ts@@ -154,7 +154,7 @@ const innerLaunchHandler = async <Provider extends CloudProvider>({RenderInternals.validateBitrate(params.videoBitrate, 'videoBitrate');RenderInternals.validateConcurrency({- value: params.concurrencyPerLambda,+ value: params.concurrencyPerFunction,setting: 'concurrencyPerLambda',checkIfValidForCurrentMachine:(params.rendererFunctionName ?? null) === null,@@ -171,7 +171,7 @@ const innerLaunchHandler = async <Provider extends CloudProvider>({);const framesPerLambda =- params.framesPerLambda ?? bestFramesPerFunctionParam(frameCount.length);+ params.framesPerFunction ?? bestFramesPerFunctionParam(frameCount.length);validateFramesPerFunction({framesPerLambda,@@ -273,7 +273,7 @@ const innerLaunchHandler = async <Provider extends CloudProvider>({chromiumOptions: params.chromiumOptions,scale: params.scale,everyNthFrame: params.everyNthFrame,- concurrencyPerLambda: params.concurrencyPerLambda,+ concurrencyPerLambda: params.concurrencyPerFunction,muted: params.muted,audioBitrate: params.audioBitrate,videoBitrate: params.videoBitrate,diff --git a/packages/serverless/src/handlers/progress.ts b/packages/serverless/src/handlers/progress.tsindex a66175c3bb..760cf4e504 100644--- a/packages/serverless/src/handlers/progress.ts+++ b/packages/serverless/src/handlers/progress.ts@@ -43,12 +43,13 @@ export const progressHandler = async <Provider extends CloudProvider>(renderId: lambdaParams.renderId,expectedBucketOwner: options.expectedBucketOwner,region: options.providerSpecifics.getCurrentRegionInFunction(),- memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),+ memorySizeInMb:+ options.serverProviderSpecifics.getCurrentMemorySizeInMb(),timeoutInMilliseconds: options.timeoutInMilliseconds,customCredentials: lambdaParams.s3OutputProvider ?? null,providerSpecifics: options.providerSpecifics,forcePathStyle: lambdaParams.forcePathStyle,- functionName: process.env.AWS_LAMBDA_FUNCTION_NAME as string,+ functionName: options.serverProviderSpecifics.getCurrentFunctionName(),serverProviderSpecifics: options.serverProviderSpecifics,});return progress;diff --git a/packages/serverless/src/handlers/renderer.ts b/packages/serverless/src/handlers/renderer.tsindex bb10afd45e..30064e8487 100644--- a/packages/serverless/src/handlers/renderer.ts+++ b/packages/serverless/src/handlers/renderer.ts@@ -507,11 +507,11 @@ export const rendererHandler = async <Provider extends CloudProvider>({} else {RenderInternals.Log.info({indent: false, logLevel: params.logLevel},- 'Lambda did not succeed with flaky error, not keeping browser open.',+ 'Function did not succeed with flaky error, not keeping browser open.',);RenderInternals.Log.info({indent: false, logLevel: params.logLevel},- 'Quitting Lambda forcefully now to force not keeping the Lambda warm.',+ 'Quitting Function forcefully now to force not keeping the Function warm.',);process.exit(0);}diff --git a/packages/serverless/src/handlers/start.ts b/packages/serverless/src/handlers/start.tsindex 0b94c6d7dd..ef3005d435 100644--- a/packages/serverless/src/handlers/start.ts+++ b/packages/serverless/src/handlers/start.ts@@ -81,7 +81,7 @@ export const startHandler = async <Provider extends CloudProvider>({const payload: ServerlessPayload<Provider> = {type: ServerlessRoutines.launch,- framesPerLambda: params.framesPerLambda,+ framesPerFunction: params.framesPerLambda,composition: params.composition,serveUrl: realServeUrl,inputProps: params.inputProps,@@ -105,7 +105,7 @@ export const startHandler = async <Provider extends CloudProvider>({scale: params.scale,numberOfGifLoops: params.numberOfGifLoops,everyNthFrame: params.everyNthFrame,- concurrencyPerLambda: params.concurrencyPerLambda,+ concurrencyPerFunction: params.concurrencyPerLambda,downloadBehavior: params.downloadBehavior,muted: params.muted,overwrite: params.overwrite,diff --git a/packages/serverless/src/handlers/still.ts b/packages/serverless/src/handlers/still.tsindex 4151d6827f..e368a92b08 100644--- a/packages/serverless/src/handlers/still.ts+++ b/packages/serverless/src/handlers/still.ts@@ -67,12 +67,12 @@ const innerStillHandler = async <Provider extends CloudProvider>(if (params.version !== VERSION) {if (!params.version) {throw new Error(- `Version mismatch: When calling renderStillOnLambda(), you called the function ${process.env.AWS_LAMBDA_FUNCTION_NAME} which has the version ${VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call renderStillOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`,+ `Version mismatch: When calling renderStillOnLambda(), you called the function ${serverProviderSpecifics.getCurrentFunctionName()} which has the version ${VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call renderStillOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`,);}throw new Error(- `Version mismatch: When calling renderStillOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${VERSION}, but the @remotion/lambda package you used to invoke the function has version ${params.version}. Deploy a new function and use it to call renderStillOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`,+ `Version mismatch: When calling renderStillOnLambda(), you passed ${serverProviderSpecifics.getCurrentFunctionName()} as the function, which has the version ${VERSION}, but the @remotion/lambda package you used to invoke the function has version ${params.version}. Deploy a new function and use it to call renderStillOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`,);}diff --git a/packages/serverless/src/provider-implementation.ts b/packages/serverless/src/provider-implementation.tsindex 856d73a196..2e16553db3 100644--- a/packages/serverless/src/provider-implementation.ts+++ b/packages/serverless/src/provider-implementation.ts@@ -240,6 +240,7 @@ export type ServerProviderSpecifics = {generateRandomId: GenerateRenderId;deleteTmpDir: () => Promise<void>;getCurrentFunctionName: () => string;+ getCurrentMemorySizeInMb: () => number;};export type ProviderSpecifics<Provider extends CloudProvider> = {