🎥 Make videos programmatically with React
@remotion/cli: Implement CLI flag for disallowParallelEncoding
copilot-swe-agent[bot]db6c4e4f625d
diff --git a/packages/cli/src/benchmark.ts b/packages/cli/src/benchmark.tsindex 3155fdbe12..5fc2c14821 100644--- a/packages/cli/src/benchmark.ts+++ b/packages/cli/src/benchmark.ts@@ -38,6 +38,7 @@ const {mutedOption,videoCodecOption,colorSpaceOption,+ disallowParallelEncodingOption,enableMultiprocessOnLinuxOption,glOption,numberOfGifLoopsOption,@@ -377,6 +378,9 @@ export const benchmarkCommand = async (commandLine: parsedCli,}).value;const muted = mutedOption.getValue({commandLine: parsedCli}).value;+ const disallowParallelEncoding = disallowParallelEncodingOption.getValue({+ commandLine: parsedCli,+ }).value;const numberOfGifLoops = numberOfGifLoopsOption.getValue({commandLine: parsedCli,}).value;@@ -472,7 +476,7 @@ export const benchmarkCommand = async (concurrency: con,audioCodec: null,cancelSignal: undefined,- disallowParallelEncoding: false,+ disallowParallelEncoding,indent: false,onBrowserLog: null,onCtrlCExit: () => undefined,diff --git a/packages/cli/src/config/index.ts b/packages/cli/src/config/index.tsindex 291f3e73d9..b941be4a5e 100644--- a/packages/cli/src/config/index.ts+++ b/packages/cli/src/config/index.ts@@ -103,6 +103,7 @@ const {mutedOption,videoCodecOption,colorSpaceOption,+ disallowParallelEncodingOption,deleteAfterOption,folderExpiryOption,enableMultiprocessOnLinuxOption,@@ -462,6 +463,13 @@ declare global {*/readonly setColorSpace: (colorSpace: ColorSpace) => void;+ /**+ * Disallows the renderer from doing rendering frames and encoding at the same time.+ * This makes the rendering process more memory-efficient, but possibly slower.+ * Default: false+ */+ readonly setDisallowParallelEncoding: (disallowParallelEncoding: boolean) => void;+/*** Removes the --single-process flag that gets passed toChromium on Linux by default. This will make the render faster because@@ -673,6 +681,7 @@ export const Config: FlatConfig = {},setDeleteAfter: deleteAfterOption.setConfig,setColorSpace: colorSpaceOption.setConfig,+ setDisallowParallelEncoding: disallowParallelEncodingOption.setConfig,setBeepOnFinish: beepOnFinishOption.setConfig,setEnableFolderExpiry: folderExpiryOption.setConfig,setRepro: reproOption.setConfig,diff --git a/packages/cli/src/parse-command-line.ts b/packages/cli/src/parse-command-line.tsindex 769d4f3d1f..841ef8fa6e 100644--- a/packages/cli/src/parse-command-line.ts+++ b/packages/cli/src/parse-command-line.ts@@ -17,6 +17,7 @@ import {parsedCli} from './parsed-cli';const {beepOnFinishOption,colorSpaceOption,+ disallowParallelEncodingOption,offthreadVideoCacheSizeInBytesOption,encodingBufferSizeOption,encodingMaxRateOption,@@ -51,6 +52,7 @@ export type CommandLineOptions = {typeof offthreadVideoCacheSizeInBytesOption>;[colorSpaceOption.cliFlag]: TypeOfOption<typeof colorSpaceOption>;+ [disallowParallelEncodingOption.cliFlag]: TypeOfOption<typeof disallowParallelEncodingOption>;[beepOnFinishOption.cliFlag]: TypeOfOption<typeof beepOnFinishOption>;version: string;codec: Codec;diff --git a/packages/cli/src/parsed-cli.ts b/packages/cli/src/parsed-cli.tsindex eb3cc39fc8..fe91595553 100644--- a/packages/cli/src/parsed-cli.ts+++ b/packages/cli/src/parsed-cli.ts@@ -28,6 +28,7 @@ export const BooleanFlags = ['ipv4',BrowserSafeApis.options.beepOnFinishOption.cliFlag,BrowserSafeApis.options.disableGitSourceOption.cliFlag,+ BrowserSafeApis.options.disallowParallelEncodingOption.cliFlag,'repro','compatible-only','force-path-style',diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsxindex b0e494688e..36a55b4ab9 100644--- a/packages/cli/src/render.tsx+++ b/packages/cli/src/render.tsx@@ -21,6 +21,7 @@ const {enforceAudioOption,mutedOption,colorSpaceOption,+ disallowParallelEncodingOption,enableMultiprocessOnLinuxOption,glOption,numberOfGifLoopsOption,@@ -128,6 +129,9 @@ export const render = async (const colorSpace = colorSpaceOption.getValue({commandLine: parsedCli,}).value;+ const disallowParallelEncoding = disallowParallelEncodingOption.getValue({+ commandLine: parsedCli,+ }).value;const crf = shouldOutputImageSequence? null: crfOption.getValue({commandLine: parsedCli}).value;@@ -246,7 +250,7 @@ export const render = async (encodingBufferSize,numberOfGifLoops,audioCodec,- disallowParallelEncoding: false,+ disallowParallelEncoding,offthreadVideoCacheSizeInBytes,colorSpace,repro,diff --git a/packages/docs/docs/cli/benchmark.mdx b/packages/docs/docs/cli/benchmark.mdxindex 9b88599086..ef3a42b9c7 100644--- a/packages/docs/docs/cli/benchmark.mdx+++ b/packages/docs/docs/cli/benchmark.mdx@@ -177,6 +177,12 @@ _optional_Inherited from [`npx remotion render`](/docs/cli/render#--enforce-audio-track)+### `--disallow-parallel-encoding`<AvailableFrom v="4.0.315" />++_optional_++Inherited from [`npx remotion render`](/docs/cli/render#--disallow-parallel-encoding)+### `--browser-executable`_optional_diff --git a/packages/docs/docs/cli/render.mdx b/packages/docs/docs/cli/render.mdxindex 5e87f3e861..91bce0e9ac 100644--- a/packages/docs/docs/cli/render.mdx+++ b/packages/docs/docs/cli/render.mdx@@ -156,6 +156,10 @@ For example only every second frame, every third frame and so on. Only works for[Render a silent audio track if there wouldn't be one otherwise.](/docs/cli/render#--enforce-audio-track).+### `--disallow-parallel-encoding`<AvailableFrom v="4.0.315" />++Disallows the renderer from doing rendering frames and encoding at the same time. This makes the rendering process more memory-efficient, but possibly slower.+### `--number-of-gif-loops`<AvailableFrom v="3.1.0" /><Options id="number-of-gif-loops" />diff --git a/packages/docs/docs/config.mdx b/packages/docs/docs/config.mdxindex d8e2208756..53df6fc350 100644--- a/packages/docs/docs/config.mdx+++ b/packages/docs/docs/config.mdx@@ -350,6 +350,18 @@ Config.setMuted(true);The [command line flag](/docs/cli/render#--muted) `--muted` will take precedence over this option.+## `setDisallowParallelEncoding()`<AvailableFrom v="4.0.315" />++Disallows the renderer from doing rendering frames and encoding at the same time. This makes the rendering process more memory-efficient, but possibly slower. Default `false`.++```ts twoslash title="remotion.config.ts"+import {Config} from '@remotion/cli/config';+// ---cut---+Config.setDisallowParallelEncoding(true);+```++The [command line flag](/docs/cli/render#--disallow-parallel-encoding) `--disallow-parallel-encoding` will take precedence over this option.+## `setEnforceAudioTrack()`<AvailableFrom v="3.2.1" />Render a silent audio track if there would be none otherwise. Default `false`.diff --git a/packages/renderer/src/options/disallow-parallel-encoding.tsx b/packages/renderer/src/options/disallow-parallel-encoding.tsxnew file mode 100644index 0000000000..4a94cec2be--- /dev/null+++ b/packages/renderer/src/options/disallow-parallel-encoding.tsx@@ -0,0 +1,41 @@+import type {AnyRemotionOption} from './option';++let disallowParallelEncoding = false;++const cliFlag = 'disallow-parallel-encoding' as const;++export const disallowParallelEncodingOption = {+ name: 'Disallow parallel encoding',+ cliFlag,+ description: () => (+ <>+ Disallows the renderer from doing rendering frames and encoding at the same time. This makes the rendering process more memory-efficient, but possibly slower.+ </>+ ),+ ssrName: 'disallowParallelEncoding',+ docLink: 'https://www.remotion.dev/docs/config#setdisallowparallelencoding',+ type: false as boolean,+ getValue: ({commandLine}) => {+ if (commandLine[cliFlag] !== undefined) {+ return {+ value: commandLine[cliFlag] as boolean,+ source: 'cli',+ };+ }++ if (disallowParallelEncoding !== false) {+ return {+ value: disallowParallelEncoding,+ source: 'config',+ };+ }++ return {+ value: false,+ source: 'default',+ };+ },+ setConfig(value) {+ disallowParallelEncoding = value;+ },+} satisfies AnyRemotionOption<boolean>;\ No newline at end of filediff --git a/packages/renderer/src/options/index.tsx b/packages/renderer/src/options/index.tsxindex d7ad195b1b..d8c5af17ee 100644--- a/packages/renderer/src/options/index.tsx+++ b/packages/renderer/src/options/index.tsx@@ -8,6 +8,7 @@ import {colorSpaceOption} from './color-space';import {crfOption} from './crf';import {enableCrossSiteIsolationOption} from './cross-site-isolation';import {deleteAfterOption} from './delete-after';+import {disallowParallelEncodingOption} from './disallow-parallel-encoding';import {disableGitSourceOption} from './disable-git-source';import {enableLambdaInsights} from './enable-lambda-insights';import {enableMultiprocessOnLinuxOption} from './enable-multiprocess-on-linux';@@ -59,6 +60,7 @@ export const allOptions = {webhookCustomDataOption,colorSpaceOption,deleteAfterOption,+ disallowParallelEncodingOption,folderExpiryOption,enableMultiprocessOnLinuxOption,glOption,diff --git a/packages/renderer/src/options/options-map.ts b/packages/renderer/src/options/options-map.tsindex da40e7573c..ef06785fbc 100644--- a/packages/renderer/src/options/options-map.ts+++ b/packages/renderer/src/options/options-map.ts@@ -6,6 +6,7 @@ import {chromeModeOption} from './chrome-mode';import {colorSpaceOption} from './color-space';import {crfOption} from './crf';import {deleteAfterOption} from './delete-after';+import {disallowParallelEncodingOption} from './disallow-parallel-encoding';import {encodingBufferSizeOption} from './encoding-buffer-size';import {encodingMaxRateOption} from './encoding-max-rate';import {enforceAudioOption} from './enforce-audio';@@ -40,6 +41,7 @@ export const optionsMap = {audioBitrate: audioBitrateOption,colorSpace: colorSpaceOption,codec: videoCodecOption,+ disallowParallelEncoding: disallowParallelEncodingOption,jpegQuality: jpegQualityOption,encodingMaxRate: encodingMaxRateOption,encodingBufferSize: encodingBufferSizeOption,