Skip to content

🎥 Make videos programmatically with React

better docs + changelog

Jonny Burger5986437a393b
diff --git a/packages/docs/components/lambda/default-frames-per-lambda.tsx b/packages/docs/components/lambda/default-frames-per-lambda.tsx
index fa9549fa8c..29653cf276 100644
--- a/packages/docs/components/lambda/default-frames-per-lambda.tsx
+++ b/packages/docs/components/lambda/default-frames-per-lambda.tsx
@@ -4,11 +4,3 @@ import React from "react";
export const MinimumFramesPerLambda: React.FC = () => {
return <code>{MINIMUM_FRAMES_PER_LAMBDA}</code>;
};
-
-export const DefaultFramesPerLambda: React.FC = () => {
- return (
- <span>
- <code />
- </span>
- );
-};
diff --git a/packages/docs/docs/lambda.md b/packages/docs/docs/lambda.md
index b79c76f06c..d811a021fa 100644
--- a/packages/docs/docs/lambda.md
+++ b/packages/docs/docs/lambda.md
@@ -9,7 +9,7 @@ Render Remotion videos on [AWS Lambda](https://aws.amazon.com/lambda/). This is
import {LambdaRegionList} from '../components/lambda/regions.tsx';
:::warning
-**Experimental**: APIs might undergo major changes and the framework still has rough edges and hardcoded values - see known issues section. Updates will be provided on the #lambda channel on Discord.
+**Beta**: APIs might undergo minor changes. Updates will be provided on the #lambda channel on Discord.
**No release timeline**: The project is in active development but will not be rushed to a release but instead we want to ensure it's futureproof.
:::
diff --git a/packages/docs/docs/lambda/changelog.md b/packages/docs/docs/lambda/changelog.md
index 621d837891..f11781340a 100644
--- a/packages/docs/docs/lambda/changelog.md
+++ b/packages/docs/docs/lambda/changelog.md
@@ -10,6 +10,11 @@ Keep track of changes to the APIs of Remotion Lambda here.
[Upgrading](/docs/lambda/upgrading)
+## Unreleased
+
+- New algorithm for determining default concurrency: https://v3.remotion.dev/docs/lambda/concurrency
+- Better error message if concurrency is too high
+
## January 6th, 2022
Version hash: `3.0.0-lambda.244+d055311e8`
diff --git a/packages/docs/docs/lambda/checklist.md b/packages/docs/docs/lambda/checklist.md
index e707e6943e..395e4c22da 100644
--- a/packages/docs/docs/lambda/checklist.md
+++ b/packages/docs/docs/lambda/checklist.md
@@ -35,6 +35,10 @@ Familiarize yourself with the [AWS burst limit](https://docs.aws.amazon.com/lamb
The maximum payload for invoking a Lambda function is 256KB. Ensure that in your application, the `inputProps` payload does not exceed this amount and introduce validation and error handling if necessary.
+### Selecting the right concurrency
+
+If you are using the [`framesPerLambda`](/docs/lambda/rendermediaonlambda#framesperlambda) option, make sure that for each video you render, the parameter is set in a way that it stays within the allowed bounds (no more than 200 lambda functions per render).
+
### Bucket privacy
By default the rendered videos are publicly accessible in your bucket. Use the `privacy` setting in [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda) to make renders private if you'd like so.
diff --git a/packages/docs/docs/lambda/cli/render.md b/packages/docs/docs/lambda/cli/render.md
index 5271f32105..805a08abd4 100644
--- a/packages/docs/docs/lambda/cli/render.md
+++ b/packages/docs/docs/lambda/cli/render.md
@@ -5,6 +5,8 @@ title: "npx remotion lambda render"
slug: /lambda/cli/render
---
+import { MinimumFramesPerLambda } from "../../../components/lambda/default-frames-per-lambda";
+
Using the `npx remotion lambda render` command, you can render a video in the cloud.
The structure of a command is as follows:
@@ -89,7 +91,14 @@ Disables [chunk optimization](/docs/lambda/chunk-optimization). By default this
### `--frames-per-lambda`
-How many frames should be rendered in a single Lambda function. Increase it to require less Lambda functions to render the video, decrease it to make the render faster. Default `20`.
+How many frames should be rendered in a single Lambda function. Increase it to require less Lambda functions to render the video, decrease it to make the render faster.
+
+Default value: [Dependant on video length](/docs/concurrency)
+Minimum value: <MinimumFramesPerLambda />
+
+:::note
+The `framesPerLambda` parameter cannot result in more than 200 functions being spawned. See: [Concurrency](/docs/lambda/concurrency)
+:::
### `--quality`
diff --git a/packages/docs/docs/lambda/concurrency.md b/packages/docs/docs/lambda/concurrency.md
index a014f19603..396f098156 100644
--- a/packages/docs/docs/lambda/concurrency.md
+++ b/packages/docs/docs/lambda/concurrency.md
@@ -9,7 +9,7 @@ Remotion Lambda is a highly concurrent distributed video rendering system. That
You can set the concurrency via the [`framesPerLambda`](/docs/lambda/rendermediaonlambda#framesperlambda) option (or [`--frames-per-lambda`](/docs/lambda/cli/render#--frames-per-lambda) via CLI).
-The concurrency is defined as `framesPerLambda / frameCount`. That means that the higher you set framesPerLambda, the lower the concurrency gets.
+The concurrency is defined as `framesPerLambda / frameCount`. That means that the higher you set `framesPerLambda`, the lower the concurrency gets.
:::note
Example: You render a video that has a `durationInFrames` of `300` with a `framePerLambda` setting of `15`. The concurrency is `300 / 15 = 20`.
diff --git a/packages/docs/docs/lambda/rendermediaonlambda.md b/packages/docs/docs/lambda/rendermediaonlambda.md
index 1c570fa497..48d5623219 100644
--- a/packages/docs/docs/lambda/rendermediaonlambda.md
+++ b/packages/docs/docs/lambda/rendermediaonlambda.md
@@ -3,7 +3,7 @@ id: rendermediaonlambda
title: renderMediaOnLambda()
---
-import { DefaultFramesPerLambda, MinimumFramesPerLambda } from "../../components/lambda/default-frames-per-lambda";
+import { MinimumFramesPerLambda } from "../../components/lambda/default-frames-per-lambda";
Triggers a render on a lambda given a composition and a lambda function.
@@ -52,9 +52,13 @@ Use [`deployFunction()`](/docs/lambda/deployfunction) to create a new function a
The video rendering process gets distributed across multiple Lambda functions. This setting controls how many frames are rendered per Lambda invocation. The lower the number you pass, the more Lambdas get spawned.
-Default value: <DefaultFramesPerLambda /> <br/>
+Default value: [Dependant on video length](/docs/concurrency)
Minimum value: <MinimumFramesPerLambda />
+:::note
+The `framesPerLambda` parameter cannot result in more than 200 functions being spawned. See: [Concurrency](/docs/lambda/concurrency)
+:::
+
### `serveUrl`
A URL pointing to a Remotion project. Use [`deploySite()`](/docs/lambda/deploysite) to deploy a Remotion project.
diff --git a/packages/lambda/remotionlambda.zip b/packages/lambda/remotionlambda.zip
index 5871037746..44a0c07e47 100644
Binary files a/packages/lambda/remotionlambda.zip and b/packages/lambda/remotionlambda.zip differ
diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.ts
index 9e8bfba4cb..aad0757f73 100644
--- a/packages/lambda/src/functions/launch.ts
+++ b/packages/lambda/src/functions/launch.ts
@@ -16,6 +16,7 @@ import {
renderMetadataKey,
rendersPrefix,
} from '../shared/constants';
+import {DOCS_URL} from '../shared/docs-url';
import {getServeUrlHash} from '../shared/make-s3-url';
import {validateFramesPerLambda} from '../shared/validate-frames-per-lambda';
import {validatePrivacy} from '../shared/validate-privacy';
@@ -103,8 +104,7 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {
if (chunkCount > MAX_FUNCTIONS_PER_RENDER) {
throw new Error(
- // TODO: Document better
- `Too many functions: This render would cause ${chunkCount} functions to spawn. We limit this amount to ${MAX_FUNCTIONS_PER_RENDER} functions as more would result in diminishing returns. Calculation = ceil(frameCount / framesPerLambda). Values set: frameCount = ${frameCount}, framesPerLambda=${framesPerLambda}`
+ `Too many functions: This render would cause ${chunkCount} functions to spawn. We limit this amount to ${MAX_FUNCTIONS_PER_RENDER} functions as more would result in diminishing returns. Values set: frameCount = ${frameCount}, framesPerLambda=${framesPerLambda}. See ${DOCS_URL}/docs/lambda/concurrency for how this parameter is calculated.`
);
}
diff --git a/packages/lambda/src/shared/constants.ts b/packages/lambda/src/shared/constants.ts
index 9f0666f0b0..6ff8cd040c 100644
--- a/packages/lambda/src/shared/constants.ts
+++ b/packages/lambda/src/shared/constants.ts
@@ -272,6 +272,7 @@ export type RenderMetadata = {
};
export type LambdaVersions =
+ | '2022-01-09'
| '2022-01-06'
| '2022-01-05'
| '2021-12-22'
@@ -309,7 +310,7 @@ export type LambdaVersions =
| '2021-06-23'
| 'n/a';
-export const CURRENT_VERSION: LambdaVersions = '2022-01-06';
+export const CURRENT_VERSION: LambdaVersions = '2022-01-09';
export type PostRenderData = {
cost: {