| ; | |
| var __importDefault = (this && this.__importDefault) || function (mod) { | |
| return (mod && mod.__esModule) ? mod : { "default": mod }; | |
| }; | |
| Object.defineProperty(exports, "__esModule", { value: true }); | |
| exports.getCliOptions = exports.getAndValidateAbsoluteOutputFile = void 0; | |
| const node_fs_1 = __importDefault(require("node:fs")); | |
| const node_path_1 = __importDefault(require("node:path")); | |
| const client_1 = require("@remotion/renderer/client"); | |
| const config_1 = require("./config"); | |
| const get_env_1 = require("./get-env"); | |
| const get_input_props_1 = require("./get-input-props"); | |
| const log_1 = require("./log"); | |
| const parsed_cli_1 = require("./parsed-cli"); | |
| const getAndValidateFrameRange = (logLevel, indent) => { | |
| const frameSelection = client_1.BrowserSafeApis.options.framesOption.getValue({ | |
| commandLine: parsed_cli_1.parsedCli, | |
| }).value; | |
| const selectedFrames = typeof frameSelection === 'object' && | |
| frameSelection !== null && | |
| !Array.isArray(frameSelection) | |
| ? frameSelection.frames | |
| : null; | |
| const frameRange = selectedFrames === null ? frameSelection : null; | |
| if (typeof frameRange === 'number') { | |
| log_1.Log.warn({ logLevel, indent }, 'Selected a single frame. Assuming you want to output an image.'); | |
| log_1.Log.warn({ logLevel, indent }, `If you want to render a video, pass a range: '--frames=${frameRange}-${frameRange}'.`); | |
| log_1.Log.warn({ indent, logLevel }, "To dismiss this message, add the '--sequence' flag explicitly."); | |
| } | |
| return { frameRange, selectedFrames }; | |
| }; | |
| const getAndValidateAbsoluteOutputFile = (relativeOutputLocation, overwrite, logLevel) => { | |
| const absoluteOutputFile = node_path_1.default.resolve(process.cwd(), relativeOutputLocation); | |
| if (node_fs_1.default.existsSync(absoluteOutputFile) && !overwrite) { | |
| log_1.Log.error({ indent: false, logLevel }, `File at ${absoluteOutputFile} already exists. Use --overwrite to overwrite.`); | |
| process.exit(1); | |
| } | |
| return absoluteOutputFile; | |
| }; | |
| exports.getAndValidateAbsoluteOutputFile = getAndValidateAbsoluteOutputFile; | |
| const getCliOptions = (options) => { | |
| var _a; | |
| const { frameRange, selectedFrames } = getAndValidateFrameRange(options.logLevel, false); | |
| const imageSequence = client_1.BrowserSafeApis.options.imageSequenceOption.getValue({ | |
| commandLine: parsed_cli_1.parsedCli, | |
| }).value; | |
| const shouldOutputImageSequence = options.isStill | |
| ? true | |
| : imageSequence || | |
| typeof frameRange === 'number' || | |
| selectedFrames !== null; | |
| return { | |
| frameRange, | |
| selectedFrames, | |
| shouldOutputImageSequence, | |
| inputProps: (0, get_input_props_1.getInputProps)(null, options.logLevel), | |
| envVariables: (0, get_env_1.getEnvironmentVariables)(null, options.logLevel, options.indent), | |
| stillFrame: (_a = client_1.BrowserSafeApis.options.stillFrameOption.getValue({ | |
| commandLine: parsed_cli_1.parsedCli, | |
| }).value) !== null && _a !== void 0 ? _a : 0, | |
| ffmpegOverride: config_1.ConfigInternals.getFfmpegOverrideFunction(), | |
| }; | |
| }; | |
| exports.getCliOptions = getCliOptions; | |
Xet Storage Details
- Size:
- 3.19 kB
- Xet hash:
- d87061873c6bbe0ae316048c6b9e9312251a3b2bbf7084ab70b1f60962b49089
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.