Skip to content

🎥 Make videos programmatically with React

disable chunk optimization

Jonny Burger917650d81ef8
diff --git a/packages/docs/docs/lambda.md b/packages/docs/docs/lambda.md
index d811a021fa..dcc6fa61ef 100644
--- a/packages/docs/docs/lambda.md
+++ b/packages/docs/docs/lambda.md
@@ -34,7 +34,7 @@ If one of those those constraints is a dealbreaker for you, resort to normal [se
## Architecture
- **Lambda function**: Requires a layer with Chromium and FFMPEG, currently hosted by Remotion. Only one lambda function is required, but it can execute different actions.
-- **S3 bucket**: Stores the projects, the renders, render metadata and chunk optimization data.
+- **S3 bucket**: Stores the projects, the renders, and render metadata data.
- **CLI**: Allows to control the overall architecture from the command line. Is installed by adding `@remotion/lambda` to a project.
- **Node.JS API**: Has the same features as the CLI but is easier to use programmatically
@@ -59,12 +59,6 @@ The following regions are available for Remotion Lambda:
Most of our users render multiple minutes of video for just a few pennies. The exact cost is dependent on the region, assigned memory, type of video, parallelization and other parameters. For each render, we estimate a cost and display it to you. You might also need a Remotion license (see below).
-## Chunk optimization
-
-A mechanism that determines after a render which frames rendered the slowest optimizes the batching sizes for the next render. This can optimize subsequent render times by up to 50%.
-
-[**Read more about chunk optimization**](/docs/lambda/chunk-optimization)
-
## AWS permissions
Remotion Lambda requires you to create an AWS account and create a user with some permissions attached to it. We require only the minimal amount of permissions required for operating Remotion Lambda.
diff --git a/packages/docs/docs/lambda/cli/render.md b/packages/docs/docs/lambda/cli/render.md
index 046774ff58..11a32d557b 100644
--- a/packages/docs/docs/lambda/cli/render.md
+++ b/packages/docs/docs/lambda/cli/render.md
@@ -85,10 +85,6 @@ Defines if the output media is accessible for everyone or not. Either `public` o
How many times a single chunk is being retried if it fails to render. Default `1`.
-### `--disable-chunk-optimization`
-
-Disables [chunk optimization](/docs/lambda/chunk-optimization). By default this flag is false, meaning chunk optimization is enabled.
-
### `--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.
diff --git a/packages/docs/docs/lambda/getrenderprogress.md b/packages/docs/docs/lambda/getrenderprogress.md
index e3f2447d00..5ec96f2a57 100644
--- a/packages/docs/docs/lambda/getrenderprogress.md
+++ b/packages/docs/docs/lambda/getrenderprogress.md
@@ -78,7 +78,6 @@ Contains the following information about the render:
- `estimatedRenderLambdaInvokations`: The estimated amount of Lambdas that will render chunks of the video.`.
- `compositionId`: The ID of the composition that is being rendered.
- `codec`: The selected codec into which the video gets encoded.
-- `usesOptimizationProfile`: If chunk optimization was applied to the render.
### `bucket`
diff --git a/packages/docs/docs/lambda/region-selection.md b/packages/docs/docs/lambda/region-selection.md
index d9ff1d0529..167f1b17e2 100644
--- a/packages/docs/docs/lambda/region-selection.md
+++ b/packages/docs/docs/lambda/region-selection.md
@@ -52,7 +52,7 @@ Note that different regions have a different limit on how many Lambda functions
- The function and S3 bucket must be in the same region to eliminate latency across datacenters. Rendering with functions and buckets that ahave mismatching regions is not supported
-- You may deploy your whole architecture to different regions to further increase the amount of renders you can make concurrently. The tradeoff is higher redundancy, and not being able to benefit less from already warm functions and chunk optimization.
+- You may deploy your whole architecture to different regions to further increase the amount of renders you can make concurrently. The tradeoff is higher redundancy, and not being able to benefit less from already warm functions.
- Some regions are more expensive than others (for example `af-south-1`).
Consult the [Lambda Pricing page](https://aws.amazon.com/lambda/pricing/) from AWS.
diff --git a/packages/docs/docs/lambda/rendermediaonlambda.md b/packages/docs/docs/lambda/rendermediaonlambda.md
index cd510e719d..67d5a036df 100644
--- a/packages/docs/docs/lambda/rendermediaonlambda.md
+++ b/packages/docs/docs/lambda/rendermediaonlambda.md
@@ -27,7 +27,6 @@ const { bucketName, renderId } = await renderVideoOnLambda({
imageFormat: "jpeg",
maxRetries: 1,
privacy: "public",
- enableChunkOptimization: true,
});
```
@@ -110,12 +109,6 @@ _optional, default `1`_
How often a chunk may be retried to render in case the render fails.
If a rendering of a chunk is failed, the error will be reported in the [`getRenderProgress()`](/docs/lambda/getrenderprogress) object and retried up to as many times as you specify using this option.
-### `enableChunkOptimization`
-
-_Default `true`_
-
-If this is enabled, Remotion will use [chunk optimization](/docs/lambda/chunk-optimization) to learn from a rendering and restructure chunks for subsequent renders of the same composition to optimize for overall render time.
-
### `outName`
_optional_
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index dd9ff880d4..f0f9f1f81e 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -67,7 +67,6 @@ module.exports = {
"lambda/concurrency",
"lambda/runtime",
"lambda/faq",
- "lambda/chunkoptimization",
"lambda/light-client",
{
collapsed: false,
diff --git a/packages/lambda/remotionlambda.zip b/packages/lambda/remotionlambda.zip
index d6e81c1037..d534944e2e 100644
Binary files a/packages/lambda/remotionlambda.zip and b/packages/lambda/remotionlambda.zip differ
diff --git a/packages/lambda/src/api/render-media-on-lambda.ts b/packages/lambda/src/api/render-media-on-lambda.ts
index 0ec70f78a2..719d902492 100644
--- a/packages/lambda/src/api/render-media-on-lambda.ts
+++ b/packages/lambda/src/api/render-media-on-lambda.ts
@@ -30,7 +30,6 @@ export type RenderMediaOnLambdaInput = {
quality?: number;
maxRetries: number;
framesPerLambda?: number;
- enableChunkOptimization?: boolean;
logLevel?: LogLevel;
frameRange?: FrameRange;
outName?: string;
@@ -59,7 +58,6 @@ export type RenderMediaOnLambdaOutput = {
* @param params.quality JPEG quality if JPEG was selected as the image format.
* @param params.region The AWS region in which the video should be rendered.
* @param params.maxRetries How often rendering a chunk may fail before the video render gets aborted.
- * @param params.enableChunkOptimization Whether Remotion should restructure and optimize chunks for subsequent renders. Default true.
* @param params.logLevel Level of logging that Lambda function should perform. Default "info".
* @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
*/
@@ -80,7 +78,6 @@ export const renderMediaOnLambda = async ({
composition,
framesPerLambda,
privacy,
- enableChunkOptimization,
logLevel,
frameRange,
outName,
@@ -108,7 +105,6 @@ export const renderMediaOnLambda = async ({
quality,
maxRetries,
privacy,
- enableChunkOptimization,
logLevel: logLevel ?? Internals.Logging.DEFAULT_LOG_LEVEL,
frameRange: frameRange ?? null,
outName: outName ?? null,
diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.ts
index 4a9cfc2fac..85706e4cb8 100644
--- a/packages/lambda/src/functions/launch.ts
+++ b/packages/lambda/src/functions/launch.ts
@@ -118,7 +118,8 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {
chunkCount,
framesPerLambda,
optimization,
- shouldUseOptimization: params.enableChunkOptimization,
+ // TODO: Re-enable chunk optimization later
+ shouldUseOptimization: false,
frameRange: realFrameRange,
});
const sortedChunks = chunks.slice().sort((a, b) => a[0] - b[0]);
@@ -292,7 +293,10 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {
let chunkProm: Promise<unknown> = Promise.resolve();
- if (params.enableChunkOptimization) {
+ // TODO: Enable in a later release
+ const enableChunkOptimization = false;
+
+ if (enableChunkOptimization) {
const chunkData = await collectChunkInformation({
bucketName: params.bucketName,
renderId: params.renderId,
diff --git a/packages/lambda/src/functions/start.ts b/packages/lambda/src/functions/start.ts
index 7e707eb725..f4c76f521d 100644
--- a/packages/lambda/src/functions/start.ts
+++ b/packages/lambda/src/functions/start.ts
@@ -11,15 +11,6 @@ export const startHandler = async (params: LambdaPayload) => {
throw new TypeError('Expected type start');
}
- if (
- typeof params.enableChunkOptimization !== 'boolean' &&
- typeof params.enableChunkOptimization !== 'undefined'
- ) {
- throw new Error(
- 'The parameter "enableChunkOptimization" must be a boolean or undefined.'
- );
- }
-
const {bucketName} = await getOrCreateBucket({
region: getCurrentRegionInFunction(),
});
@@ -42,7 +33,6 @@ export const startHandler = async (params: LambdaPayload) => {
quality: params.quality,
maxRetries: params.maxRetries,
privacy: params.privacy,
- enableChunkOptimization: params.enableChunkOptimization !== false,
logLevel: params.logLevel ?? Internals.Logging.DEFAULT_LOG_LEVEL,
frameRange: params.frameRange,
outName: params.outName,
diff --git a/packages/lambda/src/shared/constants.ts b/packages/lambda/src/shared/constants.ts
index 873d21eea9..4bf90a5c22 100644
--- a/packages/lambda/src/shared/constants.ts
+++ b/packages/lambda/src/shared/constants.ts
@@ -163,7 +163,6 @@ export type LambdaPayloads = {
quality: number | undefined;
maxRetries: number;
privacy: Privacy;
- enableChunkOptimization: boolean | undefined;
logLevel: LogLevel;
frameRange: FrameRange | null;
outName: string | null;
@@ -188,7 +187,6 @@ export type LambdaPayloads = {
quality: number | undefined;
maxRetries: number;
privacy: Privacy;
- enableChunkOptimization: boolean;
logLevel: LogLevel;
frameRange: FrameRange | null;
outName: string | null;
diff --git a/packages/lambda/src/test/integration/renders/silent-audio.test.ts b/packages/lambda/src/test/integration/renders/silent-audio.test.ts
index 2108b40178..3782ae2db0 100644
--- a/packages/lambda/src/test/integration/renders/silent-audio.test.ts
+++ b/packages/lambda/src/test/integration/renders/silent-audio.test.ts
@@ -36,7 +36,6 @@ test('Should add silent audio if there is no audio', async () => {
codec: 'h264-mkv',
composition: 'react-svg',
crf: 9,
- enableChunkOptimization: false,
envVariables: {},
frameRange: [0, 12],
framesPerLambda: 8,
diff --git a/packages/lambda/src/test/integration/renders/transparent-webm.test.ts b/packages/lambda/src/test/integration/renders/transparent-webm.test.ts
index b751dc4811..04f3ac78fd 100644
--- a/packages/lambda/src/test/integration/renders/transparent-webm.test.ts
+++ b/packages/lambda/src/test/integration/renders/transparent-webm.test.ts
@@ -38,7 +38,6 @@ test('Should make a transparent video', async () => {
codec: 'vp8',
composition: 'ten-frame-tester',
crf: 9,
- enableChunkOptimization: false,
envVariables: {},
frameRange: [0, 9],
framesPerLambda: 5,