Files
story-studio/remotion/node_modules/@remotion/cli/dist/render-queue/process-video.js
2026-02-21 10:33:18 +01:00

96 lines
4.7 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.processVideoJob = void 0;
const client_1 = require("@remotion/renderer/client");
const preview_server_1 = require("../config/preview-server");
const convert_entry_point_to_serve_url_1 = require("../convert-entry-point-to-serve-url");
const get_cli_options_1 = require("../get-cli-options");
const parsed_cli_1 = require("../parsed-cli");
const render_1 = require("../render-flows/render");
const { publicDirOption, askAIOption, experimentalClientSideRenderingOption, keyboardShortcutsOption, } = client_1.BrowserSafeApis.options;
const processVideoJob = async ({ job, remotionRoot, entryPoint, onProgress, addCleanupCallback, logLevel, }) => {
var _a, _b, _c;
if (job.type !== 'video' && job.type !== 'sequence') {
throw new Error('Expected video job');
}
const publicDir = publicDirOption.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 { browserExecutable, ffmpegOverride } = (0, get_cli_options_1.getCliOptions)({
isStill: true,
logLevel,
indent: true,
});
const fullEntryPoint = (0, convert_entry_point_to_serve_url_1.convertEntryPointToServeUrl)(entryPoint);
await (0, render_1.renderVideoFlow)({
remotionRoot,
browser: 'chrome',
browserExecutable,
chromiumOptions: job.chromiumOptions,
entryPointReason: 'same as Studio',
envVariables: job.envVariables,
height: null,
fullEntryPoint,
serializedInputPropsWithCustomSchema: job.serializedInputPropsWithCustomSchema,
overwrite: true,
port: (0, preview_server_1.getRendererPortFromConfigFile)(),
publicDir,
puppeteerTimeout: job.delayRenderTimeout,
jpegQuality: (_a = job.jpegQuality) !== null && _a !== void 0 ? _a : undefined,
remainingArgs: [],
scale: job.scale,
width: null,
compositionIdFromUi: job.compositionId,
logLevel: job.logLevel,
onProgress,
indent: true,
concurrency: job.concurrency,
everyNthFrame: job.type === 'video' ? job.everyNthFrame : 1,
frameRange: [job.startFrame, job.endFrame],
quiet: false,
shouldOutputImageSequence: job.type === 'sequence',
addCleanupCallback,
outputLocationFromUI: job.outName,
uiCodec: job.type === 'video' ? job.codec : null,
uiImageFormat: job.imageFormat,
cancelSignal: job.cancelToken.cancelSignal,
crf: job.type === 'video' ? job.crf : null,
ffmpegOverride,
audioBitrate: job.type === 'video' ? job.audioBitrate : null,
muted: job.type === 'video' ? job.muted : true,
enforceAudioTrack: job.type === 'video' ? job.enforceAudioTrack : false,
proResProfile: job.type === 'video' ? ((_b = job.proResProfile) !== null && _b !== void 0 ? _b : undefined) : undefined,
x264Preset: job.type === 'video' ? ((_c = job.x264Preset) !== null && _c !== void 0 ? _c : null) : null,
pixelFormat: job.type === 'video' ? job.pixelFormat : 'yuv420p',
videoBitrate: job.type === 'video' ? job.videoBitrate : null,
encodingBufferSize: job.type === 'video' ? job.encodingBufferSize : null,
encodingMaxRate: job.type === 'video' ? job.encodingMaxRate : null,
numberOfGifLoops: job.type === 'video' ? job.numberOfGifLoops : null,
audioCodec: job.type === 'video' ? job.audioCodec : null,
disallowParallelEncoding: job.type === 'video' ? job.disallowParallelEncoding : false,
offthreadVideoCacheSizeInBytes: job.offthreadVideoCacheSizeInBytes,
colorSpace: job.type === 'video' ? job.colorSpace : null,
repro: job.repro,
binariesDirectory: job.binariesDirectory,
forSeamlessAacConcatenation: job.type === 'video' ? job.forSeamlessAacConcatenation : false,
separateAudioTo: job.type === 'video' ? job.separateAudioTo : null,
publicPath: null,
metadata: job.metadata,
hardwareAcceleration: job.type === 'video' ? job.hardwareAcceleration : 'disable',
chromeMode: job.chromeMode,
offthreadVideoThreads: job.offthreadVideoThreads,
mediaCacheSizeInBytes: job.mediaCacheSizeInBytes,
audioLatencyHint: null,
imageSequencePattern: null,
askAIEnabled,
experimentalClientSideRenderingEnabled: experimentalClientSideRenderingOption.getValue({ commandLine: parsed_cli_1.parsedCli })
.value,
keyboardShortcutsEnabled,
});
};
exports.processVideoJob = processVideoJob;