Skip to content

🎥 Make videos programmatically with React

use built in remotion version

Jonny Burger3f983a60d36c
diff --git a/packages/gcp/readme.md b/packages/gcp/readme.md
index fc1c9c0140..b04228bce7 100644
--- a/packages/gcp/readme.md
+++ b/packages/gcp/readme.md
@@ -66,16 +66,13 @@ Options:
- --service-name (required):
- the name of the Cloud Run service to deploy or update. Service names must be 49 characters or less and must be unique per region and project. A service name cannot be changed later and is publicly visible. The service does not need to exist yet. If it does exist, a new revision will be deployed.
- --region: the region of the service
-- --remotion-version (required for now): the version of the remotion package to use
- - the version of Remotion to deploy on the service. Behind the scenes, this is selecting the container image from a publicly readable repository `us-docker.pkg.dev/remotion-dev/cloud-run/render`. Part of the build step for the monorepo will be to deploy a new container image to this repository, with the remotion version as a tag.
- - for now, the remotion version must be set to `3.3.36-alpha`
- --allow-unauthenticated (optional, default to false):
- whether to allow unauthenticated requests to the service. For now, I would suggest setting this to true, to avoid having to create a service account and grant it access to the service. In the future, it would be recommended to not set this tru.
- --overwrite-service (optional, default to false):
- if an existing service is found with the same name, a prompt will come up asking if a new revision should be deployed. If this flag is set to true, the prompt will be skipped and a new revision will be deployed automatically.
Taking the above into account, a valid command would be:
-`npx remotion gcp cloud-run deploy --service-name=cloud-run-render --project-id=new-remotion-project --remotion-version=3.3.36-alpha --allow-unauthenticated`
+`npx remotion gcp cloud-run deploy --service-name=cloud-run-render --project-id=new-remotion-project --allow-unauthenticated`
To view the deployed service, navigate to the [Cloud Run](https://console.cloud.google.com/run) screen in Google Cloud Console, and selecting the project from the drop-down menu in the top left corner.
diff --git a/packages/gcp/remotion-gcp-cli.mjs b/packages/gcp/remotion-gcp-cli.mjs
index 0d215067bb..71dc30c22c 100755
--- a/packages/gcp/remotion-gcp-cli.mjs
+++ b/packages/gcp/remotion-gcp-cli.mjs
@@ -1,13 +1,12 @@
#!/usr/bin/env node
-import { v2 } from "@google-cloud/run";
-import fs from "fs";
-import { Storage, TransferManager } from "@google-cloud/storage";
+import {Storage} from '@google-cloud/storage';
+import fs from 'fs';
-// npx remotion-gcp --remotion-version=3.3.51-alpha --project=remotion-lambda --service-name=hello --region=australia-southeast1
+// npx remotion-gcp --project=remotion-lambda --service-name=hello --region=australia-southeast1
// const { ServicesClient } = v2;
-const sa_data = fs.readFileSync("./sa-key.json", "utf8");
+const sa_data = fs.readFileSync('./sa-key.json', 'utf8');
const sa_json = JSON.parse(sa_data);
// const runClient = new ServicesClient({
@@ -63,14 +62,14 @@ const sa_json = JSON.parse(sa_data);
// }
const cloudStorageClient = new Storage({
- credentials: sa_json,
+ credentials: sa_json,
});
// cloudStorageClient.bucket('remotionlambda-testy').get()
// const result = await cloudStorageClient.bucket('remotionlambda-testc').get();
-const bucketName = "remotionlambda-test";
-const prefix = "sites/xmycbufjs3/";
+const bucketName = 'remotionlambda-test';
+const prefix = 'sites/xmycbufjs3/';
// const [files] = await cloudStorageClient.bucket(bucketName).getFiles({ prefix });
// // const [files, nextContinuationToken] = await cloudStorageClient.bucket('gcp-public-data-landsat').getFiles({ prefix: 'LC08/01/001' });
@@ -89,8 +88,8 @@ const prefix = "sites/xmycbufjs3/";
// const key = 'sites/xmycbufjs3/LibraryMock.png'
// await cloudStorageClient.bucket(bucketName).file(key).delete();
// https://storage.googleapis.com/remotionlambda-test/sites/xmycbufjs3/LibraryMock.png
-const firstFilePath = "haloInf.mp4";
-const secondFilePath = "zoomJump.mp4";
+const firstFilePath = 'haloInf.mp4';
+const secondFilePath = 'zoomJump.mp4';
// const transferManager = new TransferManager(cloudStorageClient.bucket(bucketName));
// await transferManager.uploadManyFiles([firstFilePath, secondFilePath], { prefix });
@@ -100,33 +99,33 @@ const secondFilePath = "zoomJump.mp4";
// }
const bucket = cloudStorageClient.bucket(bucketName);
-const remote_file = bucket.file("new/haloInf.mp4");
+const remote_file = bucket.file('new/haloInf.mp4');
-console.log("test message");
+console.log('test message');
const uploadPromises = [];
const paths = [firstFilePath, secondFilePath];
async function uploadInParallel() {
- for (const index in paths) {
- const path = paths[index];
- const fileSizeInBytes = fs.statSync(path).size;
- uploadPromises.push(
- fs
- .createReadStream(path)
- .pipe(bucket.file(`new/${path}`).createWriteStream())
- .on("error", function (err) {})
- .on("progress", function (p) {
- console.log(
- path,
- `${Math.floor((p.bytesWritten / fileSizeInBytes) * 100)}%`
- );
- })
- .on("finish", function () {
- console.log(path, " completed");
- })
- );
- }
+ for (const index in paths) {
+ const path = paths[index];
+ const fileSizeInBytes = fs.statSync(path).size;
+ uploadPromises.push(
+ fs
+ .createReadStream(path)
+ .pipe(bucket.file(`new/${path}`).createWriteStream())
+ .on('error', (err) => {})
+ .on('progress', (p) => {
+ console.log(
+ path,
+ `${Math.floor((p.bytesWritten / fileSizeInBytes) * 100)}%`
+ );
+ })
+ .on('finish', () => {
+ console.log(path, ' completed');
+ })
+ );
+ }
}
// const promise = Promise.all(uploadPromises).catch(console.error);
@@ -136,21 +135,21 @@ async function uploadInParallel() {
// console.log('after')
const uploads = paths.map(async (path) => {
- const fileSizeInBytes = fs.statSync(path).size;
- return new Promise((resolve, reject) => {
- fs.createReadStream(path)
- .pipe(bucket.file(`new/${path}`).createWriteStream())
- .on("error", (error) => reject(error))
- .on("progress", function (p) {
- console.log(
- path,
- `${Math.floor((p.bytesWritten / fileSizeInBytes) * 100)}%`
- );
- })
- .on("finish", () => resolve("done"));
- });
+ const fileSizeInBytes = fs.statSync(path).size;
+ return new Promise((resolve, reject) => {
+ fs.createReadStream(path)
+ .pipe(bucket.file(`new/${path}`).createWriteStream())
+ .on('error', (error) => reject(error))
+ .on('progress', (p) => {
+ console.log(
+ path,
+ `${Math.floor((p.bytesWritten / fileSizeInBytes) * 100)}%`
+ );
+ })
+ .on('finish', () => resolve('done'));
+ });
});
-console.log("before");
+console.log('before');
const promise = Promise.all(uploads);
await promise;
-console.log("after");
+console.log('after');
diff --git a/packages/gcp/src/cli/args.ts b/packages/gcp/src/cli/args.ts
index 39ad4e5f6e..d724d1d8a1 100644
--- a/packages/gcp/src/cli/args.ts
+++ b/packages/gcp/src/cli/args.ts
@@ -6,7 +6,6 @@ type GCPCommandLineOptions = {
help: boolean;
region: GcpRegion;
['project-id']: string;
- ['remotion-version']: string | undefined;
['service-name']: string;
['allow-unauthenticated']: boolean | undefined;
y: boolean;
diff --git a/packages/gcp/src/cli/commands/cloud-run/deploy.ts b/packages/gcp/src/cli/commands/cloud-run/deploy.ts
index 9d2a3cbf45..6ec18f1d8f 100644
--- a/packages/gcp/src/cli/commands/cloud-run/deploy.ts
+++ b/packages/gcp/src/cli/commands/cloud-run/deploy.ts
@@ -21,7 +21,7 @@ export const cloudRunDeploySubcommand = async () => {
const region = getGcpRegion();
const serviceName = parsedGcpCli['service-name'];
const projectID = parsedGcpCli['project-id'];
- const remotionVersion = parsedGcpCli['remotion-version'] ?? VERSION;
+ const remotionVersion = VERSION;
const allowUnauthenticated = parsedGcpCli['allow-unauthenticated'] ?? false;
const overwriteService = parsedGcpCli['overwrite-service'] ?? false;
const memory = parsedGcpCli.memory ?? '512Mi';