Skip to content

🎥 Make videos programmatically with React

`@remotion/renderer`, `@remotion/cli`: Migrate `--user-agent`, `--disable-web-security`, `--ignore-certificate-errors` to options system

Jonny Burger742000b844a5
diff --git a/packages/cli/src/benchmark.ts b/packages/cli/src/benchmark.ts
index 044962d0c3..db7c313f29 100644
--- a/packages/cli/src/benchmark.ts
+++ b/packages/cli/src/benchmark.ts
@@ -64,6 +64,9 @@ const {
browserExecutableOption,
everyNthFrameOption,
proResProfileOption,
+ userAgentOption,
+ disableWebSecurityOption,
+ ignoreCertificateErrorsOption,
} = BrowserSafeApis.options;
const getValidConcurrency = (cliConcurrency: number | string | null) => {
@@ -209,9 +212,6 @@ export const benchmarkCommand = async (
height,
width,
concurrency: unparsedConcurrency,
- disableWebSecurity,
- userAgent,
- ignoreCertificateErrors,
} = getCliOptions({
isStill: false,
logLevel,
@@ -230,6 +230,13 @@ export const benchmarkCommand = async (
const proResProfile = proResProfileOption.getValue({
commandLine: parsedCli,
}).value;
+ const userAgent = userAgentOption.getValue({commandLine: parsedCli}).value;
+ const disableWebSecurity = disableWebSecurityOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+ const ignoreCertificateErrors = ignoreCertificateErrorsOption.getValue({
+ commandLine: parsedCli,
+ }).value;
Log.verbose(
{indent: false, logLevel},
diff --git a/packages/cli/src/compositions.ts b/packages/cli/src/compositions.ts
index 1ead340f8d..0f0deb39d8 100644
--- a/packages/cli/src/compositions.ts
+++ b/packages/cli/src/compositions.ts
@@ -30,6 +30,9 @@ const {
experimentalClientSideRenderingOption,
keyboardShortcutsOption,
browserExecutableOption,
+ userAgentOption,
+ disableWebSecurityOption,
+ ignoreCertificateErrorsOption,
} = BrowserSafeApis.options;
export const listCompositionsCommand = async (
@@ -68,13 +71,7 @@ export const listCompositionsCommand = async (
reason,
);
- const {
- envVariables,
- inputProps,
- ignoreCertificateErrors,
- userAgent,
- disableWebSecurity,
- } = getCliOptions({
+ const {envVariables, inputProps} = getCliOptions({
isStill: false,
logLevel,
indent: false,
@@ -83,6 +80,13 @@ export const listCompositionsCommand = async (
const browserExecutable = browserExecutableOption.getValue({
commandLine: parsedCli,
}).value;
+ const userAgent = userAgentOption.getValue({commandLine: parsedCli}).value;
+ const disableWebSecurity = disableWebSecurityOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+ const ignoreCertificateErrors = ignoreCertificateErrorsOption.getValue({
+ commandLine: parsedCli,
+ }).value;
const publicPath = publicPathOption.getValue({commandLine: parsedCli}).value;
const timeoutInMilliseconds = delayRenderTimeoutInMillisecondsOption.getValue(
{
diff --git a/packages/cli/src/config/index.ts b/packages/cli/src/config/index.ts
index 1b269b7810..567c32a727 100644
--- a/packages/cli/src/config/index.ts
+++ b/packages/cli/src/config/index.ts
@@ -1,8 +1,4 @@
import {getBrowser} from './browser';
-import {
- getChromiumDisableWebSecurity,
- getIgnoreCertificateErrors,
-} from './chromium-flags';
import {getConcurrency} from './concurrency';
import {getDotEnvLocation} from './env-file';
import {getRange, setFrameRangeFromCli} from './frame-range';
@@ -40,10 +36,6 @@ import {
getBufferStateDelayInMilliseconds,
setBufferStateDelayInMilliseconds,
} from './buffer-state-delay-in-milliseconds';
-import {
- setChromiumDisableWebSecurity,
- setChromiumIgnoreCertificateErrors,
-} from './chromium-flags';
import type {Concurrency} from './concurrency';
import {setConcurrency} from './concurrency';
import {getEntryPoint, setEntryPoint} from './entry-point';
@@ -61,7 +53,6 @@ import {setOutputLocation} from './output-location';
import type {WebpackOverrideFn} from './override-webpack';
import {overrideWebpackConfig} from './override-webpack';
import {setPort, setRendererPort, setStudioPort} from './preview-server';
-import {getChromiumUserAgent, setChromiumUserAgent} from './user-agent';
import {setWebpackCaching} from './webpack-caching';
import {
getWebpackPolling,
@@ -123,6 +114,9 @@ const {
proResProfileOption,
stillImageFormatOption,
videoImageFormatOption,
+ userAgentOption,
+ disableWebSecurityOption,
+ ignoreCertificateErrorsOption,
} = BrowserSafeApis.options;
declare global {
@@ -664,11 +658,11 @@ export const Config: FlatConfig = {
setTimeoutInMilliseconds: delayRenderTimeoutInMillisecondsOption.setConfig,
setDelayRenderTimeoutInMilliseconds:
delayRenderTimeoutInMillisecondsOption.setConfig,
- setChromiumDisableWebSecurity,
- setChromiumIgnoreCertificateErrors,
+ setChromiumDisableWebSecurity: disableWebSecurityOption.setConfig,
+ setChromiumIgnoreCertificateErrors: ignoreCertificateErrorsOption.setConfig,
setChromiumHeadlessMode: headlessOption.setConfig,
setChromiumOpenGlRenderer: glOption.setConfig,
- setChromiumUserAgent,
+ setChromiumUserAgent: userAgentOption.setConfig,
setDotEnvLocation,
setConcurrency,
setChromiumMultiProcessOnLinux: enableMultiprocessOnLinuxOption.setConfig,
@@ -740,8 +734,6 @@ export const ConfigInternals = {
getStudioPort,
getRendererPortFromConfigFile,
getRendererPortFromConfigFileAndCliFlag,
- getChromiumDisableWebSecurity,
- getIgnoreCertificateErrors,
getConcurrency,
getStillFrame,
getShouldOutputImageSequence,
@@ -760,7 +752,6 @@ export const ConfigInternals = {
getEntryPoint,
getWebpackPolling,
getShouldOpenBrowser,
- getChromiumUserAgent,
getBufferStateDelayInMilliseconds,
getOutputCodecOrUndefined: BrowserSafeApis.getOutputCodecOrUndefined,
};
diff --git a/packages/cli/src/get-cli-options.ts b/packages/cli/src/get-cli-options.ts
index 30049fa1a2..d37a614d58 100644
--- a/packages/cli/src/get-cli-options.ts
+++ b/packages/cli/src/get-cli-options.ts
@@ -58,10 +58,6 @@ export const getCliOptions = (options: {
? true
: ConfigInternals.getShouldOutputImageSequence(frameRange);
- const disableWebSecurity = ConfigInternals.getChromiumDisableWebSecurity();
- const ignoreCertificateErrors = ConfigInternals.getIgnoreCertificateErrors();
- const userAgent = ConfigInternals.getChromiumUserAgent();
-
const concurrency = ConfigInternals.getConcurrency();
const height = ConfigInternals.getHeight();
@@ -84,9 +80,6 @@ export const getCliOptions = (options: {
options.indent,
),
stillFrame: ConfigInternals.getStillFrame(),
- userAgent,
- disableWebSecurity,
- ignoreCertificateErrors,
ffmpegOverride: ConfigInternals.getFfmpegOverrideFunction(),
height,
width,
diff --git a/packages/cli/src/get-render-defaults.ts b/packages/cli/src/get-render-defaults.ts
index 992c240108..af0964ec6e 100644
--- a/packages/cli/src/get-render-defaults.ts
+++ b/packages/cli/src/get-render-defaults.ts
@@ -34,6 +34,9 @@ const {
pixelFormatOption,
everyNthFrameOption,
proResProfileOption,
+ userAgentOption,
+ disableWebSecurityOption,
+ ignoreCertificateErrorsOption,
publicLicenseKeyOption,
stillImageFormatOption,
videoImageFormatOption,
@@ -138,12 +141,16 @@ export const getRenderDefaults = (): RenderDefaults => {
const videoImageFormat = videoImageFormatOption.getValue({
commandLine: parsedCli,
}).value;
- const disableWebSecurity = ConfigInternals.getChromiumDisableWebSecurity();
- const ignoreCertificateErrors = ConfigInternals.getIgnoreCertificateErrors();
+ const disableWebSecurity = disableWebSecurityOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+ const ignoreCertificateErrors = ignoreCertificateErrorsOption.getValue({
+ commandLine: parsedCli,
+ }).value;
const darkMode = darkModeOption.getValue({
commandLine: parsedCli,
}).value;
- const userAgent = ConfigInternals.getChromiumUserAgent();
+ const userAgent = userAgentOption.getValue({commandLine: parsedCli}).value;
const metadata = ConfigInternals.getMetadata();
const outputLocation = ConfigInternals.getOutputLocation();
diff --git a/packages/cli/src/gpu.ts b/packages/cli/src/gpu.ts
index b62ad0668b..1774a3c624 100644
--- a/packages/cli/src/gpu.ts
+++ b/packages/cli/src/gpu.ts
@@ -3,7 +3,6 @@ import {RenderInternals} from '@remotion/renderer';
import {BrowserSafeApis} from '@remotion/renderer/client';
import {defaultBrowserDownloadProgress} from './browser-download-bar';
import {chalk} from './chalk';
-import {getCliOptions} from './get-cli-options';
import {Log} from './log';
import {parsedCli, quietFlagProvided} from './parsed-cli';
@@ -17,19 +16,22 @@ const {
chromeModeOption,
darkModeOption,
browserExecutableOption,
+ userAgentOption,
+ disableWebSecurityOption,
+ ignoreCertificateErrorsOption,
} = BrowserSafeApis.options;
export const gpuCommand = async (logLevel: LogLevel) => {
- const {disableWebSecurity, ignoreCertificateErrors, userAgent} =
- getCliOptions({
- isStill: false,
- logLevel,
- indent: false,
- });
-
const browserExecutable = browserExecutableOption.getValue({
commandLine: parsedCli,
}).value;
+ const userAgent = userAgentOption.getValue({commandLine: parsedCli}).value;
+ const disableWebSecurity = disableWebSecurityOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+ const ignoreCertificateErrors = ignoreCertificateErrorsOption.getValue({
+ commandLine: parsedCli,
+ }).value;
const enableMultiProcessOnLinux = enableMultiprocessOnLinuxOption.getValue({
commandLine: parsedCli,
}).value;
diff --git a/packages/cli/src/parse-command-line.ts b/packages/cli/src/parse-command-line.ts
index 5edeb55f58..1d0c8e8bdf 100644
--- a/packages/cli/src/parse-command-line.ts
+++ b/packages/cli/src/parse-command-line.ts
@@ -38,6 +38,9 @@ const {
browserExecutableOption,
everyNthFrameOption,
proResProfileOption,
+ userAgentOption,
+ disableWebSecurityOption,
+ ignoreCertificateErrorsOption,
} = BrowserSafeApis.options;
export type CommandLineOptions = {
@@ -50,9 +53,13 @@ export type CommandLineOptions = {
[x264Option.cliFlag]: TypeOfOption<typeof x264Option>;
['bundle-cache']: string;
['env-file']: string;
- ['ignore-certificate-errors']: string;
+ [ignoreCertificateErrorsOption.cliFlag]: TypeOfOption<
+ typeof ignoreCertificateErrorsOption
+ >;
[darkModeOption.cliFlag]: TypeOfOption<typeof darkModeOption>;
- ['disable-web-security']: string;
+ [disableWebSecurityOption.cliFlag]: TypeOfOption<
+ typeof disableWebSecurityOption
+ >;
[everyNthFrameOption.cliFlag]: TypeOfOption<typeof everyNthFrameOption>;
[numberOfGifLoopsOption.cliFlag]: TypeOfOption<typeof numberOfGifLoopsOption>;
[numberOfSharedAudioTagsOption.cliFlag]: TypeOfOption<
@@ -112,7 +119,7 @@ export type CommandLineOptions = {
['no-open']: boolean;
['browser']: string;
['browser-args']: string;
- ['user-agent']: string;
+ [userAgentOption.cliFlag]: TypeOfOption<typeof userAgentOption>;
['out-dir']: string;
[audioLatencyHintOption.cliFlag]: AudioContextLatencyCategory;
[ipv4Option.cliFlag]: TypeOfOption<typeof ipv4Option>;
@@ -133,22 +140,6 @@ export const parseCommandLine = () => {
Config.setCachingEnabled(parsedCli['bundle-cache'] !== 'false');
}
- if (parsedCli['disable-web-security']) {
- Config.setChromiumDisableWebSecurity(true);
- }
-
- if (parsedCli['ignore-certificate-errors']) {
- Config.setChromiumIgnoreCertificateErrors(true);
- }
-
- if (parsedCli[darkModeOption.cliFlag]) {
- Config.setChromiumDarkMode(parsedCli[darkModeOption.cliFlag]);
- }
-
- if (parsedCli['user-agent']) {
- Config.setChromiumUserAgent(parsedCli['user-agent']);
- }
-
if (parsedCli.concurrency) {
Config.setConcurrency(parsedCli.concurrency);
}
diff --git a/packages/cli/src/parsed-cli.ts b/packages/cli/src/parsed-cli.ts
index 6f6761baa5..76a1675fcf 100644
--- a/packages/cli/src/parsed-cli.ts
+++ b/packages/cli/src/parsed-cli.ts
@@ -19,9 +19,9 @@ export const BooleanFlags = [
'enable-lambda-insights',
'yes',
'y',
- 'disable-web-security',
+ BrowserSafeApis.options.disableWebSecurityOption.cliFlag,
BrowserSafeApis.options.darkModeOption.cliFlag,
- 'ignore-certificate-errors',
+ BrowserSafeApis.options.ignoreCertificateErrorsOption.cliFlag,
'disable-headless',
'disable-keyboard-shortcuts',
'default-only',
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index d2842eb3ab..7bb0275663 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -52,6 +52,9 @@ const {
browserExecutableOption,
everyNthFrameOption,
proResProfileOption,
+ userAgentOption,
+ disableWebSecurityOption,
+ ignoreCertificateErrorsOption,
} = BrowserSafeApis.options;
export const render = async (
@@ -97,9 +100,6 @@ export const render = async (
shouldOutputImageSequence,
inputProps,
envVariables,
- userAgent,
- disableWebSecurity,
- ignoreCertificateErrors,
height,
width,
ffmpegOverride,
@@ -121,6 +121,13 @@ export const render = async (
const proResProfile = proResProfileOption.getValue({
commandLine: parsedCli,
}).value;
+ const userAgent = userAgentOption.getValue({commandLine: parsedCli}).value;
+ const disableWebSecurity = disableWebSecurityOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+ const ignoreCertificateErrors = ignoreCertificateErrorsOption.getValue({
+ commandLine: parsedCli,
+ }).value;
const x264Preset = x264Option.getValue({commandLine: parsedCli}).value;
const audioBitrate = audioBitrateOption.getValue({
commandLine: parsedCli,
diff --git a/packages/cli/src/still.ts b/packages/cli/src/still.ts
index 7bc43cc338..da126daefa 100644
--- a/packages/cli/src/still.ts
+++ b/packages/cli/src/still.ts
@@ -31,6 +31,9 @@ const {
experimentalClientSideRenderingOption,
keyboardShortcutsOption,
browserExecutableOption,
+ userAgentOption,
+ disableWebSecurityOption,
+ ignoreCertificateErrorsOption,
} = BrowserSafeApis.options;
export const still = async (
@@ -70,16 +73,7 @@ export const still = async (
process.exit(1);
}
- const {
- envVariables,
- height,
- inputProps,
- stillFrame,
- width,
- disableWebSecurity,
- ignoreCertificateErrors,
- userAgent,
- } = getCliOptions({
+ const {envVariables, height, inputProps, stillFrame, width} = getCliOptions({
isStill: true,
logLevel,
indent: false,
@@ -88,6 +82,13 @@ export const still = async (
const browserExecutable = browserExecutableOption.getValue({
commandLine: parsedCli,
}).value;
+ const userAgent = userAgentOption.getValue({commandLine: parsedCli}).value;
+ const disableWebSecurity = disableWebSecurityOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+ const ignoreCertificateErrors = ignoreCertificateErrorsOption.getValue({
+ commandLine: parsedCli,
+ }).value;
const jpegQuality = jpegQualityOption.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 83439871ea..7629074999 100644
--- a/packages/cloudrun/src/cli/commands/render/index.ts
+++ b/packages/cloudrun/src/cli/commands/render/index.ts
@@ -42,6 +42,9 @@ const {
browserExecutableOption,
everyNthFrameOption,
proResProfileOption,
+ userAgentOption,
+ disableWebSecurityOption,
+ ignoreCertificateErrorsOption,
} = BrowserSafeApis.options;
export const renderCommand = async (
@@ -87,9 +90,6 @@ export const renderCommand = async (
inputProps,
height,
width,
- disableWebSecurity,
- ignoreCertificateErrors,
- userAgent,
} = CliInternals.getCliOptions({
isStill: false,
logLevel,
@@ -108,6 +108,15 @@ export const renderCommand = async (
const proResProfile = proResProfileOption.getValue({
commandLine: CliInternals.parsedCli,
}).value;
+ const userAgent = userAgentOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const disableWebSecurity = disableWebSecurityOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const ignoreCertificateErrors = ignoreCertificateErrorsOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
const offthreadVideoCacheSizeInBytes =
offthreadVideoCacheSizeInBytesOption.getValue({
commandLine: CliInternals.parsedCli,
diff --git a/packages/cloudrun/src/cli/commands/still.ts b/packages/cloudrun/src/cli/commands/still.ts
index 4a7015b819..cc152904e4 100644
--- a/packages/cloudrun/src/cli/commands/still.ts
+++ b/packages/cloudrun/src/cli/commands/still.ts
@@ -25,6 +25,9 @@ const {
mediaCacheSizeInBytesOption,
darkModeOption,
browserExecutableOption,
+ userAgentOption,
+ disableWebSecurityOption,
+ ignoreCertificateErrorsOption,
} = BrowserSafeApis.options;
export const stillCommand = async (
@@ -48,9 +51,6 @@ export const stillCommand = async (
stillFrame,
height,
width,
- userAgent,
- disableWebSecurity,
- ignoreCertificateErrors,
} = CliInternals.getCliOptions({
isStill: false,
logLevel,
@@ -60,6 +60,15 @@ export const stillCommand = async (
const browserExecutable = browserExecutableOption.getValue({
commandLine: CliInternals.parsedCli,
}).value;
+ const userAgent = userAgentOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const disableWebSecurity = disableWebSecurityOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const ignoreCertificateErrors = ignoreCertificateErrorsOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
let composition = args[1];
diff --git a/packages/docs/docs/cli/compositions.mdx b/packages/docs/docs/cli/compositions.mdx
index 8b7d42ad3f..44d97d94e1 100644
--- a/packages/docs/docs/cli/compositions.mdx
+++ b/packages/docs/docs/cli/compositions.mdx
@@ -66,13 +66,11 @@ Not to be confused with the [`--timeout` flag when deploying a Lambda function](
### `--ignore-certificate-errors`
-Results in invalid SSL certificates in Chrome, such as self-signed ones, being ignored.
+<Options id="ignore-certificate-errors" />
### `--disable-web-security`
-_available since v2.6.5_
-
-This will most notably disable CORS in Chrome among other security features.
+<Options id="disable-web-security" />
### ~`--disable-headless`~
@@ -88,7 +86,7 @@ This will most notably disable CORS in Chrome among other security features.
### `--user-agent`<AvailableFrom v="3.3.83"/>
-Lets you set a custom user agent that the headless Chrome browser assumes.
+<Options id="user-agent" />
### `--media-cache-size-in-bytes`<AvailableFrom v="4.0.352"/>
diff --git a/packages/docs/docs/cli/render.mdx b/packages/docs/docs/cli/render.mdx
index 8d1b1c4aa0..b1aea02c87 100644
--- a/packages/docs/docs/cli/render.mdx
+++ b/packages/docs/docs/cli/render.mdx
@@ -202,11 +202,11 @@ Not to be confused with the [`--timeout` flag when deploying a Lambda function](
### `--ignore-certificate-errors`<AvailableFrom v="2.6.5" />
-Results in invalid SSL certificates in Chrome, such as self-signed ones, being ignored.
+<Options id="ignore-certificate-errors" />
### `--disable-web-security`<AvailableFrom v="2.6.5" />
-This will most notably disable CORS in Chrome among other security features.
+<Options id="disable-web-security" />
### ~`--disable-headless`~<AvailableFrom v="2.6.5" />
@@ -222,7 +222,7 @@ This will most notably disable CORS in Chrome among other security features.
### `--user-agent`<AvailableFrom v="3.3.83"/>
-Lets you set a custom user agent that the headless Chrome browser assumes.
+<Options id="user-agent" />
### `--media-cache-size-in-bytes`<AvailableFrom v="4.0.352"/>
diff --git a/packages/docs/docs/cli/still.mdx b/packages/docs/docs/cli/still.mdx
index dce0c25375..7d8504149d 100644
--- a/packages/docs/docs/cli/still.mdx
+++ b/packages/docs/docs/cli/still.mdx
@@ -98,11 +98,11 @@ Not to be confused with the [`--timeout` flag when deploying a Lambda function](
### `--ignore-certificate-errors`<AvailableFrom v="2.6.5" />
-Results in invalid SSL certificates in Chrome, such as self-signed ones, being ignored.
+<Options id="ignore-certificate-errors" />
### `--disable-web-security`<AvailableFrom v="2.6.5" />
-This will most notably disable CORS in Chrome among other security features.
+<Options id="disable-web-security" />
### ~`--disable-headless`~<AvailableFrom v="2.6.5" />
@@ -122,7 +122,7 @@ This will most notably disable CORS in Chrome among other security features.
### `--user-agent`<AvailableFrom v="3.3.83"/>
-Lets you set a custom user agent that the headless Chrome browser assumes.
+<Options id="user-agent" />
### `--media-cache-size-in-bytes`<AvailableFrom v="4.0.352"/>
diff --git a/packages/docs/docs/config.mdx b/packages/docs/docs/config.mdx
index c1816de003..a4d42848ed 100644
--- a/packages/docs/docs/config.mdx
+++ b/packages/docs/docs/config.mdx
@@ -216,7 +216,7 @@ The [command line flag](/docs/cli/render#--timeout) `--timeout` will take preced
## `setChromiumDisableWebSecurity()`<AvailableFrom v="2.6.5" />
-This will most notably disable CORS among other security features during rendering.
+<Options id="disable-web-security" />
```tsx twoslash title="remotion.config.ts"
import {Config} from '@remotion/cli/config';
@@ -241,7 +241,7 @@ Config.setChromiumDarkMode(true);
## `setChromiumIgnoreCertificateErrors()`<AvailableFrom v="2.6.5" />
-Results in invalid SSL certificates, such as self-signed ones, being ignored during rendering.
+<Options id="ignore-certificate-errors" />
```tsx twoslash title="remotion.config.ts"
import {Config} from '@remotion/cli/config';
diff --git a/packages/lambda/src/cli/commands/compositions/index.ts b/packages/lambda/src/cli/commands/compositions/index.ts
index 246afb30cc..37ae33c364 100644
--- a/packages/lambda/src/cli/commands/compositions/index.ts
+++ b/packages/lambda/src/cli/commands/compositions/index.ts
@@ -22,6 +22,9 @@ const {
delayRenderTimeoutInMillisecondsOption,
headlessOption,
darkModeOption,
+ userAgentOption,
+ disableWebSecurityOption,
+ ignoreCertificateErrorsOption,
} = BrowserSafeApis.options;
export const compositionsCommand = async ({
@@ -49,18 +52,21 @@ export const compositionsCommand = async ({
quit(1);
}
- const {
- envVariables,
- inputProps,
- ignoreCertificateErrors,
- userAgent,
- disableWebSecurity,
- } = CliInternals.getCliOptions({
+ const {envVariables, inputProps} = CliInternals.getCliOptions({
isStill: false,
logLevel,
indent: false,
});
+ const userAgent = userAgentOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const disableWebSecurity = disableWebSecurityOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const ignoreCertificateErrors = ignoreCertificateErrorsOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
const enableMultiProcessOnLinux = enableMultiprocessOnLinuxOption.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 a7d7153e0e..f0f5e58373 100644
--- a/packages/lambda/src/cli/commands/render/render.ts
+++ b/packages/lambda/src/cli/commands/render/render.ts
@@ -60,6 +60,9 @@ const {
browserExecutableOption,
everyNthFrameOption,
proResProfileOption,
+ userAgentOption,
+ disableWebSecurityOption,
+ ignoreCertificateErrorsOption,
} = BrowserSafeApis.options;
export const renderCommand = async ({
@@ -90,20 +93,12 @@ export const renderCommand = async ({
const region = getAwsRegion();
- const {
- envVariables,
- frameRange,
- inputProps,
- height,
- width,
- ignoreCertificateErrors,
- userAgent,
- disableWebSecurity,
- } = CliInternals.getCliOptions({
- isStill: false,
- logLevel,
- indent: false,
- });
+ const {envVariables, frameRange, inputProps, height, width} =
+ CliInternals.getCliOptions({
+ isStill: false,
+ logLevel,
+ indent: false,
+ });
const pixelFormat = pixelFormatOption.getValue({
commandLine: CliInternals.parsedCli,
@@ -117,6 +112,15 @@ export const renderCommand = async ({
const proResProfile = proResProfileOption.getValue({
commandLine: CliInternals.parsedCli,
}).value;
+ const userAgent = userAgentOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const disableWebSecurity = disableWebSecurityOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const ignoreCertificateErrors = ignoreCertificateErrorsOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
const x264Preset = x264Option.getValue({
commandLine: CliInternals.parsedCli,
}).value;
diff --git a/packages/lambda/src/cli/commands/still.ts b/packages/lambda/src/cli/commands/still.ts
index bffe16f3cb..103d45670d 100644
--- a/packages/lambda/src/cli/commands/still.ts
+++ b/packages/lambda/src/cli/commands/still.ts
@@ -36,6 +36,9 @@ const {
mediaCacheSizeInBytesOption,
darkModeOption,
browserExecutableOption,
+ userAgentOption,
+ disableWebSecurityOption,
+ ignoreCertificateErrorsOption,
} = BrowserSafeApis.options;
const {
@@ -76,16 +79,7 @@ export const stillCommand = async ({
quit(1);
}
- const {
- envVariables,
- inputProps,
- stillFrame,
- height,
- width,
- userAgent,
- disableWebSecurity,
- ignoreCertificateErrors,
- } = getCliOptions({
+ const {envVariables, inputProps, stillFrame, height, width} = getCliOptions({
isStill: true,
logLevel,
indent: false,
@@ -94,6 +88,13 @@ export const stillCommand = async ({
const browserExecutable = browserExecutableOption.getValue({
commandLine: parsedCli,
}).value;
+ const userAgent = userAgentOption.getValue({commandLine: parsedCli}).value;
+ const disableWebSecurity = disableWebSecurityOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+ const ignoreCertificateErrors = ignoreCertificateErrorsOption.getValue({
+ commandLine: parsedCli,
+ }).value;
const region = getAwsRegion();
let composition = args[1];
diff --git a/packages/renderer/src/options/disable-web-security.tsx b/packages/renderer/src/options/disable-web-security.tsx
new file mode 100644
index 0000000000..bb7a1342eb
--- /dev/null
+++ b/packages/renderer/src/options/disable-web-security.tsx
@@ -0,0 +1,44 @@
+import type {AnyRemotionOption} from './option';
+
+let disableWebSecurity = false;
+
+const cliFlag = 'disable-web-security' as const;
+
+export const disableWebSecurityOption = {
+ name: 'Disable web security',
+ cliFlag,
+ description: () => (
+ <>
+ This will most notably disable CORS in Chrome among other security
+ features.
+ </>
+ ),
+ ssrName: 'disableWebSecurity' as const,
+ docLink:
+ 'https://www.remotion.dev/docs/chromium-flags#--disable-web-security',
+ type: false as boolean,
+ getValue: ({commandLine}) => {
+ if (commandLine[cliFlag] !== undefined) {
+ return {
+ source: 'cli',
+ value: Boolean(commandLine[cliFlag]),
+ };
+ }
+
+ if (disableWebSecurity) {
+ return {
+ source: 'config',
+ value: disableWebSecurity,
+ };
+ }
+
+ return {
+ source: 'default',
+ value: false,
+ };
+ },
+ setConfig: (value) => {
+ disableWebSecurity = value;
+ },
+ id: cliFlag,
+} satisfies AnyRemotionOption<boolean>;
diff --git a/packages/renderer/src/options/ignore-certificate-errors.tsx b/packages/renderer/src/options/ignore-certificate-errors.tsx
new file mode 100644
index 0000000000..e5756c88b5
--- /dev/null
+++ b/packages/renderer/src/options/ignore-certificate-errors.tsx
@@ -0,0 +1,44 @@
+import type {AnyRemotionOption} from './option';
+
+let ignoreCertificateErrors = false;
+
+const cliFlag = 'ignore-certificate-errors' as const;
+
+export const ignoreCertificateErrorsOption = {
+ name: 'Ignore certificate errors',
+ cliFlag,
+ description: () => (
+ <>
+ Results in invalid SSL certificates in Chrome, such as self-signed ones,
+ being ignored.
+ </>
+ ),
+ ssrName: 'ignoreCertificateErrors' as const,
+ docLink:
+ 'https://www.remotion.dev/docs/chromium-flags#--ignore-certificate-errors',
+ type: false as boolean,
+ getValue: ({commandLine}) => {
+ if (commandLine[cliFlag] !== undefined) {
+ return {
+ source: 'cli',
+ value: Boolean(commandLine[cliFlag]),
+ };
+ }
+
+ if (ignoreCertificateErrors) {
+ return {
+ source: 'config',
+ value: ignoreCertificateErrors,
+ };
+ }
+
+ return {
+ source: 'default',
+ value: false,
+ };
+ },
+ setConfig: (value) => {
+ ignoreCertificateErrors = value;
+ },
+ id: cliFlag,
+} satisfies AnyRemotionOption<boolean>;
diff --git a/packages/renderer/src/options/index.tsx b/packages/renderer/src/options/index.tsx
index cc0d038d37..563a2b4c84 100644
--- a/packages/renderer/src/options/index.tsx
+++ b/packages/renderer/src/options/index.tsx
@@ -12,6 +12,7 @@ import {enableCrossSiteIsolationOption} from './cross-site-isolation';
import {darkModeOption} from './dark-mode';
import {deleteAfterOption} from './delete-after';
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 {enableMultiprocessOnLinuxOption} from './enable-multiprocess-on-linux';
@@ -26,6 +27,7 @@ import {forceNewStudioOption} from './force-new-studio';
import {glOption} from './gl';
import {hardwareAccelerationOption} from './hardware-acceleration';
import {headlessOption} from './headless';
+import {ignoreCertificateErrorsOption} from './ignore-certificate-errors';
import {imageSequencePatternOption} from './image-sequence-pattern';
import {ipv4Option} from './ipv4';
import {isProductionOption} from './is-production';
@@ -55,6 +57,7 @@ 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 {videoBitrateOption} from './video-bitrate';
import {mediaCacheSizeInBytesOption} from './video-cache-size';
import {videoCodecOption} from './video-codec';
@@ -79,6 +82,7 @@ export const allOptions = {
webhookCustomDataOption,
colorSpaceOption,
deleteAfterOption,
+ disableWebSecurityOption,
disallowParallelEncodingOption,
folderExpiryOption,
enableMultiprocessOnLinuxOption,
@@ -112,6 +116,7 @@ export const allOptions = {
licenseKeyOption,
audioLatencyHintOption,
enableCrossSiteIsolationOption,
+ ignoreCertificateErrorsOption,
imageSequencePatternOption,
mediaCacheSizeInBytesOption,
darkModeOption,
@@ -124,6 +129,7 @@ export const allOptions = {
numberOfSharedAudioTagsOption,
ipv4Option,
stillImageFormatOption,
+ userAgentOption,
videoImageFormatOption,
};
diff --git a/packages/renderer/src/options/user-agent.tsx b/packages/renderer/src/options/user-agent.tsx
new file mode 100644
index 0000000000..f0dd2542de
--- /dev/null
+++ b/packages/renderer/src/options/user-agent.tsx
@@ -0,0 +1,42 @@
+import type {AnyRemotionOption} from './option';
+
+let userAgent: string | null = null;
+
+const cliFlag = 'user-agent' as const;
+
+export const userAgentOption = {
+ name: 'User agent',
+ cliFlag,
+ description: () => (
+ <>
+ Lets you set a custom user agent that the headless Chrome browser assumes.
+ </>
+ ),
+ ssrName: 'userAgent' as const,
+ docLink: 'https://www.remotion.dev/docs/chromium-flags#--user-agent',
+ type: null as string | null,
+ getValue: ({commandLine}) => {
+ if (commandLine[cliFlag] !== undefined) {
+ return {
+ source: 'cli',
+ value: commandLine[cliFlag] as string,
+ };
+ }
+
+ if (userAgent !== null) {
+ return {
+ source: 'config',
+ value: userAgent,
+ };
+ }
+
+ return {
+ source: 'default',
+ value: null,
+ };
+ },
+ setConfig: (value) => {
+ userAgent = value;
+ },
+ id: cliFlag,
+} satisfies AnyRemotionOption<string | null>;