Skip to content

🎥 Make videos programmatically with React

Remove height, width, fps, durationInFrames, concurrency from getCliOptions

Jonny Burgerbc798f1a1f40
diff --git a/packages/cli/src/benchmark.ts b/packages/cli/src/benchmark.ts
index 1cb4c77a61..3dd6e8246f 100644
--- a/packages/cli/src/benchmark.ts
+++ b/packages/cli/src/benchmark.ts
@@ -67,6 +67,11 @@ const {
userAgentOption,
disableWebSecurityOption,
ignoreCertificateErrorsOption,
+ concurrencyOption,
+ overrideHeightOption,
+ overrideWidthOption,
+ overrideFpsOption,
+ overrideDurationOption,
} = BrowserSafeApis.options;
const getValidConcurrency = (cliConcurrency: number | string | null) => {
@@ -209,17 +214,26 @@ export const benchmarkCommand = async (
envVariables,
frameRange: defaultFrameRange,
ffmpegOverride,
- height,
- width,
- fps,
- durationInFrames,
- concurrency: unparsedConcurrency,
} = getCliOptions({
isStill: false,
logLevel,
indent: false,
});
+ const unparsedConcurrency = concurrencyOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+ const height = overrideHeightOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+ const width = overrideWidthOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+ const fps = overrideFpsOption.getValue({commandLine: parsedCli}).value;
+ const durationInFrames = overrideDurationOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+
const pixelFormat = pixelFormatOption.getValue({
commandLine: parsedCli,
}).value;
diff --git a/packages/cli/src/get-cli-options.ts b/packages/cli/src/get-cli-options.ts
index 1802190d20..740ca87bc6 100644
--- a/packages/cli/src/get-cli-options.ts
+++ b/packages/cli/src/get-cli-options.ts
@@ -1,5 +1,4 @@
import type {LogLevel} from '@remotion/renderer';
-import {RenderInternals} from '@remotion/renderer';
import {BrowserSafeApis} from '@remotion/renderer/client';
import fs from 'node:fs';
import path from 'node:path';
@@ -63,32 +62,7 @@ export const getCliOptions = (options: {
? true
: imageSequence || typeof frameRange === 'number';
- const concurrency = BrowserSafeApis.options.concurrencyOption.getValue({
- commandLine: parsedCli,
- }).value;
-
- const height = BrowserSafeApis.options.overrideHeightOption.getValue({
- commandLine: parsedCli,
- }).value;
- const width = BrowserSafeApis.options.overrideWidthOption.getValue({
- commandLine: parsedCli,
- }).value;
- const fps = BrowserSafeApis.options.overrideFpsOption.getValue({
- commandLine: parsedCli,
- }).value;
- const durationInFrames =
- BrowserSafeApis.options.overrideDurationOption.getValue({
- commandLine: parsedCli,
- }).value;
-
- RenderInternals.validateConcurrency({
- value: concurrency,
- setting: 'concurrency',
- checkIfValidForCurrentMachine: false,
- });
-
return {
- concurrency,
frameRange,
shouldOutputImageSequence,
inputProps: getInputProps(null, options.logLevel),
@@ -101,9 +75,5 @@ export const getCliOptions = (options: {
commandLine: parsedCli,
}).value ?? 0,
ffmpegOverride: ConfigInternals.getFfmpegOverrideFunction(),
- height,
- width,
- fps,
- durationInFrames,
};
};
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index 940cccd588..f34715dc38 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -55,6 +55,11 @@ const {
userAgentOption,
disableWebSecurityOption,
ignoreCertificateErrorsOption,
+ concurrencyOption,
+ overrideHeightOption,
+ overrideWidthOption,
+ overrideFpsOption,
+ overrideDurationOption,
} = BrowserSafeApis.options;
export const render = async (
@@ -95,15 +100,10 @@ export const render = async (
}
const {
- concurrency,
frameRange,
shouldOutputImageSequence,
inputProps,
envVariables,
- height,
- width,
- fps,
- durationInFrames,
ffmpegOverride,
} = getCliOptions({
isStill: false,
@@ -111,6 +111,20 @@ export const render = async (
indent: false,
});
+ const concurrency = concurrencyOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+ const height = overrideHeightOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+ const width = overrideWidthOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+ const fps = overrideFpsOption.getValue({commandLine: parsedCli}).value;
+ const durationInFrames = overrideDurationOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+
const pixelFormat = pixelFormatOption.getValue({
commandLine: parsedCli,
}).value;
diff --git a/packages/cli/src/still.ts b/packages/cli/src/still.ts
index a6669ff933..c8b03d0b41 100644
--- a/packages/cli/src/still.ts
+++ b/packages/cli/src/still.ts
@@ -34,6 +34,10 @@ const {
userAgentOption,
disableWebSecurityOption,
ignoreCertificateErrorsOption,
+ overrideHeightOption,
+ overrideWidthOption,
+ overrideFpsOption,
+ overrideDurationOption,
} = BrowserSafeApis.options;
export const still = async (
@@ -73,20 +77,23 @@ export const still = async (
process.exit(1);
}
- const {
- envVariables,
- height,
- inputProps,
- stillFrame,
- width,
- fps,
- durationInFrames,
- } = getCliOptions({
+ const {envVariables, inputProps, stillFrame} = getCliOptions({
isStill: true,
logLevel,
indent: false,
});
+ const height = overrideHeightOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+ const width = overrideWidthOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+ const fps = overrideFpsOption.getValue({commandLine: parsedCli}).value;
+ const durationInFrames = overrideDurationOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+
const browserExecutable = browserExecutableOption.getValue({
commandLine: parsedCli,
}).value;
diff --git a/packages/cloudrun/src/cli/commands/render/index.ts b/packages/cloudrun/src/cli/commands/render/index.ts
index 7972396fa9..6e7331aa25 100644
--- a/packages/cloudrun/src/cli/commands/render/index.ts
+++ b/packages/cloudrun/src/cli/commands/render/index.ts
@@ -45,6 +45,10 @@ const {
userAgentOption,
disableWebSecurityOption,
ignoreCertificateErrorsOption,
+ overrideHeightOption,
+ overrideWidthOption,
+ overrideFpsOption,
+ overrideDurationOption,
} = BrowserSafeApis.options;
export const renderCommand = async (
@@ -84,20 +88,25 @@ export const renderCommand = async (
commandLine: CliInternals.parsedCli,
}).value;
- const {
- envVariables,
- frameRange,
- inputProps,
- height,
- width,
- fps,
- durationInFrames,
- } = CliInternals.getCliOptions({
+ const {envVariables, frameRange, inputProps} = CliInternals.getCliOptions({
isStill: false,
logLevel,
indent: false,
});
+ const height = overrideHeightOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const width = overrideWidthOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const fps = overrideFpsOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const durationInFrames = overrideDurationOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+
const pixelFormat = pixelFormatOption.getValue({
commandLine: CliInternals.parsedCli,
}).value;
diff --git a/packages/cloudrun/src/cli/commands/still.ts b/packages/cloudrun/src/cli/commands/still.ts
index 78198a7a4b..1a3d1e323b 100644
--- a/packages/cloudrun/src/cli/commands/still.ts
+++ b/packages/cloudrun/src/cli/commands/still.ts
@@ -28,6 +28,10 @@ const {
userAgentOption,
disableWebSecurityOption,
ignoreCertificateErrorsOption,
+ overrideHeightOption,
+ overrideWidthOption,
+ overrideFpsOption,
+ overrideDurationOption,
} = BrowserSafeApis.options;
export const stillCommand = async (
@@ -45,20 +49,25 @@ export const stillCommand = async (
region,
} = await renderArgsCheck(STILL_COMMAND, args, logLevel);
- const {
- envVariables,
- inputProps,
- stillFrame,
- height,
- width,
- fps,
- durationInFrames,
- } = CliInternals.getCliOptions({
- isStill: false,
+ const {envVariables, inputProps, stillFrame} = CliInternals.getCliOptions({
+ isStill: true,
logLevel,
indent: false,
});
+ const height = overrideHeightOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const width = overrideWidthOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const fps = overrideFpsOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const durationInFrames = overrideDurationOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+
const browserExecutable = browserExecutableOption.getValue({
commandLine: CliInternals.parsedCli,
}).value;
diff --git a/packages/lambda/src/cli/commands/render/render.ts b/packages/lambda/src/cli/commands/render/render.ts
index a714d952d6..d435064cf4 100644
--- a/packages/lambda/src/cli/commands/render/render.ts
+++ b/packages/lambda/src/cli/commands/render/render.ts
@@ -65,6 +65,10 @@ const {
ignoreCertificateErrorsOption,
audioCodecOption,
videoCodecOption,
+ overrideHeightOption,
+ overrideWidthOption,
+ overrideFpsOption,
+ overrideDurationOption,
} = BrowserSafeApis.options;
export const renderCommand = async ({
@@ -95,20 +99,25 @@ export const renderCommand = async ({
const region = getAwsRegion();
- const {
- envVariables,
- frameRange,
- inputProps,
- height,
- width,
- fps,
- durationInFrames,
- } = CliInternals.getCliOptions({
+ const {envVariables, frameRange, inputProps} = CliInternals.getCliOptions({
isStill: false,
logLevel,
indent: false,
});
+ const height = overrideHeightOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const width = overrideWidthOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const fps = overrideFpsOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const durationInFrames = overrideDurationOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+
const pixelFormat = pixelFormatOption.getValue({
commandLine: CliInternals.parsedCli,
}).value;
diff --git a/packages/lambda/src/cli/commands/still.ts b/packages/lambda/src/cli/commands/still.ts
index e29ad658ef..4012c3623f 100644
--- a/packages/lambda/src/cli/commands/still.ts
+++ b/packages/lambda/src/cli/commands/still.ts
@@ -39,6 +39,10 @@ const {
userAgentOption,
disableWebSecurityOption,
ignoreCertificateErrorsOption,
+ overrideHeightOption,
+ overrideWidthOption,
+ overrideFpsOption,
+ overrideDurationOption,
} = BrowserSafeApis.options;
const {
@@ -79,20 +83,21 @@ export const stillCommand = async ({
quit(1);
}
- const {
- envVariables,
- inputProps,
- stillFrame,
- height,
- width,
- fps,
- durationInFrames,
- } = getCliOptions({
+ const {envVariables, inputProps, stillFrame} = getCliOptions({
isStill: true,
logLevel,
indent: false,
});
+ const height = overrideHeightOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+ const width = overrideWidthOption.getValue({commandLine: parsedCli}).value;
+ const fps = overrideFpsOption.getValue({commandLine: parsedCli}).value;
+ const durationInFrames = overrideDurationOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+
const browserExecutable = browserExecutableOption.getValue({
commandLine: parsedCli,
}).value;
diff --git a/packages/renderer/src/options/concurrency.tsx b/packages/renderer/src/options/concurrency.tsx
index 81314bd273..3243305bdb 100644
--- a/packages/renderer/src/options/concurrency.tsx
+++ b/packages/renderer/src/options/concurrency.tsx
@@ -1,4 +1,5 @@
import type {AnyRemotionOption} from './option';
+import {validateConcurrency} from '../validate-concurrency';
export type Concurrency = number | string | null;
@@ -21,9 +22,16 @@ export const concurrencyOption = {
type: null as Concurrency,
getValue: ({commandLine}) => {
if (commandLine[cliFlag] !== undefined) {
+ const value = commandLine[cliFlag] as Concurrency;
+ validateConcurrency({
+ value,
+ setting: 'concurrency',
+ checkIfValidForCurrentMachine: false,
+ });
+
return {
source: 'cli',
- value: commandLine[cliFlag] as Concurrency,
+ value,
};
}