1 import { registerTSPaths } from '../server/helpers/register-ts-paths'
4 import * as program from 'commander'
5 import * as ffmpeg from 'fluent-ffmpeg'
6 import { buildx264VODCommand, runCommand, TranscodeOptions } from '@server/helpers/ffmpeg-utils'
7 import { exit } from 'process'
8 import { VideoTranscodingProfilesManager } from '@server/lib/video-transcoding-profiles'
12 .requiredOption('-r, --resolution [resolution]', 'video resolution')
13 .action((path, cmd) => {
14 if (cmd.resolution !== undefined && Number.isNaN(+cmd.resolution)) {
15 console.error('The resolution must be an integer (example: 1080).')
20 .then(() => process.exit(0))
28 async function run (path: string, cmd: any) {
30 type: 'video' as 'video',
32 outputPath: '/dev/null',
34 availableEncoders: VideoTranscodingProfilesManager.Instance.getAvailableEncoders(),
37 resolution: +cmd.resolution,
41 let command = ffmpeg(options.inputPath)
42 .output(options.outputPath)
44 command = await buildx264VODCommand(command, options)
46 command.on('start', (cmdline) => {
51 await runCommand({ command })