Skip to content

🎥 Make videos programmatically with React

document lambda runtime

Jonny Burger29c49d540499
diff --git a/packages/docs/components/lambda/default-memory-size.tsx b/packages/docs/components/lambda/default-memory-size.tsx
new file mode 100644
index 0000000000..07dcbf9f08
--- /dev/null
+++ b/packages/docs/components/lambda/default-memory-size.tsx
@@ -0,0 +1,6 @@
+import { DEFAULT_MEMORY_SIZE } from "@remotion/lambda/dist/defaults";
+import React from "react";
+
+export const DefaultMemorySize: React.FC = () => {
+ return <span>{DEFAULT_MEMORY_SIZE}</span>;
+};
diff --git a/packages/docs/components/lambda/default-timeout.tsx b/packages/docs/components/lambda/default-timeout.tsx
new file mode 100644
index 0000000000..f713ffdebe
--- /dev/null
+++ b/packages/docs/components/lambda/default-timeout.tsx
@@ -0,0 +1,6 @@
+import { DEFAULT_TIMEOUT } from "@remotion/lambda/dist/defaults";
+import React from "react";
+
+export const DefaultTimeout: React.FC = () => {
+ return <span>{DEFAULT_TIMEOUT}</span>;
+};
diff --git a/packages/docs/docs/lambda-runtime.md b/packages/docs/docs/lambda-runtime.md
new file mode 100644
index 0000000000..b65ddb8b4a
--- /dev/null
+++ b/packages/docs/docs/lambda-runtime.md
@@ -0,0 +1,47 @@
+---
+id: lambda-runtime
+title: Runtime
+slug: /lambda/runtime
+---
+
+import {DefaultMemorySize} from '../components/lambda/default-memory-size';
+import {DefaultTimeout} from '../components/lambda/default-timeout';
+
+This page describes the environment that the Lambda function is running in.
+
+## Node.JS Version
+
+The lambda function will use a NodeJS version from the `14.x` release line.
+
+## Memory size
+
+The default is <DefaultMemorySize/> MB. You can configure it by passing an argument to [`deployFunction()`](/docs/lambda/deployfunction) or by passing a `--memory` flag to the CLI when deploying a function.
+
+## Timeout
+
+The default is <DefaultTimeout /> seconds. You can configure it when calling [`deployFunction()`](/docs/lambda/deployfunction) or by passing a `--timeout` flag to the CLI when deploying a function.
+
+Note that you probably don't need to increase it - Since the video is rendered by splitting it into many parts and those parts are rendered in parallel, there are rare cases where you need more than <DefaultTimeout /> seconds.
+
+## Storage space
+
+The function only has 512MB of storage space in total, of which ~200MB are already taken by Google Chrome, FFMPEG and the Remotion function code. This means your video rendering must not take more than ~300MB of space - keep in mind that the concatenations of various chunks into one video takes place within a Lambda function, so the space must suffice for both the chunks and the output video.
+
+In practice, this means your final video should not be bigger than ~150MB.
+
+## Google Chrome
+
+The function already includes a running version of Google Chrome.
+The browser was compiled including the proprietary codecs, so you can include MP4 videos into your project.
+
+_TODO: Specify which version of Google Chrome_
+
+## FFMPEG
+
+The function already includes an FFMPEG binary.
+
+_TODO: Specify which version of FFMPEG._
+
+## Fonts
+
+The function only includes `Open Sans` as it's only font. You need to load other fonts using Webfonts.
diff --git a/packages/docs/docs/lambda-setup.md b/packages/docs/docs/lambda-setup.md
index 3ff417f9b7..a6c117bbad 100644
--- a/packages/docs/docs/lambda-setup.md
+++ b/packages/docs/docs/lambda-setup.md
@@ -1,6 +1,6 @@
---
id: lambda-setup
-title: Lambda setup
+title: Setup
slug: /lambda/setup
---
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index 8eb3c18a39..cb85898ff6 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -10,6 +10,7 @@ module.exports = {
"lambda-setup",
"lambda-permissions",
"lambda-region-selection",
+ "lambda-runtime",
{
collapsed: false,
type: "category",
diff --git a/packages/lambda/src/cli/get-aws-region.ts b/packages/lambda/src/cli/get-aws-region.ts
index f9416c8f1c..d17a3d785c 100644
--- a/packages/lambda/src/cli/get-aws-region.ts
+++ b/packages/lambda/src/cli/get-aws-region.ts
@@ -1,10 +1,9 @@
import {AwsRegion} from '../pricing/aws-regions';
+import {DEFAULT_REGION} from '../shared/constants';
import {isInLambda} from '../shared/tmpdir';
import {validateAwsRegion} from '../shared/validate-aws-region';
import {parsedLambdaCli} from './args';
-const DEFAULT_REGION: AwsRegion = 'us-east-1';
-
export const getAwsRegion = (): AwsRegion => {
if (isInLambda) {
throw new Error('Should not call getAwsRegion() if in lambda');
diff --git a/packages/lambda/src/defaults.ts b/packages/lambda/src/defaults.ts
new file mode 100644
index 0000000000..2d0232d4d1
--- /dev/null
+++ b/packages/lambda/src/defaults.ts
@@ -0,0 +1 @@
+export * from './shared/constants';
diff --git a/packages/lambda/src/shared/constants.ts b/packages/lambda/src/shared/constants.ts
index c3c36304e0..17f00e37f9 100644
--- a/packages/lambda/src/shared/constants.ts
+++ b/packages/lambda/src/shared/constants.ts
@@ -11,8 +11,8 @@ export const MIN_TIMEOUT = 15;
export const MAX_TIMEOUT = 900;
export const BINARY_NAME = 'remotion-lambda';
-
export const COMMAND_NOT_FOUND = 'Command not found';
+export const DEFAULT_REGION: AwsRegion = 'us-east-1';
// TODO: Rename other buckets in Jonnys accoudn first
export const REMOTION_BUCKET_PREFIX = 'remotionlambda-';