Skip to content

🎥 Make videos programmatically with React

working on documentation

Matt McGillivray29c8460ecd8b
diff --git a/packages/docs/components/gcp/regions.tsx b/packages/docs/components/gcp/regions.tsx
new file mode 100644
index 0000000000..bcd4c105c2
--- /dev/null
+++ b/packages/docs/components/gcp/regions.tsx
@@ -0,0 +1,16 @@
+import { GCP_REGIONS } from "@remotion/gcp/regions";
+import React from "react";
+
+export const GcpRegionList: React.FC = () => {
+ return (
+ <ul>
+ {GCP_REGIONS.map((region) => {
+ return (
+ <li key={region}>
+ <code>{region}</code>{" "}
+ </li>
+ );
+ })}
+ </ul>
+ );
+};
diff --git a/packages/docs/docs/gcp.md b/packages/docs/docs/gcp.md
new file mode 100644
index 0000000000..687083b0dc
--- /dev/null
+++ b/packages/docs/docs/gcp.md
@@ -0,0 +1,87 @@
+---
+image: /generated/articles-docs-lambda.png
+id: gcp
+sidebar_label: Overview
+title: "@remotion/gcp"
+---
+
+Render Remotion videos on [GCP Cloud Run](https://cloud.google.com/run).
+
+import {GcpRegionList} from '../components/gcp/regions.tsx';
+
+## When should I use it?
+
+- You are fine with using Google Cloud Platform in one of the [supported regions](/docs/gcp/region-selection).
+
+If one of those constraints is a dealbreaker for you, resort to normal [server-side rendering](/docs/ssr).
+
+## How it works
+
+### Deployment
+
+- Any time a new version of Remotion is published by the Remotion team, a new image will be uploaded to a publicly readable artifact registry in GCP.
+- When you deploy a new Cloud Run service to your GCP Project, it will by default download the latest image from the repository. If you require a specific version, you can specify that in the command.
+
+### Rendering
+
+- A Cloud Run service and a Cloud Storage bucket are created in GCP.
+- A Remotion project gets deployed to a Cloud Storage bucket as a website.
+- The Cloud Run service gets invoked and opens the Remotion project.
+- The Cloud Run service renders the video or still, and the final video gets uploaded to Cloud Storage and is available for download.
+
+## Architecture
+
+- **Cloud Run service**: Contains the required libraries and binaries for rendering Remotion projects, and is available for invoking behind a URL.
+- **Cloud Storage bucket**: Stores the projects, the renders, and render metadata.
+- **CLI**: Allows control of the overall architecture from the command line. Is installed by adding `@remotion/gcp` to a project.
+- **Node.JS API**: Has the same features as the CLI but is easier to use programmatically.
+
+## Setup / Installation
+
+[**See here**](/docs/gcp/setup)
+
+## Region selection
+
+The following regions are available for Remotion Cloud Run:
+
+<GcpRegionList />
+
+[**See here for configurations and considerations.**](/docs/gcp/region-selection)
+
+## Limitations
+
+- You only have up to 10GB of storage available in a Lambda function. This must be sufficient for both the separated chunks and the concatenated output, therefore the output file can only be about 5GB maximum, limiting the maximum video length to around 2 hours of Full HD video.
+- [Lambda has a global limit of 1000 concurrent lambdas per region by default, although it can be increased](/docs/lambda/troubleshooting/rate-limit).
+- Lambda has a [burst limit of as low as 500](https://docs.aws.amazon.com/lambda/latest/dg/invocation-scaling.html) (depending per region) functions that can be spawned in a short amount of time. If you render a lot of videos, you must slowly build up invocations rather than trigger them all at once.
+
+## Cost
+
+Most of our users render multiple minutes of video for just a few pennies. The exact cost is dependent on the region, assigned memory, type of video and other parameters. For each render, we estimate a cost and display it to you. You might also need a Remotion license (see below).
+
+## GCP permissions
+
+Remotion Cloud Run requires you to create a GCP project and create a Service Account with some permissions attached to it. We require only the minimal amount of permissions required for operating Remotion Cloud Run.
+
+[**Read more about permissions**](/docs/gcp/permissions)
+
+## CLI
+
+You can control Remotion Cloud Run using the `npx remotion gcp` command.
+
+[**Read more about the CLI**](/docs/gcp/cli)
+
+## Node.JS API
+
+Everything you can do using the CLI, you can also control using Node.JS APIs. See the reference [here](/docs/gcp/api).
+
+## License
+
+The standard Remotion license applies. https://github.com/remotion-dev/remotion/blob/main/LICENSE.md
+
+Companies need to buy 1 cloud rendering seat per 2000 renders per month - see https://companies.remotion.dev/
+
+## Uninstalling
+
+We make it easy to remove all Remotion resources from your GCP account without leaving any traces or causing further costs.
+
+[**How to uninstall Remotion Lambda**](/docs/gcp/uninstall)
diff --git a/packages/docs/docs/gcp/region-selection.md b/packages/docs/docs/gcp/region-selection.md
new file mode 100644
index 0000000000..fc207006d5
--- /dev/null
+++ b/packages/docs/docs/gcp/region-selection.md
@@ -0,0 +1,49 @@
+---
+image: /generated/articles-docs-gcp-region-selection.png
+id: region-selection
+title: Region selection
+slug: /gcp/region-selection
+crumb: "GCP"
+---
+
+import {GcpRegionList} from '../../components/gcp/regions.tsx';
+
+Before going live with Remotion Cloud Run, you need to think about into which GCP region you are deploying your service and bucket.
+
+This document explains how to select a region and which considerations you need to make.
+
+## Available regions
+
+The following GCP regions are available:
+
+<GcpRegionList />
+
+You can call [`getRegions()`](/docs/gcp/getregions) or type [`npx remotion gcp regions`](/docs/lamgcpda/cli/regions) to get this list programmatically.
+
+## Default region
+
+The default region is `us-east1`.
+
+## Selecting a region
+
+There are 3 ways of selection a region:
+
+- When using the Node.JS APIs, you have to pass the region explicitly to each function. Make sure your projects satisfy the Typescript types or follow the documentation.
+
+- When using the CLI, you can set the region using the `REMOTION_GCP_REGION` environment variable. It's best to put it in a `.env` file so you don't forget it sometimes.
+
+- You can also pass the `--region` flag to all CLI commands to override the region. The flag takes precedence over the environment variable.
+
+:::info
+The REMOTION_GCP_REGION environment variable and `--region` flag do not have an effect when using the Node.JS APIs. You need to pass a region explicitly.
+:::
+
+If you don't set a region, Remotion will use the default region.
+
+## Which region should I choose?
+
+Note that each region falls into one of two different pricing tiers. Some regions also offer low CO<sub>2</sub> intensity electricity usage. The full list of regions per tier is available in the [Cloud Run Docs](https://cloud.google.com/run/docs/locations).
+
+## Other considerations
+
+- The Cloud Run service and Cloud Storage bucket must be in the same region to eliminate latency across datacenters.
diff --git a/packages/docs/package.json b/packages/docs/package.json
index ca8e1fc74e..7a89b6371d 100644
--- a/packages/docs/package.json
+++ b/packages/docs/package.json
@@ -29,6 +29,7 @@
"@remotion/babel-loader": "workspace:*",
"@remotion/bundler": "workspace:*",
"@remotion/cli": "workspace:*",
+ "@remotion/gcp": "workspace:*",
"@remotion/gif": "workspace:*",
"@remotion/google-fonts": "workspace:*",
"@remotion/lambda": "workspace:*",
@@ -82,4 +83,4 @@
"typescript": "^4.7.0",
"url-loader": "^4.1.1"
}
-}
+}
\ No newline at end of file
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index dc12484435..b18e003b6e 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -454,6 +454,17 @@ module.exports = {
"lambda/upgrading",
"lambda/uninstall",
],
+ },{
+ type: "category",
+ label: "GCP",
+ link: {
+ type: "doc",
+ id: "gcp",
+ },
+ items: [
+ "lambda/setup",
+ "gcp/region-selection"
+ ],
},
{
type: "category",
diff --git a/packages/gcp/package.json b/packages/gcp/package.json
index ed5b82046a..498896cc58 100644
--- a/packages/gcp/package.json
+++ b/packages/gcp/package.json
@@ -31,5 +31,20 @@
"eslint": "8.25.0",
"@jonny/eslint-config": "3.0.266",
"vitest": "0.24.3"
+ },
+ "exports": {
+ "./package.json": "./package.json",
+ ".": "./dist/index.js",
+ "./regions": "./dist/regions.js"
+ },
+ "typesVersions": {
+ ">=1.0": {
+ "defaults": [
+ "dist/defaults.d.ts"
+ ],
+ "regions": [
+ "dist/regions.d.ts"
+ ]
+ }
}
}
\ No newline at end of file
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 40c6f78433..53c42b2cd3 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -326,6 +326,7 @@ importers:
'@remotion/babel-loader': workspace:*
'@remotion/bundler': workspace:*
'@remotion/cli': workspace:*
+ '@remotion/gcp': workspace:*
'@remotion/gif': workspace:*
'@remotion/google-fonts': workspace:*
'@remotion/lambda': workspace:*
@@ -389,6 +390,7 @@ importers:
'@remotion/babel-loader': link:../babel-loader
'@remotion/bundler': link:../bundler
'@remotion/cli': link:../cli
+ '@remotion/gcp': link:../gcp
'@remotion/gif': link:../gif
'@remotion/google-fonts': link:../google-fonts
'@remotion/lambda': link:../lambda