Skip to content

🎥 Make videos programmatically with React

Migrate --port, --props, --config, --browser to options system

JonnyBurger69652cb3258f
diff --git a/packages/cli/src/config/preview-server.ts b/packages/cli/src/config/preview-server.ts
index dcced81201..6b0c42e00b 100644
--- a/packages/cli/src/config/preview-server.ts
+++ b/packages/cli/src/config/preview-server.ts
@@ -1,5 +1,8 @@
+import {BrowserSafeApis} from '@remotion/renderer/client';
import {parsedCli} from '../parsed-cli';
+const {portOption} = BrowserSafeApis.options;
+
let studioPort: number | undefined;
let rendererPort: number | undefined;
@@ -53,5 +56,7 @@ export const getRendererPortFromConfigFile = () => {
};
export const getRendererPortFromConfigFileAndCliFlag = (): number | null => {
- return parsedCli.port ?? rendererPort ?? null;
+ return (
+ portOption.getValue({commandLine: parsedCli}).value ?? rendererPort ?? null
+ );
};
diff --git a/packages/cli/src/get-config-file-name.ts b/packages/cli/src/get-config-file-name.ts
index d95eb05f8f..789fc6640a 100644
--- a/packages/cli/src/get-config-file-name.ts
+++ b/packages/cli/src/get-config-file-name.ts
@@ -1,28 +1,28 @@
+import {BrowserSafeApis} from '@remotion/renderer/client';
import {existsSync} from 'node:fs';
import path from 'node:path';
import {loadConfigFile} from './load-config';
import {Log} from './log';
import {parsedCli} from './parsed-cli';
+const {configOption} = BrowserSafeApis.options;
+
const defaultConfigFileJavascript = 'remotion.config.js';
const defaultConfigFileTypescript = 'remotion.config.ts';
export const loadConfig = (remotionRoot: string): Promise<string | null> => {
- if (parsedCli.config) {
- const fullPath = path.resolve(process.cwd(), parsedCli.config);
+ const configFile = configOption.getValue({commandLine: parsedCli}).value;
+ if (configFile) {
+ const fullPath = path.resolve(process.cwd(), configFile);
if (!existsSync(fullPath)) {
Log.error(
{indent: false, logLevel: 'error'},
- `You specified a config file location of "${parsedCli.config}" but no file under ${fullPath} was found.`,
+ `You specified a config file location of "${configFile}" but no file under ${fullPath} was found.`,
);
process.exit(1);
}
- return loadConfigFile(
- remotionRoot,
- parsedCli.config,
- fullPath.endsWith('.js'),
- );
+ return loadConfigFile(remotionRoot, configFile, fullPath.endsWith('.js'));
}
if (remotionRoot === null) {
diff --git a/packages/cli/src/get-input-props.ts b/packages/cli/src/get-input-props.ts
index 2953eb51b1..0297e229be 100644
--- a/packages/cli/src/get-input-props.ts
+++ b/packages/cli/src/get-input-props.ts
@@ -1,19 +1,23 @@
import type {LogLevel, LogOptions} from '@remotion/renderer';
+import {BrowserSafeApis} from '@remotion/renderer/client';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import {Log} from './log';
import {parsedCli} from './parsed-cli';
+const {propsOption} = BrowserSafeApis.options;
+
export const getInputProps = (
onUpdate: ((newProps: Record<string, unknown>) => void) | null,
logLevel: LogLevel,
): Record<string, unknown> => {
- if (!parsedCli.props) {
+ const props = propsOption.getValue({commandLine: parsedCli}).value;
+ if (!props) {
return {};
}
- const jsonFile = path.resolve(process.cwd(), parsedCli.props);
+ const jsonFile = path.resolve(process.cwd(), props);
try {
if (fs.existsSync(jsonFile)) {
const rawJsonData = fs.readFileSync(jsonFile, 'utf-8');
@@ -38,18 +42,14 @@ export const getInputProps = (
return JSON.parse(rawJsonData);
}
- return JSON.parse(parsedCli.props);
+ return JSON.parse(props);
} catch {
Log.error(
{indent: false, logLevel},
'You passed --props but it was neither valid JSON nor a file path to a valid JSON file. Provided value: ' +
- parsedCli.props,
- );
- Log.info(
- {indent: false, logLevel},
- 'Got the following value:',
- parsedCli.props,
+ props,
);
+ Log.info({indent: false, logLevel}, 'Got the following value:', props);
Log.error(
{indent: false, logLevel},
'Check that your input is parseable using `JSON.parse` and try again.',
diff --git a/packages/cli/src/parsed-cli.ts b/packages/cli/src/parsed-cli.ts
index c78f8a1f1a..7d3b6ca313 100644
--- a/packages/cli/src/parsed-cli.ts
+++ b/packages/cli/src/parsed-cli.ts
@@ -68,6 +68,10 @@ const {
forSeamlessAacConcatenationOption,
isProductionOption,
noOpenOption,
+ portOption,
+ propsOption,
+ configOption,
+ browserOption,
} = BrowserSafeApis.options;
export type CommandLineOptions = {
@@ -104,7 +108,7 @@ export type CommandLineOptions = {
[videoCodecOption.cliFlag]: TypeOfOption<typeof videoCodecOption>;
[concurrencyOption.cliFlag]: TypeOfOption<typeof concurrencyOption>;
timeout: number;
- config: string;
+ [configOption.cliFlag]: TypeOfOption<typeof configOption>;
['public-dir']: string;
[audioBitrateOption.cliFlag]: TypeOfOption<typeof audioBitrateOption>;
[videoBitrateOption.cliFlag]: TypeOfOption<typeof videoBitrateOption>;
@@ -119,7 +123,7 @@ export type CommandLineOptions = {
output: string | undefined;
[overwriteOption.cliFlag]: TypeOfOption<typeof overwriteOption>;
png: boolean;
- props: string;
+ [propsOption.cliFlag]: TypeOfOption<typeof propsOption>;
quality: number;
[jpegQualityOption.cliFlag]: TypeOfOption<typeof jpegQualityOption>;
frames: string | number;
@@ -129,7 +133,7 @@ export type CommandLineOptions = {
q: boolean;
[logLevelOption.cliFlag]: TypeOfOption<typeof logLevelOption>;
help: boolean;
- port: number;
+ [portOption.cliFlag]: TypeOfOption<typeof portOption>;
[stillFrameOption.cliFlag]: TypeOfOption<typeof stillFrameOption>;
[headlessOption.cliFlag]: TypeOfOption<typeof headlessOption>;
[keyboardShortcutsOption.cliFlag]: TypeOfOption<
@@ -150,7 +154,7 @@ export type CommandLineOptions = {
[packageManagerOption.cliFlag]: TypeOfOption<typeof packageManagerOption>;
[webpackPollOption.cliFlag]: TypeOfOption<typeof webpackPollOption>;
[noOpenOption.cliFlag]: TypeOfOption<typeof noOpenOption>;
- ['browser']: string;
+ [browserOption.cliFlag]: TypeOfOption<typeof browserOption>;
['browser-args']: string;
[userAgentOption.cliFlag]: TypeOfOption<typeof userAgentOption>;
[outDirOption.cliFlag]: TypeOfOption<typeof outDirOption>;
diff --git a/packages/cli/src/studio.ts b/packages/cli/src/studio.ts
index 69d2b33769..b658b9cd8b 100644
--- a/packages/cli/src/studio.ts
+++ b/packages/cli/src/studio.ts
@@ -17,19 +17,6 @@ import {
removeJob,
} from './render-queue/queue';
-const getPort = () => {
- if (parsedCli.port) {
- return parsedCli.port;
- }
-
- const serverPort = ConfigInternals.getStudioPort();
- if (serverPort) {
- return serverPort;
- }
-
- return null;
-};
-
const {
binariesDirectoryOption,
publicDirOption,
@@ -44,6 +31,8 @@ const {
ipv4Option,
webpackPollOption,
noOpenOption,
+ portOption,
+ browserOption,
} = BrowserSafeApis.options;
export const studioCommand = async (
@@ -79,7 +68,10 @@ export const studioCommand = async (
process.exit(1);
}
- const desiredPort = getPort();
+ const desiredPort =
+ portOption.getValue({commandLine: parsedCli}).value ??
+ ConfigInternals.getStudioPort() ??
+ null;
const fullEntryPath = convertEntryPointToServeUrl(file);
@@ -147,7 +139,7 @@ export const studioCommand = async (
const result = await StudioServerInternals.startStudio({
previewEntry: require.resolve('@remotion/studio/previewEntry'),
browserArgs: parsedCli['browser-args'],
- browserFlag: parsedCli.browser,
+ browserFlag: browserOption.getValue({commandLine: parsedCli}).value ?? '',
logLevel,
shouldOpenBrowser: !noOpenOption.getValue({commandLine: parsedCli}).value,
fullEntryPath,
diff --git a/packages/docs/docs/cli/bundle.mdx b/packages/docs/docs/cli/bundle.mdx
index 9693cf2d54..7380185a8d 100644
--- a/packages/docs/docs/cli/bundle.mdx
+++ b/packages/docs/docs/cli/bundle.mdx
@@ -20,7 +20,7 @@ You may pass a [Serve URL](/docs/terminology/serve-url) or an [entry point](/doc
### `--config`
-Specify a location for the Remotion config file.
+<Options id="config" />
### `--log`
diff --git a/packages/docs/docs/cli/compositions.mdx b/packages/docs/docs/cli/compositions.mdx
index fe2a9d6d5d..cc37695aba 100644
--- a/packages/docs/docs/cli/compositions.mdx
+++ b/packages/docs/docs/cli/compositions.mdx
@@ -19,10 +19,7 @@ You may pass a [Serve URL](/docs/terminology/serve-url) or an [entry point](/doc
### `--props`
-[Input Props to pass to the selected composition of your video.](/docs/passing-props#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`).
-From the root component the props can be read using [`getInputProps()`](/docs/get-input-props).
-You may transform input props using [`calculateMetadata()`](/docs/calculate-metadata).
+<Options id="props" />
:::note
Inline JSON string isn't supported on Windows shells because it removes the `"` character, use a file name instead.
@@ -30,7 +27,7 @@ Inline JSON string isn't supported on Windows shells because it removes the `"`
### `--config`
-Specify a location for the Remotion config file.
+<Options id="config" />
### `--env-file`<AvailableFrom v="2.2.0" />
@@ -50,7 +47,7 @@ If you don't feel like passing command line flags every time, consider creating
### `--port`
-[Set a custom HTTP server port to host the Webpack bundle](/docs/config#setport). If not defined, Remotion will try to find a free port.
+<Options id="port" />
### `--public-dir`<AvailableFrom v="3.2.13" />
diff --git a/packages/docs/docs/cli/render.mdx b/packages/docs/docs/cli/render.mdx
index 03ce7785b0..3cc4bb45da 100644
--- a/packages/docs/docs/cli/render.mdx
+++ b/packages/docs/docs/cli/render.mdx
@@ -22,10 +22,7 @@ Besides choosing a video and output location with the command line arguments, th
### `--props`
-[Input Props to pass to the selected composition of your video.](/docs/passing-props#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`).
-From the root component the props can be read using [`getInputProps()`](/docs/get-input-props).
-You may transform input props using [`calculateMetadata()`](/docs/calculate-metadata).
+<Options id="props" />
:::note
Inline JSON string isn't supported on Windows shells because it removes the `"` character, use a file name instead.
@@ -65,7 +62,7 @@ Inline JSON string isn't supported on Windows shells because it removes the `"`
### `--config`<AvailableFrom v="1.2.0" />
-Specify a location for the Remotion config file.
+<Options id="config" />
### `--env-file`<AvailableFrom v="2.2.0" />
@@ -187,7 +184,7 @@ Disallows the renderer from doing rendering frames and encoding at the same time
### `--port`
-[Set a custom HTTP server port that will be used to host the Webpack bundle](/docs/config#setrendererport). If not defined, Remotion will try to find a free port.
+<Options id="port" />
### `--public-dir`<AvailableFrom v="3.2.13" />
diff --git a/packages/docs/docs/cli/still.mdx b/packages/docs/docs/cli/still.mdx
index b745899b20..bde769f5f4 100644
--- a/packages/docs/docs/cli/still.mdx
+++ b/packages/docs/docs/cli/still.mdx
@@ -22,10 +22,7 @@ If `composition-id` is also not passed, Remotion will let you select a compositi
### `--props`
-[Input Props to pass to the selected composition of your video.](/docs/passing-props#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`).
-From the root component the props can be read using [`getInputProps()`](/docs/get-input-props).
-You may transform input props using [`calculateMetadata()`](/docs/calculate-metadata).
+<Options id="props" />
:::note
Inline JSON string isn't supported on Windows shells because it removes the `"` character, use a file name instead.
@@ -37,7 +34,7 @@ Inline JSON string isn't supported on Windows shells because it removes the `"`
### `--config`
-Specify a location for the Remotion config file.
+<Options id="config" />
### `--env-file`
@@ -81,7 +78,7 @@ Sets the output file path, as an alternative to the `output-location` positional
### `--port`
-[Set a custom HTTP server port to serve the Webpack bundle](/docs/config#setport). If not defined, Remotion will try to find a free port.
+<Options id="port" />
### `--public-dir`<AvailableFrom v="3.2.13" />
diff --git a/packages/docs/docs/cli/studio.mdx b/packages/docs/docs/cli/studio.mdx
index 82a0fc0dd8..c3e943c913 100644
--- a/packages/docs/docs/cli/studio.mdx
+++ b/packages/docs/docs/cli/studio.mdx
@@ -19,12 +19,7 @@ You may pass an [entry point](/docs/terminology/entry-point) as an argument, oth
### `--props`
-[Input Props to pass to the selected composition of your video.](/docs/passing-props#passing-input-props-in-the-cli).
-We don't recommend passing this flag when using the Studio - use [`defaultProps`](/docs/composition#defaultprops) instead.
-
-Must be a serialized JSON string (`--props='{"hello": "world"}'`) or a path to a JSON file (`./path/to/props.json`).
-From the root component the props can be read using [`getInputProps()`](/docs/get-input-props).
-You may transform input props using [`calculateMetadata()`](/docs/calculate-metadata).
+<Options id="props" />
:::note
Inline JSON string isn't supported on Windows shells because it removes the `"` character, use a file name instead.
@@ -32,7 +27,7 @@ Inline JSON string isn't supported on Windows shells because it removes the `"`
### `--config`<AvailableFrom v="1.2.0" />
-Specify a location for the Remotion config file.
+<Options id="config" />
### `--env-file`<AvailableFrom v="2.2.0" />
@@ -44,7 +39,7 @@ Specify a location for the Remotion config file.
### `--port`
-[Set a custom HTTP server port to start the server on](/docs/config#setstudioport). If not defined, Remotion will try to find a free port.
+<Options id="port" />
### `--public-dir`<AvailableFrom v="3.2.13" />
@@ -68,11 +63,7 @@ Specify a location for the Remotion config file.
### `--browser`<AvailableFrom v="3.3.79" />
-Specify the browser which should be used for opening tab - using the default browser by default.
-Pass an absolute string or `"chrome"` to use Chrome.
-If Chrome is selected as the browser and you are on macOS, Remotion will try to reuse an existing tab
-
-For backwards compatibility, the `BROWSER` environment variable is also supported.
+<Options id="browser" />
### `--browser-args`<AvailableFrom v="3.3.79" />
diff --git a/packages/docs/docs/cloudrun/cli/render.mdx b/packages/docs/docs/cloudrun/cli/render.mdx
index b769e5d631..c0f83e4ea8 100644
--- a/packages/docs/docs/cloudrun/cli/render.mdx
+++ b/packages/docs/docs/cloudrun/cli/render.mdx
@@ -53,10 +53,7 @@ The [GCP region](/docs/cloudrun/region-selection) to select. For lowest latency,
### `--props`
-[Input Props to pass to the selected composition of your video.](/docs/passing-props#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`).
-From the root component the props can be read using [`getInputProps()`](/docs/get-input-props).
-You may transform input props using [`calculateMetadata()`](/docs/calculate-metadata).
+<Options id="props" />
:::note
Inline JSON string isn't supported on Windows shells because it removes the `"` character, use a file name instead.
diff --git a/packages/docs/docs/cloudrun/cli/still.mdx b/packages/docs/docs/cloudrun/cli/still.mdx
index e394caf649..1424011303 100644
--- a/packages/docs/docs/cloudrun/cli/still.mdx
+++ b/packages/docs/docs/cloudrun/cli/still.mdx
@@ -53,10 +53,7 @@ The [GCP region](/docs/cloudrun/region-selection) to select. For lowest latency,
### `--props`
-[Input Props to pass to the selected composition of your video.](/docs/passing-props#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`).
-From the root component the props can be read using [`getInputProps()`](/docs/get-input-props).
-You may transform input props using [`calculateMetadata()`](/docs/calculate-metadata).
+<Options id="props" />
:::note
Inline JSON string isn't supported on Windows shells because it removes the `"` character, use a file name instead.
diff --git a/packages/docs/docs/config.mdx b/packages/docs/docs/config.mdx
index ce493f274c..2c05c27e0e 100644
--- a/packages/docs/docs/config.mdx
+++ b/packages/docs/docs/config.mdx
@@ -980,6 +980,18 @@ Config.setPublicLicenseKey('your-license-key');
The [command line flag](/docs/cli/studio#--public-license-key) `--public-license-key` will take precedence over this option.
+## `setImageSequencePattern()`
+
+<Options id="image-sequence-pattern" />
+
+```ts twoslash title="remotion.config.ts"
+import {Config} from '@remotion/cli/config';
+// ---cut---
+Config.setImageSequencePattern('frame_[frame]_custom.[ext]');
+```
+
+The [command line flag](/docs/cli/render#--image-sequence-pattern) `--image-sequence-pattern` will take precedence over this option.
+
## ~~`setQuality()`~~
Renamed to `setJpegQuality` in `v4.0.0`.
@@ -1094,18 +1106,6 @@ Config.overrideWebpackConfig(async (currentConfiguration) => {
});
```
-### `setImageSequencePattern()`
-
-<Options id="image-sequence-pattern" />
-
-```ts twoslash title="remotion.config.ts"
-import {Config} from '@remotion/cli/config';
-// ---cut---
-Config.setImageSequencePattern('frame_[frame]_custom.[ext]');
-```
-
-The [command line flag](/docs/cli/render#--image-sequence-pattern) `--image-sequence-pattern` will take precedence over this option.
-
## Old config file format
In v3.3.39, a new config file format was introduced which flattens the options so they can more easily be discovered using TypeScript autocompletion.
diff --git a/packages/docs/docs/lambda/cli/compositions.mdx b/packages/docs/docs/lambda/cli/compositions.mdx
index 0faefd6194..4290f50b74 100644
--- a/packages/docs/docs/lambda/cli/compositions.mdx
+++ b/packages/docs/docs/lambda/cli/compositions.mdx
@@ -66,10 +66,7 @@ You should use `npx remotion lambda compositions` if you cannot use [`npx remoti
### `--props`
-[Input Props to pass to the selected composition of your video.](/docs/passing-props#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`).
-From the root component the props can be read using [`getInputProps()`](/docs/get-input-props).
-You may transform input props using [`calculateMetadata()`](/docs/calculate-metadata).
+<Options id="props" />
:::note
Inline JSON string isn't supported on Windows shells because it removes the `"` character, use a file name instead.
@@ -77,7 +74,7 @@ Inline JSON string isn't supported on Windows shells because it removes the `"`
### `--config`
-Specify a location for the Remotion config file.
+<Options id="config" />
### `--env-file`
diff --git a/packages/docs/docs/lambda/cli/render.mdx b/packages/docs/docs/lambda/cli/render.mdx
index 987ef42845..9331f5f380 100644
--- a/packages/docs/docs/lambda/cli/render.mdx
+++ b/packages/docs/docs/lambda/cli/render.mdx
@@ -79,10 +79,7 @@ The [AWS region](/docs/lambda/region-selection) to select. Both project and func
### `--props`
-[Input Props to pass to the selected composition of your video.](/docs/passing-props#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`).
-From the root component the props can be read using [`getInputProps()`](/docs/get-input-props).
-You may transform input props using [`calculateMetadata()`](/docs/calculate-metadata).
+<Options id="props" />
:::note
Inline JSON string isn't supported on Windows shells because it removes the `"` character, use a file name instead.
diff --git a/packages/docs/docs/lambda/cli/still.mdx b/packages/docs/docs/lambda/cli/still.mdx
index 67bfe43a05..52d8ce834b 100644
--- a/packages/docs/docs/lambda/cli/still.mdx
+++ b/packages/docs/docs/lambda/cli/still.mdx
@@ -61,10 +61,7 @@ The [AWS region](/docs/lambda/region-selection) to select. Both project and func
### `--props`
-[Input Props to pass to the selected composition of your video.](/docs/passing-props#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`).
-From the root component the props can be read using [`getInputProps()`](/docs/get-input-props).
-You may transform input props using [`calculateMetadata()`](/docs/calculate-metadata).
+<Options id="props" />
:::note
Inline JSON string isn't supported on Windows shells because it removes the `"` character, use a file name instead.
diff --git a/packages/renderer/src/options/browser.tsx b/packages/renderer/src/options/browser.tsx
new file mode 100644
index 0000000000..2ebdefa20a
--- /dev/null
+++ b/packages/renderer/src/options/browser.tsx
@@ -0,0 +1,39 @@
+import type {AnyRemotionOption} from './option';
+
+const cliFlag = 'browser' as const;
+
+export const browserOption = {
+ name: 'Browser',
+ cliFlag,
+ description: () => (
+ <>
+ Specify the browser which should be used for opening a tab. The
+ default browser will be used by default. Pass an absolute path or{' '}
+ <code>&quot;chrome&quot;</code> to use Chrome. If Chrome is selected as
+ the browser and you are on macOS, Remotion will try to reuse an
+ existing tab.
+ </>
+ ),
+ ssrName: null,
+ docLink: 'https://www.remotion.dev/docs/cli/studio#--browser',
+ getValue: ({commandLine}) => {
+ if (commandLine[cliFlag] !== undefined) {
+ return {
+ source: 'cli',
+ value: commandLine[cliFlag] as string,
+ };
+ }
+
+ return {
+ source: 'default',
+ value: null,
+ };
+ },
+ setConfig: () => {
+ throw new Error(
+ 'setBrowser is not supported. Pass --browser via the CLI instead.',
+ );
+ },
+ type: '' as string | null,
+ id: cliFlag,
+} satisfies AnyRemotionOption<string | null>;
diff --git a/packages/renderer/src/options/config.tsx b/packages/renderer/src/options/config.tsx
new file mode 100644
index 0000000000..178041a958
--- /dev/null
+++ b/packages/renderer/src/options/config.tsx
@@ -0,0 +1,31 @@
+import type {AnyRemotionOption} from './option';
+
+const cliFlag = 'config' as const;
+
+export const configOption = {
+ name: 'Config file',
+ cliFlag,
+ description: () => <>Specify a location for the Remotion config file.</>,
+ ssrName: null,
+ docLink: 'https://www.remotion.dev/docs/config',
+ getValue: ({commandLine}) => {
+ if (commandLine[cliFlag] !== undefined) {
+ return {
+ source: 'cli',
+ value: commandLine[cliFlag] as string,
+ };
+ }
+
+ return {
+ source: 'default',
+ value: null,
+ };
+ },
+ setConfig: () => {
+ throw new Error(
+ 'setConfig is not supported. Pass --config via the CLI instead.',
+ );
+ },
+ type: '' as string | null,
+ id: cliFlag,
+} satisfies AnyRemotionOption<string | null>;
diff --git a/packages/renderer/src/options/index.tsx b/packages/renderer/src/options/index.tsx
index 4697db766c..a1b96f2e70 100644
--- a/packages/renderer/src/options/index.tsx
+++ b/packages/renderer/src/options/index.tsx
@@ -4,11 +4,13 @@ import {audioBitrateOption} from './audio-bitrate';
import {audioCodecOption} from './audio-codec';
import {beepOnFinishOption} from './beep-on-finish';
import {binariesDirectoryOption} from './binaries-directory';
+import {browserOption} from './browser';
import {browserExecutableOption} from './browser-executable';
import {bundleCacheOption} from './bundle-cache';
import {chromeModeOption} from './chrome-mode';
import {colorSpaceOption} from './color-space';
import {concurrencyOption} from './concurrency';
+import {configOption} from './config';
import {crfOption} from './crf';
import {enableCrossSiteIsolationOption} from './cross-site-isolation';
import {darkModeOption} from './dark-mode';
@@ -57,6 +59,8 @@ import {overrideWidthOption} from './override-width';
import {overwriteOption} from './overwrite';
import {packageManagerOption} from './package-manager';
import {pixelFormatOption} from './pixel-format';
+import {portOption} from './port';
+import {propsOption} from './props';
import {preferLosslessAudioOption} from './prefer-lossless';
import {proResProfileOption} from './prores-profile';
import {publicDirOption} from './public-dir';
@@ -161,6 +165,10 @@ export const allOptions = {
versionFlagOption,
bundleCacheOption,
envFileOption,
+ portOption,
+ propsOption,
+ configOption,
+ browserOption,
};
export type AvailableOptions = keyof typeof allOptions;
diff --git a/packages/renderer/src/options/port.tsx b/packages/renderer/src/options/port.tsx
new file mode 100644
index 0000000000..7da52ec939
--- /dev/null
+++ b/packages/renderer/src/options/port.tsx
@@ -0,0 +1,43 @@
+import type {AnyRemotionOption} from './option';
+
+const cliFlag = 'port' as const;
+
+let currentPort: number | null = null;
+
+export const portOption = {
+ name: 'Port',
+ cliFlag,
+ description: () => (
+ <>
+ Set a custom HTTP server port for the Studio or the render process. If
+ not defined, Remotion will try to find a free port.
+ </>
+ ),
+ ssrName: null,
+ docLink: 'https://www.remotion.dev/docs/config#setstudioport',
+ getValue: ({commandLine}) => {
+ if (commandLine[cliFlag] !== undefined) {
+ return {
+ source: 'cli',
+ value: commandLine[cliFlag] as number,
+ };
+ }
+
+ if (currentPort !== null) {
+ return {
+ source: 'config',
+ value: currentPort,
+ };
+ }
+
+ return {
+ source: 'default',
+ value: null,
+ };
+ },
+ setConfig: (value: number | null) => {
+ currentPort = value;
+ },
+ type: 0 as number | null,
+ id: cliFlag,
+} satisfies AnyRemotionOption<number | null>;
diff --git a/packages/renderer/src/options/props.tsx b/packages/renderer/src/options/props.tsx
new file mode 100644
index 0000000000..0a624934b5
--- /dev/null
+++ b/packages/renderer/src/options/props.tsx
@@ -0,0 +1,38 @@
+import type {AnyRemotionOption} from './option';
+
+const cliFlag = 'props' as const;
+
+export const propsOption = {
+ name: 'Input Props',
+ cliFlag,
+ description: () => (
+ <>
+ Input Props to pass to the selected composition of your video. Must be
+ a serialized JSON string (<code>--props=&apos;{'{'}&#34;hello&#34;:
+ &#34;world&#34;{'}'}&#39;</code>) or a path to a JSON file (
+ <code>./path/to/props.json</code>).
+ </>
+ ),
+ ssrName: null,
+ docLink: 'https://www.remotion.dev/docs/passing-props#passing-input-props-in-the-cli',
+ getValue: ({commandLine}) => {
+ if (commandLine[cliFlag] !== undefined) {
+ return {
+ source: 'cli',
+ value: commandLine[cliFlag] as string,
+ };
+ }
+
+ return {
+ source: 'default',
+ value: null,
+ };
+ },
+ setConfig: () => {
+ throw new Error(
+ 'setProps is not supported. Pass --props via the CLI instead.',
+ );
+ },
+ type: '' as string | null,
+ id: cliFlag,
+} satisfies AnyRemotionOption<string | null>;