Skip to content

πŸŽ₯ Make videos programmatically with React

update docs

Jonny Burger53c98f92c167
diff --git a/packages/docs/docs/recorder/lambda-rendering.mdx b/packages/docs/docs/recorder/lambda-rendering.mdx
index 34d3ea1bee..60369d5c9b 100644
--- a/packages/docs/docs/recorder/lambda-rendering.mdx
+++ b/packages/docs/docs/recorder/lambda-rendering.mdx
@@ -4,30 +4,56 @@ title: Render on Lambda
crumb: Recorder
---
-If you want to render long videos faster or you want to render different versions of your videos at the same time (e.g., for different platforms or different formats), you can take advantage of [@remotion/lambda](/docs/lambda).
+If you want to render long videos faster or you want to render different versions of your videos at the same time, you can take advantage of [@remotion/lambda](/docs/lambda).
-## Setup lambda
+## Setup Lambda
-First you need to set up Remotion Lambda. Follow the step 1 to and including step 7 of the instructions shown [here](/docs/lambda/setup).
+First you need to set up [Remotion Lambda](/docs/lambda).
+Follow steps 1-7 of the instructions shown [here](/docs/lambda/setup).
## Deploy and render
+:::note
+Your site will get a URL that is publicly accessible. Make sure to keep it private and do not share it with anyone.
+:::
+
Add the following function and site deployment commands as well as the render command into a shell script you can execute each time you want to render a video:
```shell
-bunx remotion lambda functions deploy --timeout=3000
-bunx remotion lambda sites create --site-name=<your-site-name> --enable-folder-expire
-bunx remotion lambda render <your-serve-url> <composition-id> --log=verbose --delete-after="1-day"
+bunx remotion lambda functions deploy --memory=3009
+bunx remotion lambda sites create --site-name=remotion-recorder --enable-folder-expiry
+bunx remotion lambda render remotion-recorder <composition-id> --delete-after="7-days"
```
-If you want to render different videos at the same time you can add render commands and change specific props to fit your needs.
+Explanation:
+
+1. [Deploy](/docs/lambda/cli/functions#deploy) a Lambda function. Setting memory to 3009MB will give you [3 vCPUs](/docs/lambda/runtime#core-count--vcpus). If the function already exists, nothing will happen, therefore it is safe to run the command every time.
+2. [Upload](/docs/lambda/cli/sites#create) the Recorder and your Recordings to S3. Give the site the name `remotion-recorder`, you may choose a different name if you like. The [`--enable-folder-expiry`](/docs/lambda/cli/sites#--enable-folder-expiry) flag will make it possible to render videos that automatically delete. If a site with this name already existed, it will update it.
+3. [Render](/docs/lambda/cli/render) the video. Pass the site name and [composition ID](/docs/terminology/composition#composition-id) to the command. The [`--delete-after`](/docs/lambda/cli/render#--delete-after) flag will delete the video after the specified time, you may remove this flag if you want to keep the video.
+
+## Rendering for a specific platform
-For exmaple if you want to render your video for YouTube, X, and Instagram, your shell script could look like this:
+You may use [`--props`](/docs/lambda/cli/render#--props) to override the default props that you set in your composition.
+Here is a script to render a video for all platforms:
```shell
-bunx remotion lambda functions deploy --timeout=3000
-bunx remotion lambda sites create --site-name=<your-site-name> --enable-folder-expire
-bunx remotion lambda render --props='{"platform": "youtube"}' <your-serve-url> <composition-id> --log=verbose --delete-after="1-day"
-bunx remotion lambda render --props='{"platform": "x"}' <your-serve-url> <composition-id> --log=verbose --delete-after="1-day"
-bunx remotion lambda render --props='{"platform": "instagram"}' <your-serve-url> <composition-id> --log=verbose --delete-after="1-day"
+bunx remotion lambda render --props='{"platform": "youtube", "layout": "landscape"}' remotion-recorder <composition-id>
+bunx remotion lambda render --props='{"platform": "x", "layout": "square"}' remotion-recorder <composition-id>
+bunx remotion lambda render --props='{"platform": "linkedin", "layout": "square"}' remotion-recorder <composition-id>
+```
+
+## Our script
+
+For rendering our videos, we create a TypeScript file and run it with `bun lambda.ts`.
+
+```tsx title="lambda.ts"
+import { $ } from "bun";
+
+const siteName = "our-recorder";
+const compositionId = "installwhispercpp";
+
+await $`bunx remotion lambda sites create --site-name=${siteName}`;
+await $`bunx remotion lambda render ${siteName} ${compositionId} --props='{"canvasLayout": "square", "platform": "linkedin"}'`;
+await $`bunx remotion lambda render ${siteName} ${compositionId} --props='{"canvasLayout": "square", "platform": "x"}'`;
+await $`bunx remotion lambda render ${siteName} ${compositionId} --props='{"canvasLayout": "landscape", "platform": "youtube"}'`;
```
diff --git a/packages/docs/docs/recorder/source-control.mdx b/packages/docs/docs/recorder/source-control.mdx
index 6cff02f0f3..50756c5c75 100644
--- a/packages/docs/docs/recorder/source-control.mdx
+++ b/packages/docs/docs/recorder/source-control.mdx
@@ -4,35 +4,33 @@ title: Source Control
crumb: Recorder
---
-We have two recommended approaches for dealing with the videos that you add to the Remotion project.
-
-## Method 1: Add public folder to .gitignore
-
-:::tip
-πŸ‘ Recommended when you want to keep the videos local and want minimal setup.
-:::
-
-Add the public folder containing all your assets to `.gitignore` by running the following command in your Recorder root:
-
-```bash
-echo "public" > .gitignore
-```
-
-This prevents all the assets in your public folder from being added to your Git repository.
+By default the `public` folder is added to the `.gitignore` file. This means your recordings are not stored in Git.
The videos are being kept locally and only changes to the code can be staged.
-## Method 2: Use Git LFS
+We set this as default because GitHub does not allow repositores bigger than 1GB and you may run into an error quickly.
+
+## Enable Git LFS storage
-:::tip
-πŸ‘ Recommended when you want to back up, archive, or share your video source files with others.
+:::note
+We use Git LFS ourselves and recommend setting this up.
:::
If you want to add all your recordings to your repository, you can use Git LFS.
Your Git provider might charge you for storage.
-A GitHub account includes 1 GiB of free storage and 1 GiB a month of free bandwidth. [Afterwards, you can buy a 50GB data pack for $5](https://docs.github.com/en/billing/managing-billing-for-git-large-file-storage/upgrading-git-large-file-storage).
+A GitHub account includes 1 GiB of free storage and 1 GiB a month of free bandwidth.
+[Afterwards, you can buy a 50GB data pack for $5](https://docs.github.com/en/billing/managing-billing-for-git-large-file-storage/upgrading-git-large-file-storage).
-### Setup Git LFS
+### 1. Track public folder
+
+Comment the line in `.gitignore` that ignores the `public` folder:
+
+```diff title="Comment out this line"
+- public/**/*.{mp4,webm,mov}
++ # public/**/*.{mp4,webm,mov}
+```
+
+### 2. Setup Git LFS
1. [Download Git LFS](https://git-lfs.com/).
2. Initialize Git LFS in your repository:
@@ -46,3 +44,14 @@ git lfs install
```bash
git lfs track public/**/*.mp4
```
+
+import { notEqual } from "assert";
+
+### 3. Commit and push
+
+```bash
+git add .gitattributes
+git add public
+git commit -m "Enable Git LFS"
+git push
+```