Skip to content

🎥 Make videos programmatically with React

`@remotion/lambda`: Increase default disk size to 10240MB for Remotion 5.0

Jonny Burger6d52bbdafd1f
diff --git a/packages/docs/components/lambda/default-disk-size.tsx b/packages/docs/components/lambda/default-disk-size.tsx
deleted file mode 100644
index cc7bb0dd6a..0000000000
--- a/packages/docs/components/lambda/default-disk-size.tsx
+++ /dev/null
@@ -1,6 +0,0 @@
-import { DEFAULT_EPHEMERAL_STORAGE_IN_MB } from "@remotion/lambda/defaults";
-import React from "react";
-
-export const DefaultEphemerealStorageInMb: React.FC = () => {
- return <span>{DEFAULT_EPHEMERAL_STORAGE_IN_MB}</span>;
-};
diff --git a/packages/docs/docs/5-0-migration.mdx b/packages/docs/docs/5-0-migration.mdx
index ed2e50fd10..35bff79de8 100644
--- a/packages/docs/docs/5-0-migration.mdx
+++ b/packages/docs/docs/5-0-migration.mdx
@@ -79,6 +79,15 @@ The default value of `overwrite` has been changed to `true` in `renderMediaOnLam
The `shouldDumpIo` option has been be removed in 5.0.
Use `logLevel` instead.
+## `diskSizeInMb` is now 10240 by default
+
+For Remotion Lambda, the default disk size is now 10240 MB.
+This will add a miniscule cost to your renders technically, but will lead to more reliable and faster renders, since Chrome is less likely to run out of disk cache.
+
+**Required actions**:
+- If you want to keep the old behavior, set `diskSizeInMb: 2048`, explicitly.
+- If your Lambda function name is hardcoded to include `disk2048mb`, unhardcode it and use `speculateFunctionName()` to get the correct name.
+
## License changes
Remotion 5.0 has an updated license. View the [license](https://github.com/remotion-dev/remotion/blob/5-0-license/LICENSE.md) here or compare the [changes](https://github.com/remotion-dev/remotion/pull/3750).
diff --git a/packages/docs/docs/lambda/cli/functions.mdx b/packages/docs/docs/lambda/cli/functions.mdx
index a5123fabec..a81ed58c62 100644
--- a/packages/docs/docs/lambda/cli/functions.mdx
+++ b/packages/docs/docs/lambda/cli/functions.mdx
@@ -8,7 +8,6 @@ crumb: "Lambda CLI Reference"
---
import { DefaultMemorySize } from "../../../components/lambda/default-memory-size";
-import { DefaultEphemerealStorageInMb } from "../../../components/lambda/default-disk-size";
import { DefaultTimeout } from "../../../components/lambda/default-timeout";
import { DefaultLogRetention } from "../../../components/lambda/default-log-retention";
@@ -62,7 +61,12 @@ Memory size in megabytes. Default: <DefaultMemorySize /> MB.
### `--disk`
-Disk size in megabytes. Default: <DefaultEphemerealStorageInMb /> MB. See also: [Disk size](/docs/lambda/disk-size).
+Disk size in megabytes. See also: [Disk size](/docs/lambda/disk-size).
+
+| Remotion Version | Default |
+|------------------|---------------|
+| &lt;5.0.0 | 2048MB |
+| &gt;=5.0.0 | 10240MB |
### `--timeout`
diff --git a/packages/docs/docs/lambda/deployfunction.mdx b/packages/docs/docs/lambda/deployfunction.mdx
index 6d94f0217b..df186e2ee0 100644
--- a/packages/docs/docs/lambda/deployfunction.mdx
+++ b/packages/docs/docs/lambda/deployfunction.mdx
@@ -61,7 +61,12 @@ Retention period for the CloudWatch Logs. Default: 14 days.
_optional_
-Sets the amount of disk storage that is available in the Lambda function. Must be between 512MB and 10240MB (10GB). Default: 2048MB. Set this higher if you want to render longer videos. See also: [Disk size](/docs/lambda/disk-size)
+Sets the amount of disk storage that is available in the Lambda function. Must be between 512MB and 10240MB (10GB). Set this higher if you want to render longer videos. See also: [Disk size](/docs/lambda/disk-size)
+
+| Remotion Version | Default |
+|------------------|---------------|
+| &lt;5.0.0 | 2048MB |
+| &gt;=5.0.0 | 10240MB |
### `customRoleArn`
diff --git a/packages/docs/docs/lambda/disk-size.mdx b/packages/docs/docs/lambda/disk-size.mdx
index f5fc795a5d..56b01c0125 100644
--- a/packages/docs/docs/lambda/disk-size.mdx
+++ b/packages/docs/docs/lambda/disk-size.mdx
@@ -5,21 +5,28 @@ title: Disk size
crumb: "Lambda"
---
-By default, each Lambda function comes with an ephemereal disk size of 2048MB. This is enough storage to render a video of approximately 32 minutes of Full HD video.
+By default, each Lambda function comes with an ephemereal disk size of:
-If you want to render longer videos, you can increase the disk size, and [potentially also increase the timeout](/docs/timeout).
+| Remotion Version | Default |
+|------------------|---------------|
+| &lt;5.0.0 | 2048MB |
+| &gt;=5.0.0 | 10240MB |
-Disk space need increases linearly with the length of your video, meaning that for each 8 minutes of Full HD video, you approximately need another 512MB of video.
+Increasing disk space will allow for longer videos, and speeds up renders because Chrome has access to more disk cache.
+Disk.
-The minimum disk size is 512MB, and the maximum disk size is 10240MB.
+Adding more disk space will almost not affect the cost of your renders at all (less than 1% more cost).
+Therefore we recommend setting the disk size to the maximum possible value: 10240MB.
-The approximate maximum video duration length is therefore around ~160 minutes at Full HD (not yet practically confirmed).
+## Approximate maximum video length
+
+Note that we recommend setting the disk size to the maximum possible value: 10240MB.
| Disk size | Approximate Maximum video length |
| ----------------- | -------------------------------- |
| 512 MB | 8 min - 1080p |
| 1024 MB | 16 min - 1080p |
-| 2048 MB (default) | 32 min - 1080p |
+| 2048 MB | 32 min - 1080p |
| 4096 MB | 1h 4min - 1080p |
| 8192 MB | 2h 8min - 1080p |
| 10240 MB | 2h 40min - 1080p |
@@ -33,5 +40,7 @@ The approximate maximum video duration length is therefore around ~160 minutes a
## Pricing
-Using more disk space costs more. See the [Lambda pricing page](https://aws.amazon.com/lambda/pricing/) "Lambda Ephemereal Storage Pricing" section for pricing.
+Using more disk space costs marginally more.
+Setting the disk size to the maximum possible value: 10240MB will cost less than 1% more.
+See the [Lambda pricing page](https://aws.amazon.com/lambda/pricing/) "Lambda Ephemereal Storage Pricing" section for pricing.
The [`estimatePrice()`](/docs/lambda/estimateprice) API does also factor disk size into account.
diff --git a/packages/lambda/src/shared/constants.ts b/packages/lambda/src/shared/constants.ts
index 19c546f26e..ec63171dbc 100644
--- a/packages/lambda/src/shared/constants.ts
+++ b/packages/lambda/src/shared/constants.ts
@@ -8,6 +8,7 @@ import {
type Privacy,
type RenderMetadata,
} from '@remotion/serverless/client';
+import {NoReactInternals} from 'remotion/no-react';
import type {AwsProvider} from '../functions/aws-implementation';
import type {ChunkRetry} from '../functions/helpers/get-retry-stats';
import type {AwsRegion} from '../regions';
@@ -31,9 +32,12 @@ export const DEFAULT_MAX_RETRIES = 1;
export const MAX_FUNCTIONS_PER_RENDER = 200;
-export const DEFAULT_EPHEMERAL_STORAGE_IN_MB = 2048;
-export const MIN_EPHEMERAL_STORAGE_IN_MB = 512;
export const MAX_EPHEMERAL_STORAGE_IN_MB = 10240;
+export const DEFAULT_EPHEMERAL_STORAGE_IN_MB =
+ NoReactInternals.ENABLE_V5_BREAKING_CHANGES
+ ? MAX_EPHEMERAL_STORAGE_IN_MB
+ : 2048;
+export const MIN_EPHEMERAL_STORAGE_IN_MB = 512;
export const DEFAULT_OUTPUT_PRIVACY: Privacy = 'public';