Skip to content

🎥 Make videos programmatically with React

Migrate frame, sequence, scale, overwrite, crf, log, version, codec, bundle-cache, env-file to RemotionOption pattern

Jonny Burger17748e09ff4f
diff --git a/packages/cli/src/config/index.ts b/packages/cli/src/config/index.ts
index b32ef9bf30..94f52a1b26 100644
--- a/packages/cli/src/config/index.ts
+++ b/packages/cli/src/config/index.ts
@@ -38,20 +38,17 @@ import {
} from './buffer-state-delay-in-milliseconds';
import type {Concurrency} from './concurrency';
import {getEntryPoint, setEntryPoint} from './entry-point';
-import {setDotEnvLocation} from './env-file';
import {
getFfmpegOverrideFunction,
setFfmpegOverrideFunction,
} from './ffmpeg-override';
import {setFrameRange} from './frame-range';
-import {setImageSequence} from './image-sequence';
import {getMetadata, setMetadata} from './metadata';
import {getShouldOpenBrowser, setShouldOpenBrowser} from './open-browser';
import {setOutputLocation} from './output-location';
import type {WebpackOverrideFn} from './override-webpack';
import {overrideWebpackConfig} from './override-webpack';
import {setPort, setRendererPort, setStudioPort} from './preview-server';
-import {setWebpackCaching} from './webpack-caching';
import {getWebpackPolling} from './webpack-poll';
export type {Concurrency, WebpackConfiguration, WebpackOverrideFn};
@@ -118,6 +115,9 @@ const {
overrideDurationOption,
outDirOption,
webpackPollOption,
+ imageSequenceOption,
+ bundleCacheOption,
+ envFileOption,
} = BrowserSafeApis.options;
declare global {
@@ -661,7 +661,7 @@ export const Config: FlatConfig = {
setShouldOpenBrowser,
setBufferStateDelayInMilliseconds,
overrideWebpackConfig,
- setCachingEnabled: setWebpackCaching,
+ setCachingEnabled: bundleCacheOption.setConfig,
setPort,
setStudioPort,
setRendererPort,
@@ -677,7 +677,7 @@ export const Config: FlatConfig = {
setChromiumHeadlessMode: headlessOption.setConfig,
setChromiumOpenGlRenderer: glOption.setConfig,
setChromiumUserAgent: userAgentOption.setConfig,
- setDotEnvLocation,
+ setDotEnvLocation: envFileOption.setConfig,
setConcurrency: concurrencyOption.setConfig,
setChromiumMultiProcessOnLinux: enableMultiprocessOnLinuxOption.setConfig,
setChromiumDarkMode: darkModeOption.setConfig,
@@ -709,7 +709,7 @@ export const Config: FlatConfig = {
setPixelFormat: pixelFormatOption.setConfig,
setCodec: videoCodecOption.setConfig,
setCrf: crfOption.setConfig,
- setImageSequence,
+ setImageSequence: imageSequenceOption.setConfig,
setProResProfile: proResProfileOption.setConfig,
setX264Preset: x264Option.setConfig,
setAudioBitrate: audioBitrateOption.setConfig,
diff --git a/packages/cli/src/get-cli-options.ts b/packages/cli/src/get-cli-options.ts
index 4109df4343..1802190d20 100644
--- a/packages/cli/src/get-cli-options.ts
+++ b/packages/cli/src/get-cli-options.ts
@@ -56,9 +56,12 @@ export const getCliOptions = (options: {
}) => {
const frameRange = getAndValidateFrameRange(options.logLevel, false);
+ const imageSequence = BrowserSafeApis.options.imageSequenceOption.getValue({
+ commandLine: parsedCli,
+ }).value;
const shouldOutputImageSequence = options.isStill
? true
- : ConfigInternals.getShouldOutputImageSequence(frameRange);
+ : imageSequence || typeof frameRange === 'number';
const concurrency = BrowserSafeApis.options.concurrencyOption.getValue({
commandLine: parsedCli,
@@ -94,7 +97,9 @@ export const getCliOptions = (options: {
options.logLevel,
options.indent,
),
- stillFrame: ConfigInternals.getStillFrame(),
+ stillFrame: BrowserSafeApis.options.stillFrameOption.getValue({
+ commandLine: parsedCli,
+ }).value ?? 0,
ffmpegOverride: ConfigInternals.getFfmpegOverrideFunction(),
height,
width,
diff --git a/packages/cli/src/get-env.ts b/packages/cli/src/get-env.ts
index 23474036bb..a8bd8af6c7 100644
--- a/packages/cli/src/get-env.ts
+++ b/packages/cli/src/get-env.ts
@@ -1,15 +1,17 @@
import type {LogLevel} from '@remotion/renderer';
import {RenderInternals} from '@remotion/renderer';
+import {BrowserSafeApis} from '@remotion/renderer/client';
import {StudioServerInternals} from '@remotion/studio-server';
import dotenv from 'dotenv';
import fs, {readFileSync} from 'node:fs';
import path from 'node:path';
import {chalk} from './chalk';
-import {ConfigInternals} from './config';
import {makeHyperlink} from './hyperlinks/make-link';
import {Log} from './log';
import {parsedCli} from './parsed-cli';
+const {envFileOption} = BrowserSafeApis.options;
+
function getProcessEnv(): Record<string, string> {
const env: Record<string, string> = {};
@@ -141,8 +143,11 @@ export const getEnvironmentVariables = (
): Record<string, string> => {
const processEnv = getProcessEnv();
- if (parsedCli['env-file']) {
- const envFile = path.resolve(process.cwd(), parsedCli['env-file']);
+ const {value: envFileValue, source: envFileSource} = envFileOption.getValue({
+ commandLine: parsedCli,
+ });
+ if (envFileValue && envFileSource === 'cli') {
+ const envFile = path.resolve(process.cwd(), envFileValue);
if (!fs.existsSync(envFile)) {
Log.error(
{indent: false, logLevel},
@@ -165,7 +170,7 @@ export const getEnvironmentVariables = (
const remotionRoot = RenderInternals.findRemotionRoot();
- const configFileSetting = ConfigInternals.getDotEnvLocation();
+ const configFileSetting = envFileValue && envFileSource === 'config' ? envFileValue : null;
if (configFileSetting) {
const envFile = path.resolve(remotionRoot, configFileSetting);
if (!fs.existsSync(envFile)) {
diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts
index 7b01902904..dd110d3ef1 100644
--- a/packages/cli/src/index.ts
+++ b/packages/cli/src/index.ts
@@ -50,7 +50,7 @@ import {
versionsCommand,
} from './versions';
-const {packageManagerOption} = BrowserSafeApis.options;
+const {packageManagerOption, versionFlagOption} = BrowserSafeApis.options;
export const cli = async () => {
const [command, ...args] = parsedCli._;
@@ -119,7 +119,7 @@ export const cli = async () => {
await upgradeCommand({
remotionRoot,
packageManager: packageManager ?? undefined,
- version: parsedCli.version,
+ version: versionFlagOption.getValue({commandLine: parsedCli}).value ?? undefined,
logLevel,
args,
});
diff --git a/packages/cli/src/parse-command-line.ts b/packages/cli/src/parse-command-line.ts
index db40bf2de3..5e62cdd070 100644
--- a/packages/cli/src/parse-command-line.ts
+++ b/packages/cli/src/parse-command-line.ts
@@ -1,6 +1,5 @@
import type {
AudioCodec,
- Codec,
OpenGlRenderer,
StillImageFormat,
VideoImageFormat,
@@ -52,6 +51,16 @@ const {
keyboardShortcutsOption,
experimentalClientSideRenderingOption,
imageSequencePatternOption,
+ scaleOption,
+ overwriteOption,
+ crfOption,
+ logLevelOption,
+ videoCodecOption,
+ stillFrameOption,
+ imageSequenceOption,
+ versionFlagOption,
+ bundleCacheOption,
+ envFileOption,
} = BrowserSafeApis.options;
export type CommandLineOptions = {
@@ -62,8 +71,8 @@ export type CommandLineOptions = {
['image-format']: VideoImageFormat | StillImageFormat;
[proResProfileOption.cliFlag]: TypeOfOption<typeof proResProfileOption>;
[x264Option.cliFlag]: TypeOfOption<typeof x264Option>;
- ['bundle-cache']: string;
- ['env-file']: string;
+ [bundleCacheOption.cliFlag]: TypeOfOption<typeof bundleCacheOption>;
+ [envFileOption.cliFlag]: TypeOfOption<typeof envFileOption>;
[ignoreCertificateErrorsOption.cliFlag]: TypeOfOption<
typeof ignoreCertificateErrorsOption
>;
@@ -84,8 +93,8 @@ export type CommandLineOptions = {
typeof disallowParallelEncodingOption
>;
[beepOnFinishOption.cliFlag]: TypeOfOption<typeof beepOnFinishOption>;
- version: string;
- codec: Codec;
+ [versionFlagOption.cliFlag]: TypeOfOption<typeof versionFlagOption>;
+ [videoCodecOption.cliFlag]: TypeOfOption<typeof videoCodecOption>;
[concurrencyOption.cliFlag]: TypeOfOption<typeof concurrencyOption>;
timeout: number;
config: string;
@@ -98,23 +107,23 @@ export type CommandLineOptions = {
[encodingMaxRateOption.cliFlag]: TypeOfOption<typeof encodingMaxRateOption>;
[audioCodecOption.cliFlag]: AudioCodec;
[publicPathOption.cliFlag]: string;
- crf: number;
+ [crfOption.cliFlag]: TypeOfOption<typeof crfOption>;
force: boolean;
output: string | undefined;
- overwrite: boolean;
+ [overwriteOption.cliFlag]: TypeOfOption<typeof overwriteOption>;
png: boolean;
props: string;
quality: number;
[jpegQualityOption.cliFlag]: TypeOfOption<typeof jpegQualityOption>;
frames: string | number;
- scale: number;
- sequence: boolean;
+ [scaleOption.cliFlag]: TypeOfOption<typeof scaleOption>;
+ [imageSequenceOption.cliFlag]: TypeOfOption<typeof imageSequenceOption>;
quiet: boolean;
q: boolean;
- log: string;
+ [logLevelOption.cliFlag]: TypeOfOption<typeof logLevelOption>;
help: boolean;
port: number;
- frame: string | number;
+ [stillFrameOption.cliFlag]: TypeOfOption<typeof stillFrameOption>;
['disable-headless']: boolean;
[keyboardShortcutsOption.cliFlag]: TypeOfOption<
typeof keyboardShortcutsOption
@@ -155,28 +164,16 @@ export type CommandLineOptions = {
};
export const parseCommandLine = () => {
- if (typeof parsedCli['bundle-cache'] !== 'undefined') {
- Config.setCachingEnabled(parsedCli['bundle-cache'] !== 'false');
- }
-
if (parsedCli.frames) {
ConfigInternals.setFrameRangeFromCli(parsedCli.frames);
}
- if (parsedCli.frame) {
- ConfigInternals.setStillFrame(Number(parsedCli.frame));
- }
-
if (parsedCli.png) {
throw new Error(
'The --png flag has been removed. Use --sequence --image-format=png from now on.',
);
}
- if (parsedCli.sequence) {
- Config.setImageSequence(true);
- }
-
if (
parsedCli['license-key'] &&
parsedCli['license-key'].startsWith('rm_pub_')
diff --git a/packages/cli/src/parsed-cli.ts b/packages/cli/src/parsed-cli.ts
index 378ea316d2..7643b86738 100644
--- a/packages/cli/src/parsed-cli.ts
+++ b/packages/cli/src/parsed-cli.ts
@@ -3,9 +3,9 @@ import minimist from 'minimist';
import type {CommandLineOptions} from './parse-command-line';
export const BooleanFlags = [
- 'overwrite',
+ BrowserSafeApis.options.overwriteOption.cliFlag,
'force',
- 'sequence',
+ BrowserSafeApis.options.imageSequenceOption.cliFlag,
'help',
'quiet',
'q',
diff --git a/packages/cli/src/setup-cache.ts b/packages/cli/src/setup-cache.ts
index 781319f92d..7701c8383f 100644
--- a/packages/cli/src/setup-cache.ts
+++ b/packages/cli/src/setup-cache.ts
@@ -2,6 +2,7 @@ import type {MandatoryLegacyBundleOptions} from '@remotion/bundler';
import {BundlerInternals} from '@remotion/bundler';
import type {LogLevel} from '@remotion/renderer';
import {RenderInternals} from '@remotion/renderer';
+import {BrowserSafeApis} from '@remotion/renderer/client';
import type {BundlingState, CopyingState} from '@remotion/studio-server';
import type {GitSource} from '@remotion/studio-shared';
import {existsSync} from 'fs';
@@ -150,7 +151,9 @@ export const bundleOnCli = async ({
keyboardShortcutsEnabled: boolean;
askAIEnabled: boolean;
}) => {
- const shouldCache = ConfigInternals.getWebpackCaching();
+ const shouldCache = BrowserSafeApis.options.bundleCacheOption.getValue({
+ commandLine: {},
+ }).value;
const symlinkState: SymbolicLinksState = {
symlinks: [],
diff --git a/packages/cloudrun/src/cli/commands/sites/create.ts b/packages/cloudrun/src/cli/commands/sites/create.ts
index b47f751407..fbdfa6ca19 100644
--- a/packages/cloudrun/src/cli/commands/sites/create.ts
+++ b/packages/cloudrun/src/cli/commands/sites/create.ts
@@ -189,7 +189,9 @@ export const sitesCreateSubcommand = async (
};
updateProgress(false);
},
- enableCaching: ConfigInternals.getWebpackCaching(),
+ enableCaching: BrowserSafeApis.options.bundleCacheOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value,
webpackOverride: ConfigInternals.getWebpackOverrideFn() ?? ((f) => f),
gitSource,
bypassBucketNameValidation: true,
diff --git a/packages/docs/docs/cli/compositions.mdx b/packages/docs/docs/cli/compositions.mdx
index 44d97d94e1..fe2a9d6d5d 100644
--- a/packages/docs/docs/cli/compositions.mdx
+++ b/packages/docs/docs/cli/compositions.mdx
@@ -34,11 +34,11 @@ Specify a location for the Remotion config file.
### `--env-file`<AvailableFrom v="2.2.0" />
-Specify a location for a dotenv file - Default `.env`. [Read about how environment variables work in Remotion.](/docs/env-variables)
+<Options id="env-file" />
### `--bundle-cache`
-[Enable or disable Webpack caching](/docs/config#setcachingenabled). This flag is enabled by default, use `--bundle-cache=false` to disable caching.
+<Options id="bundle-cache" />
### `--log`
diff --git a/packages/docs/docs/cli/render.mdx b/packages/docs/docs/cli/render.mdx
index 3bf3a77db4..03ce7785b0 100644
--- a/packages/docs/docs/cli/render.mdx
+++ b/packages/docs/docs/cli/render.mdx
@@ -69,7 +69,7 @@ Specify a location for the Remotion config file.
### `--env-file`<AvailableFrom v="2.2.0" />
-Specify a location for a dotenv file. Default `.env`.
+<Options id="env-file" />
### `--jpeg-quality`<AvailableFrom v="4.0.0" />
@@ -89,7 +89,7 @@ Sets the output file path, as an alternative to the `output-location` positional
### `--sequence`<AvailableFrom v="1.4.0" />
-[Pass this flag if you want an image sequence as the output instead of a video.](/docs/config#setimagesequence)
+<Options id="sequence" />
### `--codec`<AvailableFrom v="1.4.0" />
@@ -179,7 +179,7 @@ Disallows the renderer from doing rendering frames and encoding at the same time
### `--bundle-cache`<AvailableFrom v="2.0.0" />
-[Enable or disable Webpack caching](/docs/config#setcachingenabled). This flag is enabled by default, use `--bundle-cache=false` to disable caching.
+<Options id="bundle-cache" />
### `--log`
diff --git a/packages/docs/docs/cli/still.mdx b/packages/docs/docs/cli/still.mdx
index 7d8504149d..b745899b20 100644
--- a/packages/docs/docs/cli/still.mdx
+++ b/packages/docs/docs/cli/still.mdx
@@ -41,7 +41,7 @@ Specify a location for the Remotion config file.
### `--env-file`
-Specify a location for a dotenv file - Default `.env`. [Read about how environment variables work in Remotion.](/docs/env-variables)
+<Options id="env-file" />
### `--jpeg-quality` <AvailableFrom v="4.0.0" />
@@ -69,12 +69,11 @@ Sets the output file path, as an alternative to the `output-location` positional
### `--frame`
-Which frame should be rendered. Example `--frame=10`. Default `0`.
-From v3.2.27, negative values are allowed, with `-1` being the last frame.
+<Options id="frame" />
### `--bundle-cache`
-[Enable or disable Webpack caching](/docs/config#setcachingenabled). This flag is enabled by default, use `--bundle-cache=false` to disable caching.
+<Options id="bundle-cache" />
### `--log`
diff --git a/packages/docs/docs/cli/studio.mdx b/packages/docs/docs/cli/studio.mdx
index ff45d58038..a6facfd0fc 100644
--- a/packages/docs/docs/cli/studio.mdx
+++ b/packages/docs/docs/cli/studio.mdx
@@ -36,7 +36,7 @@ Specify a location for the Remotion config file.
### `--env-file`<AvailableFrom v="2.2.0" />
-Specify a location for a dotenv file - Default `.env`. [Read about how environment variables work in Remotion.](/docs/env-variables)
+<Options id="env-file" />
### `--log`
diff --git a/packages/docs/docs/cli/upgrade.mdx b/packages/docs/docs/cli/upgrade.mdx
index 6cf8a9d5f8..71f30551d6 100644
--- a/packages/docs/docs/cli/upgrade.mdx
+++ b/packages/docs/docs/cli/upgrade.mdx
@@ -21,7 +21,7 @@ npx remotion upgrade
### `--version`<AvailableFrom v="4.0.15"/>
-Install a specific version. Also enables downgrading to an older version.
+<Options id="version" />
## Package manager support
diff --git a/packages/docs/docs/cloudrun/cli/render.mdx b/packages/docs/docs/cloudrun/cli/render.mdx
index 9265804c6a..b769e5d631 100644
--- a/packages/docs/docs/cloudrun/cli/render.mdx
+++ b/packages/docs/docs/cloudrun/cli/render.mdx
@@ -95,7 +95,7 @@ Before v4.0.76, this was "100%" by default. It is now aligned to the other serve
### `--env-file`
-Specify a location for a dotenv file - Default `.env`. [Read about how environment variables work in Remotion.](/docs/env-variables)
+<Options id="env-file" />
### `--out-name`
diff --git a/packages/docs/docs/cloudrun/cli/still.mdx b/packages/docs/docs/cloudrun/cli/still.mdx
index d7e14c66c9..e394caf649 100644
--- a/packages/docs/docs/cloudrun/cli/still.mdx
+++ b/packages/docs/docs/cloudrun/cli/still.mdx
@@ -87,7 +87,7 @@ Specify a specific bucket name to be used for the output. The resulting Google C
### `--env-file`
-Specify a location for a dotenv file - Default `.env`. [Read about how environment variables work in Remotion.](/docs/env-variables)
+<Options id="env-file" />
### `--out-name`
diff --git a/packages/docs/docs/config.mdx b/packages/docs/docs/config.mdx
index 455d712199..43a6eb1c8d 100644
--- a/packages/docs/docs/config.mdx
+++ b/packages/docs/docs/config.mdx
@@ -41,7 +41,7 @@ Config.overrideWebpackConfig((currentConfiguration) => {
## `setCachingEnabled()`<AvailableFrom v="2.0.0" />
-Enable or disable Webpack caching. Default is `true` which will make the Webpack step in the first run a bit slower but will massively speed up subsequent runs.
+<Options id="bundle-cache" />
```ts twoslash title="remotion.config.ts"
import {Config} from '@remotion/cli/config';
@@ -465,7 +465,7 @@ The [command line flag](/docs/cli/render#--jpeg-quality) `--jpeg-quality` will t
## `setDotEnvLocation()`
-Set a custom location for a [`.env`](https://www.npmjs.com/package/dotenv) file. You can specify an absolute path or a relative path in which case it gets resolved based on the current working directory.
+<Options id="env-file" />
```ts twoslash title="remotion.config.ts"
import {Config} from '@remotion/cli/config';
@@ -609,7 +609,7 @@ The [command line flag](/docs/cli/render#--x264-preset) `--x264-preset` will tak
## `setImageSequence()`<AvailableFrom v="1.4.0" />
-Set to true if you want to output an image sequence instead of a video.
+<Options id="sequence" />
```ts twoslash title="remotion.config.ts"
import {Config} from '@remotion/cli/config';
diff --git a/packages/docs/docs/lambda/cli.mdx b/packages/docs/docs/lambda/cli.mdx
index fd17b44262..4a7e5f08a3 100644
--- a/packages/docs/docs/lambda/cli.mdx
+++ b/packages/docs/docs/lambda/cli.mdx
@@ -43,4 +43,4 @@ Prints the minimal amount of logs.
### `--env-file`
-Specify a location for a dotenv file - Default `.env`. [Read about how environment variables work in Remotion.](/docs/env-variables)
+<Options id="env-file" />
diff --git a/packages/docs/docs/lambda/cli/compositions.mdx b/packages/docs/docs/lambda/cli/compositions.mdx
index 78e52866a4..0faefd6194 100644
--- a/packages/docs/docs/lambda/cli/compositions.mdx
+++ b/packages/docs/docs/lambda/cli/compositions.mdx
@@ -81,7 +81,7 @@ Specify a location for the Remotion config file.
### `--env-file`
-Specify a location for a dotenv file - Default `.env`. [Read about how environment variables work in Remotion.](/docs/env-variables)
+<Options id="env-file" />
### `--log`
diff --git a/packages/docs/docs/lambda/cli/render.mdx b/packages/docs/docs/lambda/cli/render.mdx
index 5f62577484..987ef42845 100644
--- a/packages/docs/docs/lambda/cli/render.mdx
+++ b/packages/docs/docs/lambda/cli/render.mdx
@@ -186,7 +186,7 @@ Renamed to `jpegQuality` in `v4.0.0`.
### `--env-file`
-Specify a location for a dotenv file - Default `.env`. [Read about how environment variables work in Remotion.](/docs/env-variables)
+<Options id="env-file" />
### `--frames`
diff --git a/packages/docs/docs/lambda/cli/still.mdx b/packages/docs/docs/lambda/cli/still.mdx
index 533e0f1c65..67bfe43a05 100644
--- a/packages/docs/docs/lambda/cli/still.mdx
+++ b/packages/docs/docs/lambda/cli/still.mdx
@@ -53,7 +53,7 @@ npx remotion lambda still testbed my-comp out.png
### `--frame`
-Render a specific frame of a composition. Default `0`
+<Options id="frame" />
### `--region`
diff --git a/packages/lambda/src/cli/commands/sites/create.ts b/packages/lambda/src/cli/commands/sites/create.ts
index 3f51415724..fb1ab93530 100644
--- a/packages/lambda/src/cli/commands/sites/create.ts
+++ b/packages/lambda/src/cli/commands/sites/create.ts
@@ -221,7 +221,9 @@ export const sitesCreateSubcommand = async (
};
updateProgress(false);
},
- enableCaching: ConfigInternals.getWebpackCaching(),
+ enableCaching: BrowserSafeApis.options.bundleCacheOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value,
webpackOverride: ConfigInternals.getWebpackOverrideFn() ?? ((f) => f),
bypassBucketNameValidation: Boolean(parsedLambdaCli['force-bucket-name']),
askAIEnabled,
diff --git a/packages/renderer/src/options/bundle-cache.tsx b/packages/renderer/src/options/bundle-cache.tsx
new file mode 100644
index 0000000000..575df3cbf6
--- /dev/null
+++ b/packages/renderer/src/options/bundle-cache.tsx
@@ -0,0 +1,36 @@
+import type {AnyRemotionOption} from './option';
+
+const cliFlag = 'bundle-cache' as const;
+
+let cachingEnabled = true;
+
+export const bundleCacheOption = {
+ name: 'Webpack Bundle Caching',
+ cliFlag,
+ description: () => (
+ <>
+ Enable or disable Webpack caching. This flag is enabled by default, use{' '}
+ <code>--bundle-cache=false</code> to disable caching.
+ </>
+ ),
+ ssrName: null,
+ docLink: 'https://www.remotion.dev/docs/config#setcachingenabled',
+ getValue: ({commandLine}) => {
+ if (commandLine[cliFlag] !== undefined) {
+ return {
+ source: 'cli',
+ value: commandLine[cliFlag] !== 'false',
+ };
+ }
+
+ return {
+ source: cachingEnabled ? 'default' : 'config',
+ value: cachingEnabled,
+ };
+ },
+ setConfig: (value: boolean) => {
+ cachingEnabled = value;
+ },
+ type: true as boolean,
+ id: cliFlag,
+} satisfies AnyRemotionOption<boolean>;
diff --git a/packages/renderer/src/options/env-file.tsx b/packages/renderer/src/options/env-file.tsx
new file mode 100644
index 0000000000..17c171af86
--- /dev/null
+++ b/packages/renderer/src/options/env-file.tsx
@@ -0,0 +1,42 @@
+import type {AnyRemotionOption} from './option';
+
+const cliFlag = 'env-file' as const;
+
+let envFileLocation: string | null = null;
+
+export const envFileOption = {
+ name: 'Env File',
+ cliFlag,
+ description: () => (
+ <>
+ Specify a location for a dotenv file. Default <code>.env</code>.
+ </>
+ ),
+ ssrName: null,
+ docLink: 'https://www.remotion.dev/docs/cli/render#--env-file',
+ getValue: ({commandLine}) => {
+ if (commandLine[cliFlag] !== undefined) {
+ return {
+ source: 'cli',
+ value: commandLine[cliFlag] as string,
+ };
+ }
+
+ if (envFileLocation !== null) {
+ return {
+ source: 'config',
+ value: envFileLocation,
+ };
+ }
+
+ return {
+ source: 'default',
+ value: null,
+ };
+ },
+ setConfig: (value: string | null) => {
+ envFileLocation = value;
+ },
+ type: '' as string | null,
+ id: cliFlag,
+} satisfies AnyRemotionOption<string | null>;
diff --git a/packages/renderer/src/options/image-sequence.tsx b/packages/renderer/src/options/image-sequence.tsx
new file mode 100644
index 0000000000..be10338ace
--- /dev/null
+++ b/packages/renderer/src/options/image-sequence.tsx
@@ -0,0 +1,40 @@
+import type {AnyRemotionOption} from './option';
+
+const cliFlag = 'sequence' as const;
+
+let imageSequence = false;
+
+export const imageSequenceOption = {
+ name: 'Image Sequence',
+ cliFlag,
+ description: () => (
+ <>
+ Pass this flag to output an image sequence instead of a video. The default
+ image format is JPEG. See{' '}
+ <a href="/docs/config#setimagesequence">
+ <code>setImageSequence()</code>
+ </a>{' '}
+ for more details.
+ </>
+ ),
+ ssrName: null,
+ docLink: 'https://www.remotion.dev/docs/config#setimagesequence',
+ getValue: ({commandLine}) => {
+ if (commandLine[cliFlag] !== undefined) {
+ return {
+ source: 'cli',
+ value: Boolean(commandLine[cliFlag]),
+ };
+ }
+
+ return {
+ source: imageSequence ? 'config' : 'default',
+ value: imageSequence,
+ };
+ },
+ setConfig: (value: boolean) => {
+ imageSequence = value;
+ },
+ type: false as boolean,
+ id: cliFlag,
+} satisfies AnyRemotionOption<boolean>;
diff --git a/packages/renderer/src/options/index.tsx b/packages/renderer/src/options/index.tsx
index 716bcb7faa..7174d4e30c 100644
--- a/packages/renderer/src/options/index.tsx
+++ b/packages/renderer/src/options/index.tsx
@@ -4,6 +4,7 @@ import {audioBitrateOption} from './audio-bitrate';
import {audioCodecOption} from './audio-codec';
import {beepOnFinishOption} from './beep-on-finish';
import {binariesDirectoryOption} from './binaries-directory';
+import {bundleCacheOption} from './bundle-cache';
import {browserExecutableOption} from './browser-executable';
import {chromeModeOption} from './chrome-mode';
import {colorSpaceOption} from './color-space';
@@ -16,6 +17,7 @@ import {disableGitSourceOption} from './disable-git-source';
import {disableWebSecurityOption} from './disable-web-security';
import {disallowParallelEncodingOption} from './disallow-parallel-encoding';
import {enableLambdaInsights} from './enable-lambda-insights';
+import {envFileOption} from './env-file';
import {enableMultiprocessOnLinuxOption} from './enable-multiprocess-on-linux';
import {encodingBufferSizeOption} from './encoding-buffer-size';
import {encodingMaxRateOption} from './encoding-max-rate';
@@ -27,6 +29,7 @@ import {forSeamlessAacConcatenationOption} from './for-seamless-aac-concatenatio
import {forceNewStudioOption} from './force-new-studio';
import {glOption} from './gl';
import {hardwareAccelerationOption} from './hardware-acceleration';
+import {imageSequenceOption} from './image-sequence';
import {headlessOption} from './headless';
import {ignoreCertificateErrorsOption} from './ignore-certificate-errors';
import {imageSequencePatternOption} from './image-sequence-pattern';
@@ -60,11 +63,13 @@ import {publicLicenseKeyOption} from './public-license-key';
import {publicPathOption} from './public-path';
import {reproOption} from './repro';
import {scaleOption} from './scale';
+import {stillFrameOption} from './still-frame';
import {separateAudioOption} from './separate-audio';
import {stillImageFormatOption} from './still-image-format';
import {throwIfSiteExistsOption} from './throw-if-site-exists';
import {delayRenderTimeoutInMillisecondsOption} from './timeout';
import {userAgentOption} from './user-agent';
+import {versionFlagOption} from './version-flag';
import {videoBitrateOption} from './video-bitrate';
import {mediaCacheSizeInBytesOption} from './video-cache-size';
import {videoCodecOption} from './video-codec';
@@ -147,6 +152,11 @@ export const allOptions = {
outDirOption,
packageManagerOption,
webpackPollOption,
+ stillFrameOption,
+ imageSequenceOption,
+ versionFlagOption,
+ bundleCacheOption,
+ envFileOption,
};
export type AvailableOptions = keyof typeof allOptions;
diff --git a/packages/renderer/src/options/still-frame.tsx b/packages/renderer/src/options/still-frame.tsx
new file mode 100644
index 0000000000..1e4b332c18
--- /dev/null
+++ b/packages/renderer/src/options/still-frame.tsx
@@ -0,0 +1,44 @@
+import type {AnyRemotionOption} from './option';
+
+const cliFlag = 'frame' as const;
+
+let currentFrame: number | null = null;
+
+export const stillFrameOption = {
+ name: 'Frame',
+ cliFlag,
+ description: () => (
+ <>
+ Which frame should be rendered when rendering a still. Default{' '}
+ <code>0</code>. From v3.2.27, negative values are allowed, with{' '}
+ <code>-1</code> being the last frame.
+ </>
+ ),
+ ssrName: 'frame' as const,
+ docLink: 'https://www.remotion.dev/docs/cli/still#--frame',
+ getValue: ({commandLine}) => {
+ if (commandLine[cliFlag] !== undefined) {
+ return {
+ source: 'cli',
+ value: Number(commandLine[cliFlag]),
+ };
+ }
+
+ if (currentFrame !== null) {
+ return {
+ source: 'config',
+ value: currentFrame,
+ };
+ }
+
+ return {
+ source: 'default',
+ value: null,
+ };
+ },
+ setConfig: (value: number | null) => {
+ currentFrame = value;
+ },
+ type: 0 as number | null,
+ id: cliFlag,
+} satisfies AnyRemotionOption<number | null>;
diff --git a/packages/renderer/src/options/version-flag.tsx b/packages/renderer/src/options/version-flag.tsx
new file mode 100644
index 0000000000..deb6d5bff9
--- /dev/null
+++ b/packages/renderer/src/options/version-flag.tsx
@@ -0,0 +1,31 @@
+import type {AnyRemotionOption} from './option';
+
+const cliFlag = 'version' as const;
+
+export const versionFlagOption = {
+ name: 'Version',
+ cliFlag,
+ description: () => (
+ <>Install a specific version. Also enables downgrading to an older version.</>
+ ),
+ ssrName: null,
+ docLink: 'https://www.remotion.dev/docs/cli/upgrade#--version',
+ getValue: ({commandLine}) => {
+ if (commandLine[cliFlag] !== undefined) {
+ return {
+ source: 'cli',
+ value: String(commandLine[cliFlag]),
+ };
+ }
+
+ return {
+ source: 'default',
+ value: null,
+ };
+ },
+ setConfig: () => {
+ throw new Error('Cannot set version via config file');
+ },
+ type: '' as string | null,
+ id: cliFlag,
+} satisfies AnyRemotionOption<string | null>;