1 import { program } from 'commander'
2 import ffmpeg from 'fluent-ffmpeg'
3 import { exit } from 'process'
4 import { buildx264VODCommand, runCommand, TranscodeOptions } from '@server/helpers/ffmpeg-utils'
5 import { VideoTranscodingProfilesManager } from '@server/lib/transcoding/video-transcoding-profiles'
9 .requiredOption('-r, --resolution [resolution]', 'video resolution')
10 .action((path, cmd) => {
11 if (cmd.resolution !== undefined && Number.isNaN(+cmd.resolution)) {
12 console.error('The resolution must be an integer (example: 1080).')
17 .then(() => process.exit(0))
25 async function run (path: string, cmd: any) {
27 type: 'video' as 'video',
29 outputPath: '/dev/null',
31 availableEncoders: VideoTranscodingProfilesManager.Instance.getAvailableEncoders(),
34 resolution: +cmd.resolution,
38 let command = ffmpeg(options.inputPath)
39 .output(options.outputPath)
41 command = await buildx264VODCommand(command, options)
43 command.on('start', (cmdline) => {
48 await runCommand({ command })