199 lines
9.1 KiB
JavaScript
199 lines
9.1 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.render = void 0;
|
|
const client_1 = require("@remotion/renderer/client");
|
|
const no_react_1 = require("remotion/no-react");
|
|
const cleanup_before_quit_1 = require("./cleanup-before-quit");
|
|
const preview_server_1 = require("./config/preview-server");
|
|
const convert_entry_point_to_serve_url_1 = require("./convert-entry-point-to-serve-url");
|
|
const entry_point_1 = require("./entry-point");
|
|
const get_cli_options_1 = require("./get-cli-options");
|
|
const log_1 = require("./log");
|
|
const parsed_cli_1 = require("./parsed-cli");
|
|
const render_1 = require("./render-flows/render");
|
|
const { x264Option, audioBitrateOption, offthreadVideoCacheSizeInBytesOption, scaleOption, crfOption, jpegQualityOption, videoBitrateOption, enforceAudioOption, mutedOption, colorSpaceOption, disallowParallelEncodingOption, enableMultiprocessOnLinuxOption, glOption, numberOfGifLoopsOption, encodingMaxRateOption, encodingBufferSizeOption, reproOption, delayRenderTimeoutInMillisecondsOption, headlessOption, overwriteOption, binariesDirectoryOption, forSeamlessAacConcatenationOption, separateAudioOption, audioCodecOption, publicPathOption, publicDirOption, metadataOption, hardwareAccelerationOption, chromeModeOption, offthreadVideoThreadsOption, audioLatencyHintOption, imageSequencePatternOption, mediaCacheSizeInBytesOption, darkModeOption, askAIOption, experimentalClientSideRenderingOption, keyboardShortcutsOption, } = client_1.BrowserSafeApis.options;
|
|
const render = async (remotionRoot, args, logLevel) => {
|
|
const { file, remainingArgs, reason: entryPointReason, } = (0, entry_point_1.findEntryPoint)({ args, remotionRoot, logLevel, allowDirectory: true });
|
|
if (!file) {
|
|
log_1.Log.error({ indent: false, logLevel }, 'No entry point specified. Pass more arguments:');
|
|
log_1.Log.error({ indent: false, logLevel }, ' npx remotion render [entry-point] [composition-name] [out-name]');
|
|
log_1.Log.error({ indent: false, logLevel }, 'Documentation: https://www.remotion.dev/docs/render');
|
|
process.exit(1);
|
|
}
|
|
const fullEntryPoint = (0, convert_entry_point_to_serve_url_1.convertEntryPointToServeUrl)(file);
|
|
if (parsed_cli_1.parsedCli.frame) {
|
|
log_1.Log.error({ indent: false, logLevel }, '--frame flag was passed to the `render` command. This flag only works with the `still` command. Did you mean `--frames`? See reference: https://www.remotion.dev/docs/cli/');
|
|
process.exit(1);
|
|
}
|
|
const { concurrency, frameRange, shouldOutputImageSequence, inputProps, envVariables, browserExecutable, everyNthFrame, userAgent, disableWebSecurity, ignoreCertificateErrors, height, width, ffmpegOverride, proResProfile, pixelFormat, } = (0, get_cli_options_1.getCliOptions)({
|
|
isStill: false,
|
|
logLevel,
|
|
indent: false,
|
|
});
|
|
const x264Preset = x264Option.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const audioBitrate = audioBitrateOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const offthreadVideoCacheSizeInBytes = offthreadVideoCacheSizeInBytesOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const offthreadVideoThreads = offthreadVideoThreadsOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const scale = scaleOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const jpegQuality = jpegQualityOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const videoBitrate = videoBitrateOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const enforceAudioTrack = enforceAudioOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const muted = mutedOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const colorSpace = colorSpaceOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const disallowParallelEncoding = disallowParallelEncodingOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const crf = shouldOutputImageSequence
|
|
? null
|
|
: crfOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const enableMultiProcessOnLinux = enableMultiprocessOnLinuxOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const gl = glOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const numberOfGifLoops = numberOfGifLoopsOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const encodingMaxRate = encodingMaxRateOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const encodingBufferSize = encodingBufferSizeOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const repro = reproOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const puppeteerTimeout = delayRenderTimeoutInMillisecondsOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const headless = headlessOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const overwrite = overwriteOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}, true).value;
|
|
const binariesDirectory = binariesDirectoryOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const forSeamlessAacConcatenation = forSeamlessAacConcatenationOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const separateAudioTo = separateAudioOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const metadata = metadataOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const publicPath = publicPathOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const chromeMode = chromeModeOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const darkMode = darkModeOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const askAIEnabled = askAIOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const keyboardShortcutsEnabled = keyboardShortcutsOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const chromiumOptions = {
|
|
disableWebSecurity,
|
|
enableMultiProcessOnLinux,
|
|
gl,
|
|
headless,
|
|
ignoreCertificateErrors,
|
|
userAgent,
|
|
darkMode,
|
|
};
|
|
const audioCodec = audioCodecOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const publicDir = publicDirOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value;
|
|
const hardwareAcceleration = hardwareAccelerationOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const audioLatencyHint = audioLatencyHintOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const imageSequencePattern = imageSequencePatternOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
const mediaCacheSizeInBytes = mediaCacheSizeInBytesOption.getValue({
|
|
commandLine: parsed_cli_1.parsedCli,
|
|
}).value;
|
|
await (0, render_1.renderVideoFlow)({
|
|
fullEntryPoint,
|
|
remotionRoot,
|
|
browserExecutable,
|
|
indent: false,
|
|
logLevel,
|
|
browser: 'chrome',
|
|
chromiumOptions,
|
|
scale,
|
|
shouldOutputImageSequence,
|
|
publicDir,
|
|
envVariables,
|
|
serializedInputPropsWithCustomSchema: no_react_1.NoReactInternals.serializeJSONWithSpecialTypes({
|
|
indent: undefined,
|
|
staticBase: null,
|
|
data: inputProps,
|
|
}).serializedString,
|
|
puppeteerTimeout,
|
|
port: (0, preview_server_1.getRendererPortFromConfigFileAndCliFlag)(),
|
|
height,
|
|
width,
|
|
remainingArgs,
|
|
compositionIdFromUi: null,
|
|
entryPointReason,
|
|
overwrite,
|
|
quiet: (0, parsed_cli_1.quietFlagProvided)(),
|
|
concurrency,
|
|
everyNthFrame,
|
|
frameRange,
|
|
jpegQuality,
|
|
onProgress: () => undefined,
|
|
addCleanupCallback: (label, c) => {
|
|
(0, cleanup_before_quit_1.registerCleanupJob)(label, c);
|
|
},
|
|
outputLocationFromUI: null,
|
|
uiCodec: null,
|
|
uiImageFormat: null,
|
|
cancelSignal: null,
|
|
crf,
|
|
ffmpegOverride,
|
|
audioBitrate,
|
|
muted,
|
|
enforceAudioTrack,
|
|
proResProfile,
|
|
x264Preset,
|
|
pixelFormat,
|
|
videoBitrate,
|
|
encodingMaxRate,
|
|
encodingBufferSize,
|
|
numberOfGifLoops,
|
|
audioCodec,
|
|
disallowParallelEncoding,
|
|
offthreadVideoCacheSizeInBytes,
|
|
mediaCacheSizeInBytes,
|
|
colorSpace,
|
|
repro,
|
|
binariesDirectory,
|
|
forSeamlessAacConcatenation,
|
|
separateAudioTo,
|
|
publicPath,
|
|
metadata,
|
|
hardwareAcceleration,
|
|
chromeMode,
|
|
offthreadVideoThreads,
|
|
audioLatencyHint,
|
|
imageSequencePattern,
|
|
askAIEnabled,
|
|
experimentalClientSideRenderingEnabled: experimentalClientSideRenderingOption.getValue({ commandLine: parsed_cli_1.parsedCli })
|
|
.value,
|
|
keyboardShortcutsEnabled,
|
|
});
|
|
};
|
|
exports.render = render;
|