Skip to content

🎥 Make videos programmatically with React

tidying argument logic for cloudrun rendering

Matt McGillivray69238b541c89
diff --git a/packages/cloudrun/gcpInstaller/gcpInstaller.tar b/packages/cloudrun/gcpInstaller/gcpInstaller.tar
index 947a9d9a7d..e9e00266f9 100644
Binary files a/packages/cloudrun/gcpInstaller/gcpInstaller.tar and b/packages/cloudrun/gcpInstaller/gcpInstaller.tar differ
diff --git a/packages/cloudrun/src/cli/commands/render/helpers/renderArgsCheck.ts b/packages/cloudrun/src/cli/commands/render/helpers/renderArgsCheck.ts
index fa39453ac3..42f5b721c8 100644
--- a/packages/cloudrun/src/cli/commands/render/helpers/renderArgsCheck.ts
+++ b/packages/cloudrun/src/cli/commands/render/helpers/renderArgsCheck.ts
@@ -1,5 +1,4 @@
import {CliInternals} from '@remotion/cli';
-import {ConfigInternals} from '@remotion/cli/config';
import {getCompositions} from '@remotion/renderer';
import {getOrCreateBucket} from '../../../../api/get-or-create-bucket';
@@ -15,11 +14,7 @@ import {getGcpRegion} from '../../../get-gcp-region';
import {quit} from '../../../helpers/quit';
import {Log} from '../../../log';
-export const renderArgsCheck = async (
- subcommand: string,
- args: string[],
- remotionRoot: string
-) => {
+export const renderArgsCheck = async (subcommand: string, args: string[]) => {
let region;
let serveUrl = args[0];
@@ -59,41 +54,6 @@ export const renderArgsCheck = async (
const outName = parsedCloudrunCli['out-name'];
const downloadName = args[2] ?? null;
- const {codec, reason} = CliInternals.getFinalOutputCodec({
- cliFlag: CliInternals.parsedCli.codec,
- downloadName,
- outName: outName ?? null,
- configFile: ConfigInternals.getOutputCodecOrUndefined() ?? null,
- uiCodec: null,
- });
-
- const {
- chromiumOptions,
- crf,
- envVariables,
- frameRange,
- inputProps,
- logLevel,
- pixelFormat,
- proResProfile,
- puppeteerTimeout,
- jpegQuality,
- scale,
- everyNthFrame,
- numberOfGifLoops,
- muted,
- overwrite,
- audioBitrate,
- videoBitrate,
- height,
- width,
- stillFrame,
- } = await CliInternals.getCliOptions({
- type: 'series',
- isLambda: true,
- remotionRoot,
- });
-
const privacy = parsedCloudrunCli.privacy ?? DEFAULT_OUTPUT_PRIVACY;
validatePrivacy(privacy);
@@ -140,42 +100,14 @@ export const renderArgsCheck = async (
const authenticatedRequest = !parsedCloudrunCli['unauthenticated-request'];
- const audioCodec = parsedCloudrunCli['audio-codec'];
-
- const imageFormat = parsedCloudrunCli['image-format'];
-
return {
serveUrl,
cloudRunUrl,
composition,
outName,
- codec,
- codecReason: reason,
- inputProps,
outputBucket,
privacy,
authenticatedRequest,
downloadName,
- jpegQuality,
- audioCodec,
- audioBitrate,
- videoBitrate,
- proResProfile,
- crf,
- pixelFormat,
- imageFormat,
- scale,
- everyNthFrame,
- numberOfGifLoops,
- frameRange,
- envVariables,
- chromiumOptions,
- logLevel,
- puppeteerTimeout,
- muted,
- overwrite,
- height,
- width,
- stillFrame,
};
};
diff --git a/packages/cloudrun/src/cli/commands/render/renderMedia.ts b/packages/cloudrun/src/cli/commands/render/renderMedia.ts
index 700276d7f3..9f42dba140 100644
--- a/packages/cloudrun/src/cli/commands/render/renderMedia.ts
+++ b/packages/cloudrun/src/cli/commands/render/renderMedia.ts
@@ -3,7 +3,9 @@ import type {RenderMediaOnCloudrunOutput} from '../../../api/render-media-on-clo
import {renderMediaOnCloudrun} from '../../../api/render-media-on-cloudrun';
import type {CloudrunCodec} from '../../../shared/validate-gcp-codec';
// import {validateMaxRetries} from '../../../shared/validate-retries';
+import {ConfigInternals} from '@remotion/cli/config';
import {downloadFile} from '../../../api/download-file';
+import {parsedCloudrunCli} from '../../args';
import {Log} from '../../log';
import {renderArgsCheck} from './helpers/renderArgsCheck';
@@ -18,31 +20,46 @@ export const renderMediaSubcommand = async (
cloudRunUrl,
composition,
outName,
- codec,
- codecReason,
- inputProps,
outputBucket,
downloadName,
privacy,
authenticatedRequest,
- jpegQuality,
- audioCodec,
- audioBitrate,
- videoBitrate,
- proResProfile,
+ } = await renderArgsCheck(RENDER_MEDIA_SUBCOMMAND, args);
+
+ const {codec, reason: codecReason} = CliInternals.getFinalOutputCodec({
+ cliFlag: CliInternals.parsedCli.codec,
+ downloadName,
+ outName: outName ?? null,
+ configFile: ConfigInternals.getOutputCodecOrUndefined() ?? null,
+ uiCodec: null,
+ });
+
+ const imageFormat = parsedCloudrunCli['image-format'];
+
+ const audioCodec = parsedCloudrunCli['audio-codec'];
+
+ const {
+ chromiumOptions,
crf,
+ envVariables,
+ frameRange,
+ inputProps,
pixelFormat,
- imageFormat,
+ proResProfile,
+ jpegQuality,
scale,
everyNthFrame,
numberOfGifLoops,
- frameRange,
- envVariables,
- chromiumOptions,
muted,
+ audioBitrate,
+ videoBitrate,
height,
width,
- } = await renderArgsCheck(RENDER_MEDIA_SUBCOMMAND, args, remotionRoot);
+ } = await CliInternals.getCliOptions({
+ type: 'series',
+ isLambda: true,
+ remotionRoot,
+ });
// Todo: Check cloudRunUrl is valid, as the error message is obtuse
CliInternals.Log.info(
diff --git a/packages/cloudrun/src/cli/commands/render/renderStill.ts b/packages/cloudrun/src/cli/commands/render/renderStill.ts
index f514837947..17265e9c77 100644
--- a/packages/cloudrun/src/cli/commands/render/renderStill.ts
+++ b/packages/cloudrun/src/cli/commands/render/renderStill.ts
@@ -17,19 +17,26 @@ export const renderStillSubcommand = async (
cloudRunUrl,
composition,
outName,
- inputProps,
outputBucket,
privacy,
authenticatedRequest,
downloadName,
+ } = await renderArgsCheck(RENDER_STILL_SUBCOMMAND, args);
+
+ const {
+ chromiumOptions,
envVariables,
- stillFrame,
+ inputProps,
jpegQuality,
- chromiumOptions,
+ stillFrame,
scale,
height,
width,
- } = await renderArgsCheck(RENDER_STILL_SUBCOMMAND, args, remotionRoot);
+ } = await CliInternals.getCliOptions({
+ type: 'still',
+ isLambda: true,
+ remotionRoot,
+ });
const {format: imageFormat, source: imageFormatReason} =
CliInternals.determineFinalStillImageFormat({