Add .gitignore to exclude all node packages and lock files

This commit is contained in:
Adolfo Reyna
2026-02-23 21:56:04 -05:00
parent faae96c9ed
commit dcc5c6c044
9747 changed files with 1555105 additions and 2 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,363 @@
// src/chalk/is-color-supported.ts
import * as tty from "tty";
var isColorSupported = () => {
const env = process.env || {};
const isForceDisabled = "NO_COLOR" in env;
if (isForceDisabled) {
return false;
}
const isForced = "FORCE_COLOR" in env;
if (isForced) {
return true;
}
const isWindows = process.platform === "win32";
const isCompatibleTerminal = tty?.isatty?.(1) && env.TERM && env.TERM !== "dumb";
const isCI = "CI" in env && (("GITHUB_ACTIONS" in env) || ("GITLAB_CI" in env) || ("CIRCLECI" in env));
return isWindows || isCompatibleTerminal || isCI;
};
// src/chalk/index.ts
var chalk = (() => {
const colors = {
enabled: () => isColorSupported(),
visible: true,
styles: {},
keys: {}
};
const ansi = (st) => {
const open = `\x1B[${st.codes[0]}m`;
const close = `\x1B[${st.codes[1]}m`;
const regex = new RegExp(`\\u001b\\[${st.codes[1]}m`, "g");
st.wrap = (input, newline) => {
if (input.includes(close))
input = input.replace(regex, close + open);
const output = open + input + close;
return newline ? output.replace(/\r*\n/g, `${close}$&${open}`) : output;
};
return st;
};
const wrap = (sty, input, newline) => {
return sty.wrap?.(input, newline);
};
const style = (input, stack) => {
if (input === "" || input === null || input === undefined)
return "";
if (colors.enabled() === false)
return input;
if (colors.visible === false)
return "";
let str = String(input);
const nl = str.includes(`
`);
let n = stack.length;
while (n-- > 0)
str = wrap(colors.styles[stack[n]], str, nl);
return str;
};
const define = (name, codes, type) => {
colors.styles[name] = ansi({ name, codes });
const keys = colors.keys[type] || (colors.keys[type] = []);
keys.push(name);
Reflect.defineProperty(colors, name, {
configurable: true,
enumerable: true,
set(value) {
colors.alias?.(name, value);
},
get() {
const color = (input) => style(input, color.stack);
Reflect.setPrototypeOf(color, colors);
color.stack = this.stack ? this.stack.concat(name) : [name];
return color;
}
});
};
define("reset", [0, 0], "modifier");
define("bold", [1, 22], "modifier");
define("dim", [2, 22], "modifier");
define("italic", [3, 23], "modifier");
define("underline", [4, 24], "modifier");
define("inverse", [7, 27], "modifier");
define("hidden", [8, 28], "modifier");
define("strikethrough", [9, 29], "modifier");
define("black", [30, 39], "color");
define("red", [31, 39], "color");
define("green", [32, 39], "color");
define("yellow", [33, 39], "color");
define("blue", [34, 39], "color");
define("magenta", [35, 39], "color");
define("cyan", [36, 39], "color");
define("white", [37, 39], "color");
define("gray", [90, 39], "color");
define("grey", [90, 39], "color");
define("bgBlack", [40, 49], "bg");
define("bgRed", [41, 49], "bg");
define("bgGreen", [42, 49], "bg");
define("bgYellow", [43, 49], "bg");
define("bgBlue", [44, 49], "bg");
define("bgMagenta", [45, 49], "bg");
define("bgWhite", [47, 49], "bg");
define("blackBright", [90, 39], "bright");
define("redBright", [91, 39], "bright");
define("greenBright", [92, 39], "bright");
define("yellowBright", [93, 39], "bright");
define("blueBright", [94, 39], "bright");
define("magentaBright", [95, 39], "bright");
define("whiteBright", [97, 39], "bright");
define("bgBlackBright", [100, 49], "bgBright");
define("bgRedBright", [101, 49], "bgBright");
define("bgGreenBright", [102, 49], "bgBright");
define("bgYellowBright", [103, 49], "bgBright");
define("bgBlueBright", [104, 49], "bgBright");
define("bgMagentaBright", [105, 49], "bgBright");
define("bgWhiteBright", [107, 49], "bgBright");
colors.alias = (name, color) => {
const fn = colors[color];
if (typeof fn !== "function") {
throw new TypeError("Expected alias to be the name of an existing color (string) or a function");
}
if (!fn.stack) {
Reflect.defineProperty(fn, "name", { value: name });
colors.styles[name] = fn;
fn.stack = [name];
}
Reflect.defineProperty(colors, name, {
configurable: true,
enumerable: true,
set(value) {
colors.alias?.(name, value);
},
get() {
const col = (input) => style(input, col.stack);
Reflect.setPrototypeOf(col, colors);
col.stack = this.stack ? this.stack.concat(fn.stack) : fn.stack;
return col;
}
});
};
return colors;
})();
// src/log-level.ts
var logLevels = ["trace", "verbose", "info", "warn", "error"];
var getNumberForLogLevel = (level) => {
return logLevels.indexOf(level);
};
var isEqualOrBelowLogLevel = (currentLevel, level) => {
return getNumberForLogLevel(currentLevel) <= getNumberForLogLevel(level);
};
// src/repro.ts
import { VERSION } from "remotion/version";
var reproWriteInstance = null;
var getReproWriter = () => {
if (!reproWriteInstance) {
throw new Error("reproWriteInstance is not initialized");
}
return reproWriteInstance;
};
var writeInRepro = (level, ...args) => {
if (isReproEnabled()) {
getReproWriter().writeLine(level, ...args);
}
};
var shouldRepro = false;
var isReproEnabled = () => shouldRepro;
// src/truthy.ts
function truthy(value) {
return Boolean(value);
}
// src/logger.ts
var INDENT_TOKEN = chalk.gray("│");
var verboseTag = (str) => {
return isColorSupported() ? chalk.bgBlack(` ${str} `) : `[${str}]`;
};
var Log = {
formatLogs: (logLevel, options, args) => {
return [
options.indent ? INDENT_TOKEN : null,
options.tag ? verboseTag(options.tag) : null
].filter(truthy).concat(args.map((a) => {
if (logLevel === "warn") {
return chalk.yellow(a);
}
if (logLevel === "error") {
return chalk.red(a);
}
if (logLevel === "verbose" || logLevel === "trace") {
return chalk.gray(a);
}
return a;
}));
},
trace: (options, ...args) => {
writeInRepro("trace", ...args);
if (isEqualOrBelowLogLevel(options.logLevel, "trace")) {
if (args.length === 0) {
return process.stdout.write(`
`);
}
return console.log(...Log.formatLogs("trace", options, args));
}
},
verbose: (options, ...args) => {
writeInRepro("verbose", ...args);
if (isEqualOrBelowLogLevel(options.logLevel, "verbose")) {
if (args.length === 0) {
return process.stdout.write(`
`);
}
return console.log(...Log.formatLogs("verbose", options, args));
}
},
info: (options, ...args) => {
writeInRepro("info", ...args);
if (isEqualOrBelowLogLevel(options.logLevel, "info")) {
if (args.length === 0) {
return process.stdout.write(`
`);
}
return console.log(...Log.formatLogs("info", options, args));
}
},
warn: (options, ...args) => {
writeInRepro("warn", ...args);
if (isEqualOrBelowLogLevel(options.logLevel, "warn")) {
if (args.length === 0) {
return process.stdout.write(`
`);
}
return console.warn(...Log.formatLogs("warn", options, args));
}
},
error: (options, ...args) => {
writeInRepro("error", ...args);
if (isEqualOrBelowLogLevel(options.logLevel, "error")) {
if (args.length === 0) {
return process.stdout.write(`
`);
}
return console.error(...Log.formatLogs("error", options, args));
}
}
};
// src/print-useful-error-message.ts
var alreadyPrintedCache = [];
var printUsefulErrorMessage = (err, logLevel, indent) => {
const errorStack = err.stack;
if (errorStack && alreadyPrintedCache.includes(errorStack)) {
return;
}
if (errorStack) {
alreadyPrintedCache.push(errorStack);
alreadyPrintedCache = alreadyPrintedCache.slice(-10);
}
if (err.message.includes("Could not play video with")) {
Log.info({ indent, logLevel });
Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue at https://remotion.dev/docs/media-playback-error");
}
if (err.message.includes("A delayRender()") && err.message.includes("was called but not cleared after")) {
Log.info({ indent, logLevel });
if (err.message.includes("/proxy")) {
Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue at https://remotion.dev/docs/troubleshooting/delay-render-proxy");
}
Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue at https://remotion.dev/docs/timeout");
}
if (err.message.includes("Target closed")) {
Log.info({ indent, logLevel });
Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue at https://remotion.dev/docs/target-closed");
}
if (err.message.includes("Timed out evaluating")) {
Log.info({ indent, logLevel });
Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue at https://remotion.dev/docs/troubleshooting/timed-out-page-function");
}
if (err.message.includes("ENAMETOOLONG")) {
Log.info({ indent, logLevel });
Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue at https://remotion.dev/docs/enametoolong");
}
if (err.message.includes("Member must have value less than or equal to 3008")) {
Log.warn({ indent, logLevel });
Log.warn({ indent, logLevel }, "\uD83D\uDCA1 This error indicates that you have a AWS account on the free or basic tier or have been limited by your organization.");
Log.warn({ indent, logLevel }, "Often times this can be solved by adding a credit card, or if already done, by contacting AWS support.");
Log.warn({
indent,
logLevel
}, "Alternatively, you can decrease the memory size of your Lambda function to a value below 3008 MB. See: https://www.remotion.dev/docs/lambda/runtime#core-count--vcpus");
Log.warn({ indent, logLevel }, "See also: https://repost.aws/questions/QUKruWYNDYTSmP17jCnIz6IQ/questions/QUKruWYNDYTSmP17jCnIz6IQ/unable-to-set-lambda-memory-over-3008mb");
}
if (err.stack?.includes("TooManyRequestsException: Rate Exceeded.") || err.message?.includes("ConcurrentInvocationLimitExceeded")) {
Log.info({ indent, logLevel });
Log.info({ indent, logLevel }, "\uD83D\uDCA1 This error indicates that your Lambda concurrency limit is too low. See: https://www.remotion.dev/docs/lambda/troubleshooting/rate-limit");
}
if (err.message.includes("Error creating WebGL context")) {
Log.info({ indent, logLevel });
Log.warn({
indent,
logLevel
}, '\uD83D\uDCA1 You might need to set the OpenGL renderer to "angle". Learn why at https://www.remotion.dev/docs/three');
Log.warn({
indent,
logLevel
}, "\uD83D\uDCA1 Check how it's done at https://www.remotion.dev/docs/chromium-flags#--gl");
}
if (err.message.includes("The bucket does not allow ACLs")) {
Log.info({ indent, logLevel });
Log.info({ indent, logLevel }, "\uD83D\uDCA1 Fix for this issue: https://remotion.dev/docs/lambda/troubleshooting/bucket-disallows-acl");
}
if (err.message.includes("Minified React error #306")) {
const componentName = err.message.match(/<\w+>/)?.[0];
Log.info({ indent, logLevel }, [
"\uD83D\uDCA1 This error indicates that the component",
componentName ? `(${componentName})` : null,
"you are trying to render is not imported correctly."
].filter(truthy).join(" "));
Log.info({ indent, logLevel });
Log.info({ indent, logLevel }, " Check the root file and ensure that the component is not undefined.");
Log.info({ indent, logLevel }, " Oftentimes, this happens if the component is missing the `export` keyword");
Log.info({ indent, logLevel }, " or if the component was renamed and the import statement not properly adjusted.");
}
if (err.message.includes("GLIBC_")) {
Log.info({ indent, logLevel }, "\uD83D\uDCA1 Remotion requires at least Libc 2.35.");
Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue: https://github.com/remotion-dev/remotion/issues/2439");
}
if (err.message.includes("EBADF")) {
Log.info({ indent, logLevel }, "\uD83D\uDCA1 This error might be fixed by changing your Node version:");
Log.info({ indent, logLevel }, " https://github.com/remotion-dev/remotion/issues/2452");
}
if (err.message.includes("routines::unsupported")) {
Log.info({ indent, logLevel }, "\uD83D\uDCA1 This error might happen if using Cloud Run with credentials that have a newline at the end or are otherwise badly encoded.");
Log.info({ indent, logLevel }, " https://github.com/remotion-dev/remotion/issues/3864");
}
if (err.message.includes("Failed to fetch")) {
Log.info({ indent, logLevel }, "\uD83D\uDCA1 On Lambda, one reason this could happen is that Chrome is rejecting an asset to be loaded when it is running low on disk space.");
Log.info({ indent, logLevel }, "Try increasing the disk size of your Lambda function.");
}
if (err.message.includes("Invalid value specified for cpu")) {
Log.info({ indent, logLevel });
Log.info({ indent, logLevel }, "\uD83D\uDCA1 This error indicates that your GCP account does have a limit. Try setting `--maxInstances=5` / `maxInstances: 5` when deploying this service.");
Log.info({
indent,
logLevel
});
}
};
// src/wrap-with-error-handling.ts
var wrapWithErrorHandling = (fn) => {
return async (...args) => {
try {
return await fn(...args);
} catch (err) {
const { indent } = args[0];
const { logLevel } = args[0];
printUsefulErrorMessage(err, logLevel, indent);
throw err;
}
};
};
export {
wrapWithErrorHandling
};
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,526 @@
// src/is-audio-codec.ts
var isAudioCodec = (codec) => {
return codec === "mp3" || codec === "aac" || codec === "wav";
};
// src/codec-supports-media.ts
var support = {
"h264-mkv": {
audio: true,
video: true
},
aac: {
audio: true,
video: false
},
gif: {
video: true,
audio: false
},
h264: {
video: true,
audio: true
},
"h264-ts": {
video: true,
audio: true
},
h265: {
video: true,
audio: true
},
mp3: {
audio: true,
video: false
},
prores: {
audio: true,
video: true
},
vp8: {
audio: true,
video: true
},
vp9: {
audio: true,
video: true
},
wav: {
audio: true,
video: false
}
};
var codecSupportsMedia = (codec) => {
return support[codec];
};
// src/get-duration-from-frame-range.ts
var getFramesToRender = (frameRange, everyNthFrame) => {
if (everyNthFrame === 0) {
throw new Error("everyNthFrame cannot be 0");
}
return new Array(frameRange[1] - frameRange[0] + 1).fill(true).map((_, index) => {
return index + frameRange[0];
}).filter((index) => {
return index % everyNthFrame === 0;
});
};
// src/codec.ts
var validCodecs = [
"h264",
"h265",
"vp8",
"vp9",
"mp3",
"aac",
"wav",
"prores",
"h264-mkv",
"h264-ts",
"gif"
];
// 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" }
}
},
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;
};
// src/path-normalize.ts
var SLASH = 47;
var DOT = 46;
var assertPath = (path) => {
const t = typeof path;
if (t !== "string") {
throw new TypeError(`Expected a string, got a ${t}`);
}
};
var posixNormalize = (path, allowAboveRoot) => {
let res = "";
let lastSegmentLength = 0;
let lastSlash = -1;
let dots = 0;
let code;
for (let i = 0;i <= path.length; ++i) {
if (i < path.length) {
code = path.charCodeAt(i);
} else if (code === SLASH) {
break;
} else {
code = SLASH;
}
if (code === SLASH) {
if (lastSlash === i - 1 || dots === 1) {} else if (lastSlash !== i - 1 && dots === 2) {
if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== DOT || res.charCodeAt(res.length - 2) !== DOT) {
if (res.length > 2) {
const lastSlashIndex = res.lastIndexOf("/");
if (lastSlashIndex !== res.length - 1) {
if (lastSlashIndex === -1) {
res = "";
lastSegmentLength = 0;
} else {
res = res.slice(0, lastSlashIndex);
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
}
lastSlash = i;
dots = 0;
continue;
}
} else if (res.length === 2 || res.length === 1) {
res = "";
lastSegmentLength = 0;
lastSlash = i;
dots = 0;
continue;
}
}
if (allowAboveRoot) {
if (res.length > 0) {
res += "/..";
} else {
res = "..";
}
lastSegmentLength = 2;
}
} else {
if (res.length > 0) {
res += "/" + path.slice(lastSlash + 1, i);
} else {
res = path.slice(lastSlash + 1, i);
}
lastSegmentLength = i - lastSlash - 1;
}
lastSlash = i;
dots = 0;
} else if (code === DOT && dots !== -1) {
++dots;
} else {
dots = -1;
}
}
return res;
};
var decode = (s) => {
try {
return decodeURIComponent(s);
} catch {
return s;
}
};
var pathNormalize = (p) => {
assertPath(p);
let path = p;
if (path.length === 0) {
return ".";
}
const isAbsolute = path.charCodeAt(0) === SLASH;
const trailingSeparator = path.charCodeAt(path.length - 1) === SLASH;
path = decode(path);
path = posixNormalize(path, !isAbsolute);
if (path.length === 0 && !isAbsolute) {
path = ".";
}
if (path.length > 0 && trailingSeparator) {
path += "/";
}
if (isAbsolute) {
return "/" + path;
}
return path;
};
// src/get-extension-of-filename.ts
var getExtensionOfFilename = (filename) => {
if (filename === null) {
return null;
}
const filenameArr = pathNormalize(filename).split(".");
const hasExtension = filenameArr.length >= 2;
const filenameArrLength = filenameArr.length;
const extension = hasExtension ? filenameArr[filenameArrLength - 1] : null;
return extension;
};
// src/options/separate-audio.tsx
var DEFAULT = null;
var cliFlag = "separate-audio-to";
var separateAudioOption = {
cliFlag,
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[cliFlag]) {
return {
source: "cli",
value: commandLine[cliFlag]
};
}
return {
source: "default",
value: DEFAULT
};
},
name: "Separate audio to",
setConfig: () => {
throw new Error("Not implemented");
},
ssrName: "separateAudioTo",
type: "string"
};
// 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"],
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 cliFlag2 = "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"
},
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 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: cliFlag2,
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[cliFlag2]) {
const codec = commandLine[cliFlag2];
if (!validAudioCodecs.includes(commandLine[cliFlag2])) {
throw new Error(`Audio codec must be one of the following: ${validAudioCodecs.join(", ")}, but got ${codec}`);
}
return {
source: "cli",
value: commandLine[cliFlag2]
};
}
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"
};
// src/validate-output-filename.ts
var validateOutputFilename = ({
codec,
audioCodecSetting,
extension,
preferLossless,
separateAudioTo
}) => {
if (!defaultFileExtensionMap[codec]) {
throw new TypeError(`The codec "${codec}" is not supported. Supported codecs are: ${Object.keys(defaultFileExtensionMap).join(", ")}`);
}
const map = defaultFileExtensionMap[codec];
const resolvedAudioCodec = resolveAudioCodec({
codec,
preferLossless,
setting: audioCodecSetting,
separateAudioTo
});
if (resolvedAudioCodec === null) {
if (extension !== map.default) {
throw new TypeError(`When using the ${codec} codec, the output filename must end in .${map.default}.`);
}
return;
}
if (!(resolvedAudioCodec in map.forAudioCodec)) {
throw new Error(`Audio codec ${resolvedAudioCodec} is not supported for codec ${codec}`);
}
const acceptableExtensions = map.forAudioCodec[resolvedAudioCodec].possible;
if (!acceptableExtensions.includes(extension) && !separateAudioTo) {
throw new TypeError(`When using the ${codec} codec with the ${resolvedAudioCodec} audio codec, the output filename must end in one of the following: ${acceptableExtensions.join(", ")}.`);
}
};
// src/pure.ts
var NoReactAPIs = {
getExtensionOfFilename,
getFileExtensionFromCodec,
validateOutputFilename,
getFramesToRender,
codecSupportsMedia,
isAudioCodec
};
export {
NoReactAPIs
};