UNPKG

@remotion/renderer

Version:

Render Remotion videos using Node.js or Bun

1,828 lines (1,787 loc) 151 kB
// src/client.ts import { NoReactInternals as NoReactInternals4 } from "remotion/no-react"; // src/browser/TimeoutSettings.ts var DEFAULT_TIMEOUT = 30000; class TimeoutSettings { #defaultTimeout; #defaultNavigationTimeout; constructor() { this.#defaultTimeout = null; this.#defaultNavigationTimeout = null; } setDefaultTimeout(timeout) { this.#defaultTimeout = timeout; } setDefaultNavigationTimeout(timeout) { this.#defaultNavigationTimeout = timeout; } navigationTimeout() { if (this.#defaultNavigationTimeout !== null) { return this.#defaultNavigationTimeout; } if (this.#defaultTimeout !== null) { return this.#defaultTimeout; } return DEFAULT_TIMEOUT; } timeout() { if (this.#defaultTimeout !== null) { return this.#defaultTimeout; } return DEFAULT_TIMEOUT; } } // src/codec.ts var validCodecs = [ "h264", "h265", "vp8", "vp9", "av1", "mp3", "aac", "wav", "prores", "h264-mkv", "h264-ts", "gif" ]; var DEFAULT_CODEC = "h264"; // src/crf.ts var defaultCrfMap = { h264: 18, h265: 23, vp8: 9, vp9: 28, av1: 30, prores: null, gif: null, "h264-mkv": 18, "h264-ts": 18, aac: null, mp3: null, wav: null }; var getDefaultCrfForCodec = (codec) => { const val = defaultCrfMap[codec]; if (val === undefined) { throw new TypeError(`Got unexpected codec "${codec}"`); } return val; }; var crfRanges = { h264: [1, 51], h265: [0, 51], vp8: [4, 63], vp9: [0, 63], av1: [0, 63], prores: [0, 0], gif: [0, 0], "h264-mkv": [1, 51], "h264-ts": [1, 51], aac: [0, 0], mp3: [0, 0], wav: [0, 0] }; var getValidCrfRanges = (codec) => { const val = crfRanges[codec]; if (val === undefined) { throw new TypeError(`Got unexpected codec "${codec}"`); } return val; }; // src/codec-supports-media.ts var codecSupportsVideoBitrateMap = { "h264-mkv": true, "h264-ts": true, aac: false, gif: false, h264: true, h265: true, av1: true, mp3: false, prores: false, vp8: true, vp9: true, wav: false }; var codecSupportsCrf = (codec) => { const range = getValidCrfRanges(codec); return range[0] !== range[1]; }; var codecSupportsVideoBitrate = (codec) => { return codecSupportsVideoBitrateMap[codec]; }; // src/file-extensions.ts var defaultFileExtensionMap = { "h264-mkv": { default: "mkv", forAudioCodec: { "pcm-16": { possible: ["mkv"], default: "mkv" }, mp3: { possible: ["mkv"], default: "mkv" } } }, "h264-ts": { default: "ts", forAudioCodec: { "pcm-16": { possible: ["ts"], default: "ts" }, aac: { possible: ["ts"], default: "ts" } } }, aac: { default: "aac", forAudioCodec: { aac: { possible: ["aac", "3gp", "m4a", "m4b", "mpg", "mpeg"], default: "aac" }, "pcm-16": { possible: ["wav"], default: "wav" } } }, gif: { default: "gif", forAudioCodec: {} }, h264: { default: "mp4", forAudioCodec: { "pcm-16": { possible: ["mkv", "mov"], default: "mkv" }, aac: { possible: ["mp4", "mkv", "mov"], default: "mp4" }, mp3: { possible: ["mp4", "mkv", "mov"], default: "mp4" } } }, h265: { default: "mp4", forAudioCodec: { aac: { possible: ["mp4", "mkv", "hevc"], default: "mp4" }, "pcm-16": { possible: ["mkv"], default: "mkv" } } }, av1: { default: "mp4", forAudioCodec: { aac: { possible: ["mp4", "mkv"], default: "mp4" }, opus: { possible: ["webm", "mkv"], default: "webm" }, "pcm-16": { possible: ["mkv"], default: "mkv" } } }, mp3: { default: "mp3", forAudioCodec: { mp3: { possible: ["mp3"], default: "mp3" }, "pcm-16": { possible: ["wav"], default: "wav" } } }, prores: { default: "mov", forAudioCodec: { aac: { possible: ["mov", "mkv", "mxf"], default: "mov" }, "pcm-16": { possible: ["mov", "mkv", "mxf"], default: "mov" } } }, vp8: { default: "webm", forAudioCodec: { "pcm-16": { possible: ["mkv"], default: "mkv" }, opus: { possible: ["webm"], default: "webm" } } }, vp9: { default: "webm", forAudioCodec: { "pcm-16": { possible: ["mkv"], default: "mkv" }, opus: { possible: ["webm"], default: "webm" } } }, wav: { default: "wav", forAudioCodec: { "pcm-16": { possible: ["wav"], default: "wav" } } } }; // src/get-extension-from-codec.ts var getFileExtensionFromCodec = (codec, audioCodec) => { if (!validCodecs.includes(codec)) { throw new Error(`Codec must be one of the following: ${validCodecs.join(", ")}, but got ${codec}`); } const map = defaultFileExtensionMap[codec]; if (audioCodec === null) { return map.default; } const typedAudioCodec = audioCodec; if (!(typedAudioCodec in map.forAudioCodec)) { throw new Error(`Audio codec ${typedAudioCodec} is not supported for codec ${codec}`); } return map.forAudioCodec[audioCodec].default; }; var makeFileExtensionMap = () => { const map = {}; Object.keys(defaultFileExtensionMap).forEach((_codec) => { const codec = _codec; const fileExtMap = defaultFileExtensionMap[codec]; const audioCodecs = Object.keys(fileExtMap.forAudioCodec); const possibleExtensionsForAudioCodec = audioCodecs.map((audioCodec) => fileExtMap.forAudioCodec[audioCodec].possible); const allPossibleExtensions = [ fileExtMap.default, ...possibleExtensionsForAudioCodec.flat(1) ]; for (const extension of allPossibleExtensions) { if (!map[extension]) { map[extension] = []; } if (!map[extension].includes(codec)) { map[extension].push(codec); } } }); return map; }; var defaultCodecsForFileExtension = { "3gp": "aac", aac: "aac", gif: "gif", hevc: "h265", m4a: "aac", m4b: "aac", mkv: "h264-mkv", mov: "prores", mp3: "mp3", mp4: "h264", mpeg: "aac", mpg: "aac", mxf: "prores", wav: "wav", webm: "vp8", ts: "h264-ts" }; // src/image-format.ts var validVideoImageFormats = ["png", "jpeg", "none"]; var validStillImageFormats = ["png", "jpeg", "pdf", "webp"]; // src/jpeg-quality.ts var DEFAULT_JPEG_QUALITY = 80; var validateJpegQuality = (q) => { if (typeof q !== "undefined" && typeof q !== "number") { throw new Error(`JPEG Quality option must be a number or undefined. Got ${typeof q} (${JSON.stringify(q)})`); } if (typeof q === "undefined") { return; } if (!Number.isFinite(q)) { throw new RangeError(`JPEG Quality must be a finite number, but is ${q}`); } if (Number.isNaN(q)) { throw new RangeError(`JPEG Quality is NaN, but must be a real number`); } if (q > 100 || q < 0) { throw new RangeError("JPEG Quality option must be between 0 and 100."); } }; // src/log-level.ts var logLevels = ["trace", "verbose", "info", "warn", "error"]; var getNumberForLogLevel = (level) => { return logLevels.indexOf(level); }; var isValidLogLevel = (level) => { return getNumberForLogLevel(level) > -1; }; // src/options/allow-html-in-canvas.tsx import { jsx, jsxs, Fragment } from "react/jsx-runtime"; var allowHtmlInCanvasEnabled = false; var cliFlag = "allow-html-in-canvas"; var allowHtmlInCanvasOption = { name: "Allow HTML-in-canvas for client-side rendering", cliFlag, description: () => /* @__PURE__ */ jsxs(Fragment, { children: [ "When client-side rendering is enabled in the Studio, allow the experimental Chromium HTML-in-canvas API to be used for capturing frames. See", " ", /* @__PURE__ */ jsx("a", { href: "/docs/client-side-rendering/html-in-canvas", children: "HTML-in-canvas docs" }), "." ] }), ssrName: null, docLink: "https://www.remotion.dev/docs/client-side-rendering/html-in-canvas", type: false, getValue: ({ commandLine }) => { if (commandLine[cliFlag] !== null) { return { value: commandLine[cliFlag], source: "cli" }; } return { value: allowHtmlInCanvasEnabled, source: "config" }; }, setConfig(value) { allowHtmlInCanvasEnabled = value; }, id: cliFlag }; // src/options/api-key.tsx import { jsx as jsx2, jsxs as jsxs2, Fragment as Fragment2 } from "react/jsx-runtime"; var currentApiKey = null; var cliFlag2 = "api-key"; var apiKeyOption = { name: "API key", cliFlag: cliFlag2, description: () => /* @__PURE__ */ jsxs2(Fragment2, { children: [ "API key for sending a usage event using ", /* @__PURE__ */ jsx2("code", { children: "@remotion/licensing" }), "." ] }), ssrName: "apiKey", docLink: "https://www.remotion.dev/docs/licensing", type: null, getValue: ({ commandLine }) => { if (commandLine[cliFlag2] !== undefined) { return { source: "cli", value: commandLine[cliFlag2] }; } return { source: "default", value: currentApiKey }; }, setConfig: (value) => { currentApiKey = value; }, id: cliFlag2 }; // src/options/ask-ai.tsx import { jsx as jsx3, Fragment as Fragment3 } from "react/jsx-runtime"; var askAIEnabled = true; var cliFlag3 = "disable-ask-ai"; var askAIOption = { name: "Disable or Enable the Ask AI option", cliFlag: cliFlag3, description: () => /* @__PURE__ */ jsx3(Fragment3, { children: "If the Cmd + I shortcut of the Ask AI modal conflicts with your Studio, you can disable it using this." }), ssrName: null, docLink: "https://www.remotion.dev/docs/config#setaskaienabled", type: false, getValue: ({ commandLine }) => { if (commandLine[cliFlag3] !== undefined) { askAIEnabled = false; return { value: askAIEnabled, source: "cli" }; } return { value: askAIEnabled, source: "config" }; }, setConfig(value) { askAIEnabled = value; }, id: cliFlag3 }; // src/options/audio-bitrate.tsx import { jsx as jsx4, jsxs as jsxs3, Fragment as Fragment4 } from "react/jsx-runtime"; var cliFlag4 = "audio-bitrate"; var audioBitrate = null; var audioBitrateOption = { name: "Audio Bitrate", cliFlag: cliFlag4, description: () => /* @__PURE__ */ jsxs3(Fragment4, { children: [ "Specify the target bitrate for the generated video. The syntax for FFmpeg", "'", "s ", /* @__PURE__ */ jsx4("code", { children: "-b:a" }), " parameter should be used. FFmpeg may encode the video in a way that will not result in the exact audio bitrate specified. Example values: ", /* @__PURE__ */ jsx4("code", { children: "512K" }), " for 512 kbps, ", /* @__PURE__ */ jsx4("code", { children: "1M" }), " for 1 Mbps. Default: ", /* @__PURE__ */ jsx4("code", { children: "320k" }) ] }), ssrName: "audioBitrate", docLink: "https://www.remotion.dev/docs/renderer/render-media#audiobitrate-", type: "0", getValue: ({ commandLine }) => { if (commandLine[cliFlag4]) { return { value: commandLine[cliFlag4], source: "cli" }; } if (audioBitrate) { return { value: audioBitrate, source: "config file" }; } return { value: null, source: "default" }; }, setConfig: (value) => { audioBitrate = value; }, id: cliFlag4 }; // src/options/separate-audio.tsx var DEFAULT = null; var cliFlag5 = "separate-audio-to"; var separateAudioOption = { cliFlag: cliFlag5, description: () => `If set, the audio will not be included in the main output but rendered as a separate file at the location you pass. It is recommended to use an absolute path. If a relative path is passed, it is relative to the Remotion Root.`, docLink: "https://remotion.dev/docs/renderer/render-media", getValue: ({ commandLine }) => { if (commandLine[cliFlag5]) { return { source: "cli", value: commandLine[cliFlag5] }; } return { source: "default", value: DEFAULT }; }, name: "Separate audio to", setConfig: () => { throw new Error("Not implemented"); }, ssrName: "separateAudioTo", type: "string", id: cliFlag5 }; // src/options/audio-codec.tsx var validAudioCodecs = ["pcm-16", "aac", "mp3", "opus"]; var supportedAudioCodecs = { h264: ["aac", "pcm-16", "mp3"], "h264-mkv": ["pcm-16", "mp3"], "h264-ts": ["pcm-16", "aac"], aac: ["aac", "pcm-16"], avi: [], gif: [], h265: ["aac", "pcm-16"], av1: ["aac", "opus", "pcm-16"], mp3: ["mp3", "pcm-16"], prores: ["aac", "pcm-16"], vp8: ["opus", "pcm-16"], vp9: ["opus", "pcm-16"], wav: ["pcm-16"] }; var _satisfies = supportedAudioCodecs; if (_satisfies) {} var cliFlag6 = "audio-codec"; var ssrName = "audioCodec"; var defaultAudioCodecs = { "h264-mkv": { lossless: "pcm-16", compressed: "pcm-16" }, "h264-ts": { lossless: "pcm-16", compressed: "aac" }, aac: { lossless: "pcm-16", compressed: "aac" }, gif: { lossless: null, compressed: null }, h264: { lossless: "pcm-16", compressed: "aac" }, h265: { lossless: "pcm-16", compressed: "aac" }, av1: { lossless: "pcm-16", compressed: "aac" }, mp3: { lossless: "pcm-16", compressed: "mp3" }, prores: { lossless: "pcm-16", compressed: "pcm-16" }, vp8: { lossless: "pcm-16", compressed: "opus" }, vp9: { lossless: "pcm-16", compressed: "opus" }, wav: { lossless: "pcm-16", compressed: "pcm-16" } }; var extensionMap = { aac: "aac", mp3: "mp3", opus: "opus", "pcm-16": "wav" }; var getExtensionFromAudioCodec = (audioCodec) => { if (extensionMap[audioCodec]) { return extensionMap[audioCodec]; } throw new Error(`Unsupported audio codec: ${audioCodec}`); }; var resolveAudioCodec = ({ codec, setting, preferLossless, separateAudioTo }) => { let derivedFromSeparateAudioToExtension = null; if (separateAudioTo) { const extension = separateAudioTo.split(".").pop(); for (const [key, value] of Object.entries(extensionMap)) { if (value === extension) { derivedFromSeparateAudioToExtension = key; if (!supportedAudioCodecs[codec].includes(derivedFromSeparateAudioToExtension) && derivedFromSeparateAudioToExtension) { throw new Error(`The codec is ${codec} but the audio codec derived from --${separateAudioOption.cliFlag} is ${derivedFromSeparateAudioToExtension}. The only supported codecs are: ${supportedAudioCodecs[codec].join(", ")}`); } } } } if (preferLossless) { const selected = getDefaultAudioCodec({ codec, preferLossless }); if (derivedFromSeparateAudioToExtension && selected !== derivedFromSeparateAudioToExtension) { throw new Error(`The audio codec derived from --${separateAudioOption.cliFlag} is ${derivedFromSeparateAudioToExtension}, but does not match the audio codec derived from the "Prefer lossless" option (${selected}). Remove any conflicting options.`); } return selected; } if (setting === null) { if (derivedFromSeparateAudioToExtension) { return derivedFromSeparateAudioToExtension; } return getDefaultAudioCodec({ codec, preferLossless }); } if (derivedFromSeparateAudioToExtension !== setting && derivedFromSeparateAudioToExtension) { throw new Error(`The audio codec derived from --${separateAudioOption.cliFlag} is ${derivedFromSeparateAudioToExtension}, but does not match the audio codec derived from your ${audioCodecOption.name} setting (${setting}). Remove any conflicting options.`); } return setting; }; var getDefaultAudioCodec = ({ codec, preferLossless }) => { return defaultAudioCodecs[codec][preferLossless ? "lossless" : "compressed"]; }; var _audioCodec = null; var audioCodecOption = { cliFlag: cliFlag6, setConfig: (audioCodec) => { if (audioCodec === null) { _audioCodec = null; return; } if (!validAudioCodecs.includes(audioCodec)) { throw new Error(`Audio codec must be one of the following: ${validAudioCodecs.join(", ")}, but got ${audioCodec}`); } _audioCodec = audioCodec; }, getValue: ({ commandLine }) => { if (commandLine[cliFlag6]) { const codec = commandLine[cliFlag6]; if (!validAudioCodecs.includes(commandLine[cliFlag6])) { throw new Error(`Audio codec must be one of the following: ${validAudioCodecs.join(", ")}, but got ${codec}`); } return { source: "cli", value: commandLine[cliFlag6] }; } if (_audioCodec !== null) { return { source: "config", value: _audioCodec }; } return { source: "default", value: null }; }, description: () => `Set the format of the audio that is embedded in the video. Not all codec and audio codec combinations are supported and certain combinations require a certain file extension and container format. See the table in the docs to see possible combinations.`, docLink: "https://www.remotion.dev/docs/encoding/#audio-codec", name: "Audio Codec", ssrName, type: "aac", id: cliFlag6 }; // src/options/beep-on-finish.tsx import { jsx as jsx5, Fragment as Fragment5 } from "react/jsx-runtime"; var beepOnFinish = false; var cliFlag7 = "beep-on-finish"; var beepOnFinishOption = { name: "Beep on finish", cliFlag: cliFlag7, description: () => /* @__PURE__ */ jsx5(Fragment5, { children: "Whether the Remotion Studio tab should beep when the render is finished." }), ssrName: null, docLink: "https://www.remotion.dev/docs/config#setbeeponfinish", type: false, getValue: ({ commandLine }) => { if (commandLine[cliFlag7] !== undefined) { return { value: commandLine[cliFlag7], source: "cli" }; } if (beepOnFinish !== false) { return { value: beepOnFinish, source: "config" }; } return { value: false, source: "default" }; }, setConfig(value) { beepOnFinish = value; }, id: cliFlag7 }; // src/options/benchmark-concurrencies.tsx import { jsx as jsx6, jsxs as jsxs4, Fragment as Fragment6 } from "react/jsx-runtime"; var currentConcurrencies = null; var cliFlag8 = "concurrencies"; var benchmarkConcurrenciesOption = { name: "Benchmark concurrencies", cliFlag: cliFlag8, description: () => /* @__PURE__ */ jsxs4(Fragment6, { children: [ "Specify which concurrency values should be used while benchmarking. Multiple values can be passed separated by comma. Learn more about", " ", /* @__PURE__ */ jsx6("a", { href: "https://remotion.dev/docs/terminology/concurrency", children: "concurrency" }), "." ] }), ssrName: null, docLink: "https://www.remotion.dev/docs/cli/benchmark#--concurrencies", type: null, getValue: ({ commandLine }) => { if (commandLine[cliFlag8] !== undefined) { return { value: commandLine[cliFlag8], source: "cli" }; } if (currentConcurrencies !== null) { return { value: currentConcurrencies, source: "config" }; } return { value: null, source: "default" }; }, setConfig: (value) => { currentConcurrencies = value; }, id: cliFlag8 }; // src/options/binaries-directory.tsx import { jsx as jsx7, jsxs as jsxs5, Fragment as Fragment7 } from "react/jsx-runtime"; var cliFlag9 = "binaries-directory"; var currentDirectory = null; var binariesDirectoryOption = { name: "Binaries Directory", cliFlag: cliFlag9, description: () => /* @__PURE__ */ jsxs5(Fragment7, { children: [ "The directory where the platform-specific binaries and libraries that Remotion needs are located. Those include an ", /* @__PURE__ */ jsx7("code", { children: "ffmpeg" }), " and", " ", /* @__PURE__ */ jsx7("code", { children: "ffprobe" }), " binary, a Rust binary for various tasks, and various shared libraries. If the value is set to ", /* @__PURE__ */ jsx7("code", { children: "null" }), ", which is the default, then the path of a platform-specific package located at", " ", /* @__PURE__ */ jsx7("code", { children: "node_modules/@remotion/compositor-*" }), " is selected.", /* @__PURE__ */ jsx7("br", {}), "This option is useful in environments where Remotion is not officially supported to run like bundled serverless functions or Electron." ] }), ssrName: "binariesDirectory", docLink: "https://www.remotion.dev/docs/renderer", type: "", getValue: ({ commandLine }) => { if (commandLine[cliFlag9] !== undefined) { return { source: "cli", value: commandLine[cliFlag9] }; } if (currentDirectory !== null) { return { source: "config", value: currentDirectory }; } return { source: "default", value: null }; }, setConfig: (value) => { currentDirectory = value; }, id: cliFlag9 }; // src/options/browser.tsx import { jsx as jsx8, jsxs as jsxs6, Fragment as Fragment8 } from "react/jsx-runtime"; var cliFlag10 = "browser"; var browserOption = { name: "Browser", cliFlag: cliFlag10, description: () => /* @__PURE__ */ jsxs6(Fragment8, { children: [ "Specify the browser which should be used for opening a tab. The default browser will be used by default. Pass an absolute path or", " ", /* @__PURE__ */ jsx8("code", { children: '"chrome"' }), " 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[cliFlag10] !== undefined) { return { source: "cli", value: commandLine[cliFlag10] }; } return { source: "default", value: null }; }, setConfig: () => { throw new Error("setBrowser is not supported. Pass --browser via the CLI instead."); }, type: "", id: cliFlag10 }; // src/options/browser-executable.tsx import { jsx as jsx9, Fragment as Fragment9 } from "react/jsx-runtime"; var currentBrowserExecutablePath = null; var cliFlag11 = "browser-executable"; var browserExecutableOption = { name: "Browser executable", cliFlag: cliFlag11, description: () => /* @__PURE__ */ jsx9(Fragment9, { children: "Set a custom Chrome or Chromium executable path. By default Remotion will try to find an existing version of Chrome on your system and if not found, it will download one. This flag is useful if you don't have Chrome installed in a standard location and you want to prevent downloading an additional browser or need support for the H264 codec." }), ssrName: "browserExecutable", docLink: "https://www.remotion.dev/docs/config#setbrowserexecutable", type: null, getValue: ({ commandLine }) => { if (commandLine[cliFlag11] !== undefined) { return { source: "cli", value: commandLine[cliFlag11] }; } if (currentBrowserExecutablePath !== null) { return { source: "config", value: currentBrowserExecutablePath }; } return { source: "default", value: null }; }, setConfig: (value) => { currentBrowserExecutablePath = value; }, id: cliFlag11 }; // src/options/bundle-cache.tsx import { jsx as jsx10, jsxs as jsxs7, Fragment as Fragment10 } from "react/jsx-runtime"; var cliFlag12 = "bundle-cache"; var cachingEnabled = true; var bundleCacheOption = { name: "Webpack Bundle Caching", cliFlag: cliFlag12, description: () => /* @__PURE__ */ jsxs7(Fragment10, { children: [ "Enable or disable Webpack caching. This flag is enabled by default, use", " ", /* @__PURE__ */ jsx10("code", { children: "--bundle-cache=false" }), " to disable caching." ] }), ssrName: null, docLink: "https://www.remotion.dev/docs/config#setcachingenabled", getValue: ({ commandLine }) => { if (commandLine[cliFlag12] !== undefined && commandLine[cliFlag12] !== null) { return { source: "cli", value: Boolean(commandLine[cliFlag12]) }; } return { source: cachingEnabled ? "default" : "config", value: cachingEnabled }; }, setConfig: (value) => { if (typeof value !== "boolean") { throw new TypeError(`Value for "${cliFlag12}" must be a boolean, but got ${typeof value}.`); } cachingEnabled = value; }, type: true, id: cliFlag12 }; // src/options/chrome-mode.tsx import { jsx as jsx11, jsxs as jsxs8, Fragment as Fragment11 } from "react/jsx-runtime"; var validChromeModeOptions = [ "headless-shell", "chrome-for-testing" ]; var cliFlag13 = "chrome-mode"; var configSelection = null; var chromeModeOption = { cliFlag: cliFlag13, name: "Chrome Mode", ssrName: "chromeMode", description: () => { return /* @__PURE__ */ jsxs8(Fragment11, { children: [ "One of", " ", validChromeModeOptions.map((option, i) => /* @__PURE__ */ jsxs8("code", { children: [ option, i === validChromeModeOptions.length - 1 ? "" : ", " ] }, option)), ". Default ", /* @__PURE__ */ jsx11("code", { children: "headless-shell" }), ".", " ", /* @__PURE__ */ jsxs8("a", { href: "https://remotion.dev/docs/miscellaneous/chrome-headless-shell", children: [ "Use ", /* @__PURE__ */ jsx11("code", { children: "chrome-for-testing" }), " to take advantage of GPU drivers on Linux." ] }) ] }); }, docLink: "https://www.remotion.dev/chrome-for-testing", getValue: ({ commandLine }) => { if (commandLine[cliFlag13]) { if (!validChromeModeOptions.includes(commandLine[cliFlag13])) { throw new Error(`Invalid \`--${cliFlag13}\` value passed. Accepted values: ${validChromeModeOptions.map((l) => `'${l}'`).join(", ")}.`); } return { value: commandLine[cliFlag13], source: "cli" }; } if (configSelection !== null) { return { value: configSelection, source: "config" }; } return { value: "headless-shell", source: "default" }; }, setConfig: (newChromeMode) => { configSelection = newChromeMode; }, type: "headless-shell", id: cliFlag13 }; // src/options/color-space.tsx import { NoReactInternals } from "remotion/no-react"; import { jsx as jsx12, jsxs as jsxs9, Fragment as Fragment12 } from "react/jsx-runtime"; var validV4ColorSpaces = ["default", "bt601", "bt709", "bt2020-ncl"]; var validV5ColorSpaces = ["bt601", "bt709", "bt2020-ncl"]; var validColorSpaces = NoReactInternals.ENABLE_V5_BREAKING_CHANGES ? validV5ColorSpaces : validV4ColorSpaces; var DEFAULT_COLOR_SPACE = NoReactInternals.ENABLE_V5_BREAKING_CHANGES ? "bt709" : "default"; var colorSpace = DEFAULT_COLOR_SPACE; var cliFlag14 = "color-space"; var colorSpaceOption = { name: "Color space", cliFlag: "color-space", description: () => /* @__PURE__ */ jsxs9(Fragment12, { children: [ "Color space to use for the video. Acceptable values:", " ", /* @__PURE__ */ jsxs9("code", { children: [ '"', DEFAULT_COLOR_SPACE, '"' ] }), "(default since 5.0),", " ", NoReactInternals.ENABLE_V5_BREAKING_CHANGES ? /* @__PURE__ */ jsxs9("code", { children: [ '"', "bt601", '"', ", " ] }) : /* @__PURE__ */ jsxs9(Fragment12, { children: [ /* @__PURE__ */ jsxs9("code", { children: [ '"', "bt601", '"' ] }), " ", "(same as", " ", /* @__PURE__ */ jsxs9("code", { children: [ '"', "default", '"' ] }), ", since v4.0.424),", " ", /* @__PURE__ */ jsxs9("code", { children: [ '"', "bt709", '"' ] }), " ", "(since v4.0.28),", " " ] }), /* @__PURE__ */ jsxs9("code", { children: [ '"', "bt2020-ncl", '"' ] }), " ", "(since v4.0.88),", " ", /* @__PURE__ */ jsxs9("code", { children: [ '"', "bt2020-cl", '"' ] }), " ", "(since v4.0.88), .", /* @__PURE__ */ jsx12("br", {}), "For best color accuracy, it is recommended to also use", " ", /* @__PURE__ */ jsxs9("code", { children: [ '"', "png", '"' ] }), " ", "as the image format to have accurate color transformations throughout.", /* @__PURE__ */ jsx12("br", {}), "Only since v4.0.83, colorspace conversion is actually performed, previously it would only tag the metadata of the video." ] }), docLink: "https://www.remotion.dev/docs/renderer/render-media#colorspace", ssrName: "colorSpace", type: DEFAULT_COLOR_SPACE, getValue: ({ commandLine }) => { if (commandLine[cliFlag14] !== undefined) { return { source: "cli", value: commandLine[cliFlag14] }; } if (colorSpace !== DEFAULT_COLOR_SPACE) { return { source: "config", value: colorSpace }; } return { source: "default", value: DEFAULT_COLOR_SPACE }; }, setConfig: (value) => { colorSpace = value ?? DEFAULT_COLOR_SPACE; }, id: cliFlag14 }; // src/options/concurrency.tsx import { jsx as jsx13, jsxs as jsxs10, Fragment as Fragment13 } from "react/jsx-runtime"; var currentConcurrency = null; var cliFlag15 = "concurrency"; var validateConcurrencyValue = (value, setting) => { if (typeof value === "undefined" || value === null) { return; } if (typeof value !== "number" && typeof value !== "string") { throw new Error(setting + " must a number or a string but is " + value); } if (typeof value === "number") { if (value % 1 !== 0) { throw new Error(setting + " must be an integer, but is " + value); } } else if (!/^\d+(\.\d+)?%$/.test(value)) { throw new Error(`${setting} must be a number or percentage, but is ${JSON.stringify(value)}`); } }; var concurrencyOption = { name: "Concurrency", cliFlag: cliFlag15, description: () => /* @__PURE__ */ jsxs10(Fragment13, { children: [ "How many CPU threads to use. Minimum 1. The maximum is the amount of threads you have (In Node.JS ", /* @__PURE__ */ jsx13("code", { children: "os.cpus().length" }), "). You can also provide a percentage value (e.g. ", /* @__PURE__ */ jsx13("code", { children: "50%" }), ")." ] }), ssrName: "concurrency", docLink: "https://www.remotion.dev/docs/config#setconcurrency", type: null, getValue: ({ commandLine }) => { if (commandLine[cliFlag15] !== undefined) { const value = commandLine[cliFlag15]; validateConcurrencyValue(value, "concurrency"); return { source: "cli", value }; } if (currentConcurrency !== null) { return { source: "config", value: currentConcurrency }; } return { source: "default", value: null }; }, setConfig: (value) => { validateConcurrencyValue(value, "Config.setConcurrency"); currentConcurrency = value; }, id: cliFlag15 }; // src/options/config.tsx import { jsx as jsx14, Fragment as Fragment14 } from "react/jsx-runtime"; var cliFlag16 = "config"; var configOption = { name: "Config file", cliFlag: cliFlag16, description: () => /* @__PURE__ */ jsx14(Fragment14, { children: "Specify a location for the Remotion config file." }), ssrName: null, docLink: "https://www.remotion.dev/docs/config", getValue: ({ commandLine }) => { if (commandLine[cliFlag16] !== undefined) { return { source: "cli", value: commandLine[cliFlag16] }; } return { source: "default", value: null }; }, setConfig: () => { throw new Error("setConfig is not supported. Pass --config via the CLI instead."); }, type: "", id: cliFlag16 }; // src/options/crf.tsx import { jsx as jsx15, Fragment as Fragment15 } from "react/jsx-runtime"; var currentCrf; var validateCrf = (newCrf) => { if (typeof newCrf !== "number" && newCrf !== undefined) { throw new TypeError("The CRF must be a number or undefined."); } }; var cliFlag17 = "crf"; var crfOption = { name: "CRF", cliFlag: cliFlag17, description: () => /* @__PURE__ */ jsx15(Fragment15, { children: "No matter which codec you end up using, there's always a tradeoff between file size and video quality. You can control it by setting the CRF (Constant Rate Factor). The lower the number, the better the quality, the higher the number, the smaller the file is – of course at the cost of quality." }), ssrName: "crf", docLink: "https://www.remotion.dev/docs/encoding/#controlling-quality-using-the-crf-setting", type: 0, getValue: ({ commandLine }) => { if (commandLine[cliFlag17] !== undefined) { validateCrf(commandLine[cliFlag17]); return { source: "cli", value: commandLine[cliFlag17] }; } if (currentCrf !== null) { return { source: "config", value: currentCrf }; } return { source: "default", value: undefined }; }, setConfig: (crf) => { validateCrf(crf); currentCrf = crf; }, id: cliFlag17 }; // src/options/cross-site-isolation.tsx import { jsx as jsx16, jsxs as jsxs11, Fragment as Fragment16 } from "react/jsx-runtime"; var enableCrossSiteIsolation = false; var cliFlag18 = "cross-site-isolation"; var enableCrossSiteIsolationOption = { name: "Enable Cross-Site Isolation", cliFlag: cliFlag18, description: () => /* @__PURE__ */ jsxs11(Fragment16, { children: [ "Enable Cross-Site Isolation in the Studio (sets Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy HTTP headers, required for", " ", /* @__PURE__ */ jsx16("code", { children: "@remotion/whisper-web" }), ")." ] }), ssrName: null, docLink: "https://www.remotion.dev/docs/config#setenablecrosssiteisolation", type: false, getValue: ({ commandLine }) => { if (commandLine[cliFlag18] !== undefined) { return { value: commandLine[cliFlag18], source: "cli" }; } return { value: enableCrossSiteIsolation, source: "config" }; }, setConfig(value) { enableCrossSiteIsolation = value; }, id: cliFlag18 }; // src/options/dark-mode.tsx import { jsx as jsx17, jsxs as jsxs12, Fragment as Fragment17 } from "react/jsx-runtime"; var DEFAULT_VALUE = false; var darkMode = DEFAULT_VALUE; var cliFlag19 = "dark-mode"; var darkModeOption = { name: "Dark Mode", cliFlag: cliFlag19, description: () => /* @__PURE__ */ jsxs12(Fragment17, { children: [ "Whether Chromium should pretend to be in dark mode by emulating the media feature 'prefers-color-scheme: dark'. Default is", " ", /* @__PURE__ */ jsx17("code", { children: String(DEFAULT_VALUE) }), "." ] }), ssrName: "darkMode", docLink: "https://www.remotion.dev/docs/chromium-flags#--dark-mode", type: false, getValue: ({ commandLine }) => { if (commandLine[cliFlag19] !== undefined) { return { source: "cli", value: commandLine[cliFlag19] }; } if (darkMode !== DEFAULT_VALUE) { return { source: "config", value: darkMode }; } return { source: "default", value: DEFAULT_VALUE }; }, setConfig: (value) => { darkMode = value; }, id: cliFlag19 }; // src/options/delete-after.tsx import { jsx as jsx18, jsxs as jsxs13, Fragment as Fragment18 } from "react/jsx-runtime"; var cliFlag20 = "delete-after"; var deleteAfter = null; var deleteAfterOption = { name: "Lambda render expiration", cliFlag: cliFlag20, description: () => { return /* @__PURE__ */ jsxs13(Fragment18, { children: [ "Automatically delete the render after a certain period. Accepted values are ", /* @__PURE__ */ jsx18("code", { children: "1-day" }), ", ", /* @__PURE__ */ jsx18("code", { children: "3-days" }), ", ", /* @__PURE__ */ jsx18("code", { children: "7-days" }), " and", " ", /* @__PURE__ */ jsx18("code", { children: "30-days" }), ".", /* @__PURE__ */ jsx18("br", {}), " For this to work, your bucket needs to have", " ", /* @__PURE__ */ jsx18("a", { href: "/docs/lambda/autodelete", children: "lifecycles enabled" }), "." ] }); }, ssrName: "deleteAfter", docLink: "https://www.remotion.dev/docs/lambda/autodelete", type: "1-day", getValue: ({ commandLine }) => { if (commandLine[cliFlag20] !== undefined) { return { source: "cli", value: commandLine[cliFlag20] }; } if (deleteAfter !== null) { return { source: "config", value: deleteAfter }; } return { source: "default", value: null }; }, setConfig: (value) => { deleteAfter = value; }, id: cliFlag20 }; // src/options/disable-git-source.tsx var DEFAULT2 = false; var cliFlag21 = "disable-git-source"; var disableGitSourceOption = { cliFlag: cliFlag21, description: () => `Disables the Git Source being connected to the Remotion Studio. Clicking on stack traces and certain menu items will be disabled.`, docLink: "https://remotion.dev/docs/bundle", getValue: ({ commandLine }) => { if (commandLine[cliFlag21]) { return { source: "cli", value: commandLine[cliFlag21] }; } return { source: "default", value: DEFAULT2 }; }, name: "Disable Git source", setConfig: () => { throw new Error("Not implemented"); }, ssrName: "disableGitSource", type: false, id: cliFlag21 }; // src/options/disable-web-security.tsx import { jsx as jsx19, Fragment as Fragment19 } from "react/jsx-runtime"; var disableWebSecurity = false; var cliFlag22 = "disable-web-security"; var disableWebSecurityOption = { name: "Disable web security", cliFlag: cliFlag22, description: () => /* @__PURE__ */ jsx19(Fragment19, { children: "This will most notably disable CORS in Chrome among other security features." }), ssrName: "disableWebSecurity", docLink: "https://www.remotion.dev/docs/chromium-flags#--disable-web-security", type: false, getValue: ({ commandLine }) => { if (commandLine[cliFlag22] !== undefined) { return { source: "cli", value: Boolean(commandLine[cliFlag22]) }; } if (disableWebSecurity) { return { source: "config", value: disableWebSecurity }; } return { source: "default", value: false }; }, setConfig: (value) => { disableWebSecurity = value; }, id: cliFlag22 }; // src/options/disallow-parallel-encoding.tsx import { jsx as jsx20, Fragment as Fragment20 } from "react/jsx-runtime"; var disallowParallelEncoding = false; var cliFlag23 = "disallow-parallel-encoding"; var disallowParallelEncodingOption = { name: "Disallow parallel encoding", cliFlag: cliFlag23, description: () => /* @__PURE__ */ jsx20(Fragment20, { children: "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, getValue: ({ commandLine }) => { if (commandLine[cliFlag23] !== undefined) { return { value: commandLine[cliFlag23], source: "cli" }; } if (disallowParallelEncoding !== false) { return { value: disallowParallelEncoding, source: "config" }; } return { value: false, source: "default" }; }, setConfig(value) { disallowParallelEncoding = value; }, id: cliFlag23 }; // src/options/enable-lambda-insights.tsx import { jsx as jsx21, jsxs as jsxs14, Fragment as Fragment21 } from "react/jsx-runtime"; var cliFlag24 = "enable-lambda-insights"; var option = false; var enableLambdaInsights = { name: "Enable Lambda Insights", cliFlag: cliFlag24, description: () => /* @__PURE__ */ jsxs14(Fragment21, { children: [ "Enable", " ", /* @__PURE__ */ jsx21("a", { href: "https://remotion.dev/docs/lambda/insights", children: "Lambda Insights in AWS CloudWatch" }), ". For this to work, you may have to update your role permission." ] }), ssrName: "enableLambdaInsights", docLink: "https://www.remotion.dev/docs/lambda/insights", type: false, setConfig: (value) => { option = value; }, getValue: ({ commandLine }) => { if (commandLine[cliFlag24] !== undefined) { return { value: commandLine[cliFlag24], source: "cli" }; } if (option) { return { value: option, source: "config" }; } return { value: false, source: "default" }; }, id: cliFlag24 }; // src/options/enable-multiprocess-on-linux.tsx import { jsx as jsx22, jsxs as jsxs15, Fragment as Fragment22 } from "react/jsx-runtime"; var DEFAULT_VALUE2 = true; var multiProcessOnLinux = DEFAULT_VALUE2; var cliFlag25 = "enable-multiprocess-on-linux"; var enableMultiprocessOnLinuxOption = { name: "Enable Multiprocess on Linux", cliFlag: cliFlag25, description: () => /* @__PURE__ */ jsxs15(Fragment22, { children: [ "Removes the ", /* @__PURE__ */ jsx22("code", { children: "--single-process" }), " flag that gets passed to Chromium on Linux by default. This will make the render faster because multiple processes can be used, but may cause issues with some Linux distributions or if window server libraries are missing.", /* @__PURE__ */ jsx22("br", {}), "Default: ", /* @__PURE__ */ jsx22("code", { children: "false" }), " until v4.0.136, then ", /* @__PURE__ */ jsx22("code", { children: "true" }), " from v4.0.137 on because newer Chrome versions ", "don't", " allow rendering with the ", /* @__PURE__ */ jsx22("code", { children: "--single-process" }), " flag. ", /* @__PURE__ */ jsx22("br", {}), "This flag will be removed in Remotion v5.0." ] }), ssrName: "chromiumOptions.enableMultiprocessOnLinux", docLink: "https://www.remotion.dev/docs/chromium-flags", type: false, getValue: ({ commandLine }) => { if (commandLine[cliFlag25] !== undefined) { return { source: "cli", value: commandLine[cliFlag25] }; } if (multiProcessOnLinux !== false) { return { source: "config", value: multiProcessOnLinux }; } return { source: "default", value: DEFAULT_VALUE2 }; }, setConfig: (value) => { multiProcessOnLinux = value; }, id: cliFlag25 }; // src/options/encoding-buffer-size.tsx import { jsx as jsx23, jsxs as jsxs16, Fragment as Fragment23 } from "react/jsx-runtime"; var encodingBufferSize = null; var setEncodingBufferSize = (bitrate) => { encodingBufferSize = bitrate; }; var cliFlag26 = "buffer-size"; var encodingBufferSizeOption = { name: "FFmpeg -bufsize flag", cliFlag: cliFlag26, description: () => /* @__PURE__ */ jsxs16(Fragment23, { children: [ "The value for the ", /* @__PURE__ */ jsx23("code", { children: "-bufsize" }), " flag of FFmpeg. Should be used in conjunction with the encoding max rate flag." ] }), ssrName: "encodingBufferSize", docLink: "https://www.remotion.dev/docs/renderer/render-media#encodingbuffersize", type: "", getValue: ({ commandLine }) => { if (commandLine[cliFlag26] !== undefined) { return { value: commandLine[cliFlag26], source: "cli" }; } if (encodingBufferSize !== null) { return { value: encodingBufferSize, source: "config" }; } return { value: null, source: "default" }; }, setConfig: setEncodingBufferSize, id: cliFlag26 }; // src/options/encoding-max-rate.tsx import { jsx as jsx24, jsxs as jsxs17, Fragment as Fragment24 } from "react/jsx-runtime"; var encodingMaxRate = null; var cliFlag27 = "max-rate"; var encodingMaxRateOption = { name: "FFmpeg -maxrate flag", cliFlag: cliFlag27, description: () => /* @__PURE__ */ jsxs17(Fragment24, { children: [ "The value for the ", /* @__PURE__ */ jsx24("code", { children: "-maxrate" }), " flag of FFmpeg. Should be used in conjunction with the encoding buffer size flag." ] }), ssrName: "encodingMaxRate", docLink: "https://www.remotion.dev/docs/renderer/render-media#encodingmaxrate", type: "", getValue: ({ commandLine }) => { if (commandLine[cliFlag27] !== undefined) { return { value: commandLine[cliFlag27], source: "cli" }; } if (encodingMaxRate !== null) { return { value: encodingMaxRate, source: "config" }; } return { value: null, source: "default" }; }, setConfig: (newMaxRate) => { encodingMaxRate = newMaxRate; }, id: cliFlag27 }; // src/options/enforce-audio.tsx import { jsx as jsx25, Fragment as Fragment25 } from "react/jsx-runtime"; var DEFAULT_ENFORCE_AUDIO_TRACK = false; var enforceAudioTrackState = DEFAULT_ENFORCE_AUDIO_TRACK; var cliFlag28 = "enforce-audio-track"; var enforceAudioOption = { name: "Enforce Audio Track", cliFlag: cliFlag28, description: () => /* @__PURE__ */ jsx25(Fragment25, { children: "Render a silent audio track if there would be none otherwise." }), ssrName: "enforceAudioTrack", docLink: "https://www.remotion.dev/docs/config#setenforceaudiotrack-", type: false, getValue: ({ commandLine }) => { if (commandLine[cliFlag28]) { return { source: "cli", value: true }; } if (enforceAudioTrackState !== DEFAULT_ENFORCE_AUDIO_TRACK) { return { source: "config", value: enforceAudioTrackState }; } return { source: "default", value: DEFAULT_ENFORCE_AUDIO_TRACK }; }, setConfig: (value) => { enforceAudioTrackState = value; }, id: cliFlag28 }; // src/options/env-file.tsx import { jsx as jsx26, jsxs as jsxs18, Fragment as Fragment26 } from "react/jsx-runtime"; var cliFlag29 = "env-file"; var envFileLocation = null; var envFileOption = { name: "Env File", cliFlag: cliFlag29, description: () => /* @__PURE__ */ jsxs18(Fragment26, { children: [ "Specify a location for a dotenv file. Default ", /* @__PURE__ */ jsx26("code", { children: ".env" }), "." ] }), ssrName: null, docLink: "https://www.remotion.dev/docs/cli/render#--env-file", getValue: ({ commandLine }) => { if (commandLine[cliFlag29] !== undefined) { return { source: "cli", value: commandLine[cliFlag29] }; } if (envFileLocation !== null) { return { source: "config", value: envFileLocation }; } return { source: "default", value: null }; }, setConfig: (value) => { envFileLocation = value; }, type: "", id: cliFlag29 }; // src/options/every-nth-frame.tsx import { jsx as jsx27, jsxs as jsxs19, Fragment as Fragment27 } from "react/jsx-runtime"; var DEFAULT_EVERY_NTH_FRAME = 1; var everyNthFrame = DEFAULT_EVERY_NTH_FRAME; var cliFlag30 = "every-nth-frame"; var everyNthFrameOption = { name: "Every nth frame", cliFlag: cliFlag30, description: () => /* @__PURE__ */ jsxs19(Fragment27, { children: [ "This option may only be set when rendering GIFs. It determines how many frames are rendered, while the other ones get skipped in order to lower the FPS of the GIF. For example, if the ", /* @__PURE__ */ jsx27("code", { children: "fps" }), " is 30, and", " ", /* @__PURE__ */ jsx27("code", { children: "everyNthFrame" }), " is 2, the FPS of the GIF is ", /* @__PURE__ */ jsx27("code", { children: "15" }), "." ] }), ssrName: "everyNthFrame", docLink: "https://www.remotion.dev/docs/config#seteverynthframe", type: DEFAULT_EVERY_NTH_FRAME, getValue: ({ commandLine }) => { if (commandLine[cliFlag30] !== undefined) { return { source: "cli", value: commandLine[cliFlag30] }; } if (everyNthFrame !== DEFAULT_EVERY_NTH_FRAME) { return { source: "config", value: everyNthFrame }; } return { source: "default", value: DEFAULT_EVERY_NTH_FRAME }; }, setConfig: (value) => { everyNthFrame = value; }, id: cliFlag30 }; // src/options/experimental-client-side-rendering.tsx import { jsx as jsx28, Fragment as Fragment28 } from "react/jsx-runtime"; var experimentalClientSideRenderingEnabled = false; var c