🎥 Make videos programmatically with React
document CLI
Jonny Burgerc197508c6d3a
diff --git a/packages/docs/components/lambda/user-permissions.tsx b/packages/docs/components/lambda/user-permissions.tsxindex 21aa86ff8a..8d081b4569 100644--- a/packages/docs/components/lambda/user-permissions.tsx+++ b/packages/docs/components/lambda/user-permissions.tsx@@ -1,7 +1,7 @@import { getUserPolicy } from "@remotion/lambda/dist/api/iam-validation/suggested-policy";import React from "react";-export const LambdaRegionList: React.FC = () => {+export const UserPolicy: React.FC = () => {return (<div><pre>{getUserPolicy()}</pre>diff --git a/packages/docs/docs/lambda/cli.md b/packages/docs/docs/lambda/cli.mdindex 3367e85326..2b31157154 100644--- a/packages/docs/docs/lambda/cli.md+++ b/packages/docs/docs/lambda/cli.md@@ -5,7 +5,13 @@ title: "@remotion/lambda - CLI"slug: /lambda/cli----You can get a list of all commands using `npx remotion lambda --help`.+## Commands++- [sites](/docs/lambda/sites)+- [functions](/docs/lambda/functions)+- [render](/docs/lambda/render)+- [still](/docs/lambda/still)+- [policies](/docs/lambda/policies)## Global options@@ -23,112 +29,6 @@ The default region is `us-east-1`. You may also set a `AWS_REGION` environment vSkips confirmation when doing a destructive action.-## sites--### create--Uploads a Remotion project to an S3 bucket. You will get a URL which you can pass to the `render` command to render the video.--```-npx remotion lambda sites create src/index.ts-```--###Â ls--Lists the sites uploaded to the S3 buckets--```-npx remotion lambda sites ls-```--### rm--Deletes a site from an S3 bucket.--```-npx remotion lambda sites rm f87nffa-```--## policies--Deals with AWS policy documents, generating and validating policies that need to be added to the account.--### user--Print the suggested policy to be applied to the user that is attached to the access token.--```-npx remotion lambda policies user-```--### role--Print the suggested policy to be applied to the role that is attached to the lambda function.--```-npx remotion lambda policies role-```--### validate--Validate the current policies setup is correct by running tests using the AWS policy simulator.--```-npx remotion lambda policies validate-```+### `--quiet`, `-q`-## render--Renders a video using Remotion Lambda. You need to pass two arguments:--- A URL, obtained from the `sites create` command.-- The ID of the composition that you want to render.--```-npx remotion lambda render https://remotionlambda-abcdefgh.s3.eu-central-1.amazonaws.com/sites/abcdefgh HelloWorld-```--## still--Renders a still frame using Remotion Lambda. You need to pass two arguments:--- A URL, obtained from the `sites create` command.-- The ID of the composition that you want to render.--```-npx remotion lambda still https://remotionlambda-abcdefgh.s3.eu-central-1.amazonaws.com/sites/abcdefgh HelloWorld-```--## functions--### deploy--Deploys a Remotion render lambda function to your account. You only need 1 function to render videos.--```-npx remotion lambda functions deploy-```--### ls--List the functions deployed to your AWS account.--```-npx remotion lambda functions ls-```--### rm--Removes a render function from your AWS account.--```-npx remotion lambda functions rm remotion lambda-4y2y1aaf-```--## cleanup--This command helps remove Remotion-related resources from your AWS account.--```-npx remotion lambda cleanup-```+Prints the minimal amount of logs.diff --git a/packages/docs/docs/lambda/cli/functions.md b/packages/docs/docs/lambda/cli/functions.mdindex 53c3e3f707..2fc0fb2951 100644--- a/packages/docs/docs/lambda/cli/functions.md+++ b/packages/docs/docs/lambda/cli/functions.md@@ -34,6 +34,10 @@ Deployed as remotion-render-2021-12-17-2048mb-120sec</pre></details>+### `--region`++The [AWS region](/docs/lambda/region-selection) to select. Both project and function should be in this region.+### `--memory`Memory size in megabytes. Default: <DefaultMemorySize /> MB.@@ -73,6 +77,10 @@ remotion-render-2021-12-15-2048mb-240sec 2021-12-15 2048</pre></details>+### `--region`++The [AWS region](/docs/lambda/region-selection) to select. Both project and function should be in this region.+### `--quiet`, `-q`Prints only the function names in a space-separated list. If no functions exist, prints `()`@@ -102,6 +110,10 @@ Deleted!</pre></details>+### `--region`++The [AWS region](/docs/lambda/region-selection) to select. Both project and function should be in this region.+### `--yes`, `-y`Skips confirmation.diff --git a/packages/docs/docs/lambda/cli/policies.md b/packages/docs/docs/lambda/cli/policies.mdnew file mode 100644index 0000000000..900fd77742--- /dev/null+++ b/packages/docs/docs/lambda/cli/policies.md@@ -0,0 +1,47 @@+---+id: policies+sidebar_label: policies+title: "npx remotion lambda policies"+slug: /lambda/cli/policies+---++import {RolePolicy} from '../../../components/lambda/role-permissions.tsx';+import {UserPolicy} from '../../../components/lambda/user-permissions.tsx';++Prints the necessary permissions to be inserted into the AWS console during [setup](/docs/lambda/setup).++:::tip+On macOS, add `| pbcopy` to the end of the command to copy the output.+:::++## role++```+npx remotion lambda policies role+```++<details>+<summary>Show output+</summary>+ <RolePolicy />+</details>++## user++```+npx remotion lambda policies user+```++<details>+<summary>Show output+</summary>+ <UserPolicy />+</details>++## validate++Goes through all user permissions and validates them against the AWS Policy simulator. (Role permissions cannot be validated)++## See also++- [Setup guide](/docs/lambda/setup)diff --git a/packages/docs/docs/lambda/cli/render.md b/packages/docs/docs/lambda/cli/render.mdindex 51e806b163..5271f32105 100644--- a/packages/docs/docs/lambda/cli/render.md+++ b/packages/docs/docs/lambda/cli/render.md@@ -15,23 +15,51 @@ npx remotion lambda render <serve-url> <composition-id> [<output-location>]- The serve URL is obtained by deploying a project to Remotion using the [`sites create`](/docs/lambda/cli/sites#create) command or calling [`deploySite()`](/docs/lambda/deploysite).- The composition ID is the [`id` of your `<Composition/>`](/docs/the-fundamentals#defining-compositions).-- The `output-location` parameter is optional. If you don't specify it, the video is stored in your S3 bucket. If you specify a location, it gets downloaded to your device as an additional step.+- The `output-location` parameter is optional. If you don't specify it, the video is stored in your S3 bucket. If you specify a location, it gets downloaded to your device in an additional step.## Example commandsRendering a video:```-npx remotion lambda render https://remotionlambda-abcdef.s3.eu-central-1.amazonaws.com/sites/testbed/index.html react-svg+npx remotion lambda render https://remotionlambda-abcdef.s3.eu-central-1.amazonaws.com/sites/testbed/index.html my-comp```Rendering a video and saving it to `out/video.mp4`:```-npx remotion lambda render https://remotionlambda-abcdef.s3.eu-central-1.amazonaws.com/sites/testbed/index.html react-svg out/video.mp4+npx remotion lambda render https://remotionlambda-abcdef.s3.eu-central-1.amazonaws.com/sites/testbed/index.html my-comp out/video.mp4```-TODO: Add more example commands+Using the shorthand serve URL:++```+npx remotion lambda render testbed my-comp+```++Passing in input props:++```+npx remotion lambda render --props='{"hi": "there"}' testbed my-comp+```++Printing debug information including a CloudWatch link:++```+npx remotion lambda render --log=verbose testbed my-comp+```++Keeping the output video private:++```+npx remotion lambda render --privacy=private testbed my-comp+```++Rendering only the audio:++```+npx remotion lambda render --codec=mp3 testbed my-comp+```## Flags@@ -45,7 +73,7 @@ The [AWS region](/docs/lambda/region-selection) to select. Both project and func### `--log`-The log level that will be used in the Lambda functions, either `verbose`, `info`, `warn` or `error`. Default `info`. Logs will be available in CloudWatch, if enabled.+Log level to be used inside the Lambda function. Also, if you set it to `verbose`, a link to CloudWatch will be printed where you can inspect logs.### `--privacy`@@ -79,10 +107,6 @@ How many frames should be rendered in a single Lambda function. Increase it to r[To set Constant Rate Factor (CRF) of the output](/docs/config#setcrf). Minimum 0. Use this rate control mode if you want to keep the best quality and care less about the file size.-### `--frames`--[Render a still frame or a subset of a video](/docs/config#setframerange). Example: `--frames=0-9` (To select the first 10 frames) or `--frames=50` (To render a still of the 51st frame).-### `--pixel-format`[Set a custom pixel format. See here for available values.](/docs/config#setpixelformat)diff --git a/packages/docs/docs/lambda/cli/sites.md b/packages/docs/docs/lambda/cli/sites.mdindex 9e75f41ae9..225e89e79a 100644--- a/packages/docs/docs/lambda/cli/sites.md+++ b/packages/docs/docs/lambda/cli/sites.md@@ -34,6 +34,10 @@ https://remotionlambda-12345.s3.eu-central-1.amazonaws.com/sites/abcdef/index.ht</pre></details>+### `--region`++The [AWS region](/docs/lambda/region-selection) to select. Both project and function should be in this region.+### `--site-name`Uploads the project to a specific directory and returns a deterministic URL. If a site already existed under this name, it will be overwritten.@@ -78,7 +82,11 @@ https://remotionlambda-abcdefg.s3.eu-central-1.amazonaws.com/sites/testbed/index</pre></details>-### `-q`+### `--region`++The [AWS region](/docs/lambda/region-selection) to select. Both project and function should be in this region.++### `--quiet`, `-q`Returns only a list of space-separated sites.@@ -157,7 +165,11 @@ Example output</pre></details>-### `-y`+### `--region`++The [AWS region](/docs/lambda/region-selection) to select. Both project and function should be in this region.++### `--yes`, `-y`Removes a site without asking for confirmation.diff --git a/packages/docs/docs/lambda/cli/still.md b/packages/docs/docs/lambda/cli/still.mdindex 4787d193db..2b8468baf2 100644--- a/packages/docs/docs/lambda/cli/still.md+++ b/packages/docs/docs/lambda/cli/still.md@@ -5,4 +5,70 @@ title: "npx remotion lambda still"slug: /lambda/cli/still----TODO+Using the `npx remotion lambda still` command, you can render a still frame in the cloud.++The command has the following structure:++```+npx remotion lambda still <serve-url> <composition-id> [<output-location>]+```++- The serve URL is obtained by deploying a project to Remotion using the [`sites create`](/docs/lambda/cli/sites#create) command or calling [`deploySite()`](/docs/lambda/deploysite).+- The composition ID is the [`id` of your `<Composition/>`](/docs/the-fundamentals#defining-compositions).+- The `output-location` parameter is optional. If you don't specify it, the still is stored in your S3 bucket. If you specify a location, it gets downloaded to your device in an additional step.++## Example commands++Rendering a still:++```+npx remotion lambda still https://remotionlambda-abcdef.s3.eu-central-1.amazonaws.com/sites/testbed/index.html my-comp+```++Rendering using the serve URL shorthand :++```+npx remotion lambda still testbed my-comp+```++Rendering the 10th frame of a composition:++```+npx remotion lambda still --frame=10 testbed my-comp+```++Downloading the result to a `out.png` file:++```+npx remotion lambda still testbed my-comp out.png+```++## Flags++### `--frame`++Render a specific frame of a composition. Default `0`++### `--region`++The [AWS region](/docs/lambda/region-selection) to select. Both project and function should be in this region.++### `--props`++[React Props to pass to the root component of your video.](/docs/parametrized-rendering#passing-input-props-in-the-cli) Must be a serialized JSON string (`--props='{"hello": "world"}'`) or a path to a JSON file (`./path/to/props.json`).++### `--log`++Log level to be used inside the Lambda function. Also, if you set it to `verbose`, a link to CloudWatch will be printed where you can inspect logs.++### `--privacy`++Defines if the output media is accessible for everyone or not. Either `public` or `private`, default `public`.++### `--max-retries`++How many times a single chunk is being retried if it fails to render. Default `1`.++### `--quality`++[Value between 0 and 100 for JPEG rendering quality](/docs/config#setquality). Doesn't work when PNG frames are rendered.diff --git a/packages/docs/docs/lambda/permissions.md b/packages/docs/docs/lambda/permissions.mdindex 49faa97ff4..942b4df2a9 100644--- a/packages/docs/docs/lambda/permissions.md+++ b/packages/docs/docs/lambda/permissions.md@@ -4,7 +4,7 @@ title: Lambda - Permissionsslug: /lambda/permissions----import {LambdaRegionList} from '../../components/lambda/user-permissions.tsx';+import {UserPolicy} from '../../components/lambda/user-permissions.tsx';import {RolePolicy} from '../../components/lambda/role-permissions.tsx';This document describes the necessary permissions for Remotion Lambda and explains to those interested why the permissions are necessary.@@ -18,7 +18,7 @@ This policy should be assigned to the **AWS user**. To do so, go to the [AWS con<details><summary>Show full user permissions JSON file for latest Remotion Lambda version</summary>-<LambdaRegionList />+<UserPolicy /></details>:::infodiff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.jsindex 2e34031316..cb2d64dd8f 100644--- a/packages/docs/sidebars.js+++ b/packages/docs/sidebars.js@@ -53,6 +53,7 @@ module.exports = {"lambda/cli/functions","lambda/cli/render","lambda/cli/still",+ "lambda/cli/policies",],},"lambda/setup",