Skip to content

🎥 Make videos programmatically with React

fix stuff

Jonny Burger68c33074166e
diff --git a/packages/docs/docs/get-waveform-portion.md b/packages/docs/docs/get-waveform-portion.md
index 3c66f01de8..beb23fa50f 100644
--- a/packages/docs/docs/get-waveform-portion.md
+++ b/packages/docs/docs/get-waveform-portion.md
@@ -28,6 +28,8 @@ An object with the following arguments:
## Example
```tsx twoslash
+// @module: ESNext
+// @target: ESNext
import { Audio } from "remotion";
// ---cut---
import { getAudioData, getWaveformPortion } from "@remotion/media-utils";
diff --git a/packages/docs/docs/lambda-setup.md b/packages/docs/docs/lambda-setup.md
index 6e010a3e2d..82bbc7c4db 100644
--- a/packages/docs/docs/lambda-setup.md
+++ b/packages/docs/docs/lambda-setup.md
@@ -106,14 +106,14 @@ You can deploy a function using [`deployFunction()`](/docs/lambda/deployfunction
```ts twoslash
// @module: ESNext
// @target: ESNext
-import {deployFunction} from '@remotion/lambda';
+import { deployFunction } from "@remotion/lambda";
// ---cut---
-const {functionName} = await deployFunction({
- region: 'us-east-1',
+const { functionName } = await deployFunction({
+ region: "us-east-1",
timeoutInSeconds: 120,
- memorySizeInMb: 1536
-})
+ memorySizeInMb: 1536,
+});
```
The function name is returned which you'll need for rendering.
@@ -147,12 +147,12 @@ First, you need to create an S3 bucket in your preferred region. If one already
```ts twoslash
// @module: ESNext
// @target: ESNext
-import path from 'path';
-import {deploySite, getOrCreateBucket} from '@remotion/lambda';
+import path from "path";
+import { deploySite, getOrCreateBucket } from "@remotion/lambda";
-const {bucketName} = await getOrCreateBucket({
- region: 'us-east-1'
-})
+const { bucketName } = await getOrCreateBucket({
+ region: "us-east-1",
+});
```
Next, upload your Remotion project to an S3 bucket. Specify the entry point of your Remotion project, this is the file where [`registerRoot()`](/docs/register-root) is called.
@@ -160,18 +160,18 @@ Next, upload your Remotion project to an S3 bucket. Specify the entry point of y
```ts twoslash
// @module: ESNext
// @target: ESNext
-import path from 'path';
-import {deploySite, getOrCreateBucket} from '@remotion/lambda';
+import path from "path";
+import { deploySite, getOrCreateBucket } from "@remotion/lambda";
-const {bucketName} = await getOrCreateBucket({
- region: 'us-east-1'
-})
+const { bucketName } = await getOrCreateBucket({
+ region: "us-east-1",
+});
// ---cut---
-const {url} = await deploySite({
+const { url } = await deploySite({
bucketName,
- entryPoint: path.resolve(process.cwd(), 'src/index.tsx'),
- region: 'us-east-1'
-})
+ entryPoint: path.resolve(process.cwd(), "src/index.tsx"),
+ region: "us-east-1",
+});
```
You are now ready to render a video.
@@ -206,14 +206,18 @@ You already have the function name from a previous step. But since you only need
```ts twoslash
// @module: ESNext
// @target: ESNext
-import {getFunctions, renderVideoOnLambda, getRenderProgress} from '@remotion/lambda';
+import {
+ getFunctions,
+ renderVideoOnLambda,
+ getRenderProgress,
+} from "@remotion/lambda";
const functions = await getFunctions({
- region: 'us-east-1',
- compatibleOnly: true
-})
+ region: "us-east-1",
+ compatibleOnly: true,
+});
-const functionName = functions[0].functionName
+const functionName = functions[0].functionName;
```
We can now trigger a render using the [`renderVideoOnLambda()`](/docs/lambda/rendervideoonlambda) function.
@@ -221,27 +225,33 @@ We can now trigger a render using the [`renderVideoOnLambda()`](/docs/lambda/ren
```ts twoslash
// @module: ESNext
// @target: ESNext
-import {getFunctions, renderVideoOnLambda, getRenderProgress} from '@remotion/lambda';
+import {
+ getFunctions,
+ renderVideoOnLambda,
+ getRenderProgress,
+} from "@remotion/lambda";
-const url = 'string'
+const url = "string";
const functions = await getFunctions({
- region: 'us-east-1',
- compatibleOnly: true
-})
+ region: "us-east-1",
+ compatibleOnly: true,
+});
-const functionName = functions[0].functionName
+const functionName = functions[0].functionName;
// ---cut---
-const {renderId, bucketName} = await renderVideoOnLambda({
- region: 'us-east-1',
+const { renderId, bucketName } = await renderVideoOnLambda({
+ region: "us-east-1",
functionName,
serveUrl: url,
- composition: 'HelloWorld',
+ composition: "HelloWorld",
inputProps: {},
- codec: 'h264-mkv',
- imageFormat: 'jpeg',
- maxRetries: 3
-})
+ codec: "h264-mkv",
+ imageFormat: "jpeg",
+ maxRetries: 3,
+ framesPerLambda: 20,
+ privacy: "public",
+});
```
The render will now run and after a while the video will be available in your S3 bucket. You can at any time get the status of the video render by calling [`getRenderProgress()`](/docs/lambda/getrenderprogress).
@@ -249,42 +259,48 @@ The render will now run and after a while the video will be available in your S3
```ts twoslash
// @module: ESNext
// @target: ESNext
-import {getFunctions, renderVideoOnLambda, getRenderProgress} from '@remotion/lambda';
+import {
+ getFunctions,
+ renderVideoOnLambda,
+ getRenderProgress,
+} from "@remotion/lambda";
-const url = 'string'
+const url = "string";
const functions = await getFunctions({
- region: 'us-east-1',
- compatibleOnly: true
-})
+ region: "us-east-1",
+ compatibleOnly: true,
+});
-const functionName = functions[0].functionName
+const functionName = functions[0].functionName;
-const {renderId, bucketName} = await renderVideoOnLambda({
- region: 'us-east-1',
+const { renderId, bucketName } = await renderVideoOnLambda({
+ region: "us-east-1",
functionName,
serveUrl: url,
- composition: 'HelloWorld',
+ composition: "HelloWorld",
inputProps: {},
- codec: 'h264-mkv',
- imageFormat: 'jpeg',
- maxRetries: 3
-})
+ codec: "h264-mkv",
+ imageFormat: "jpeg",
+ maxRetries: 3,
+ framesPerLambda: 20,
+ privacy: "public",
+});
// ---cut---
while (true) {
- await new Promise(resolve => setTimeout(resolve, 1000))
+ await new Promise((resolve) => setTimeout(resolve, 1000));
const progress = await getRenderProgress({
renderId,
bucketName,
functionName,
- region: 'us-east-1'
- })
+ region: "us-east-1",
+ });
if (progress.done) {
- console.log('Render finished!', progress.outputFile)
- process.exit(0)
+ console.log("Render finished!", progress.outputFile);
+ process.exit(0);
}
if (progress.fatalErrorEncountered) {
- console.error('Error enountered', progress.errors)
- process.exit(1)
+ console.error("Error enountered", progress.errors);
+ process.exit(1);
}
}
```