Federated video streaming platform using ActivityPub and P2P in the web browser with Angular. https://joinpeertube.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

50 lines
1.3 KiB

  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'
  6. program
  7. .arguments('<path>')
  8. .requiredOption('-r, --resolution [resolution]', 'video resolution')
  9. .action((path, cmd) => {
  10. if (cmd.resolution !== undefined && Number.isNaN(+cmd.resolution)) {
  11. console.error('The resolution must be an integer (example: 1080).')
  12. process.exit(-1)
  13. }
  14. run(path, cmd)
  15. .then(() => process.exit(0))
  16. .catch(err => {
  17. console.error(err)
  18. process.exit(-1)
  19. })
  20. })
  21. .parse(process.argv)
  22. async function run (path: string, cmd: any) {
  23. const options = {
  24. type: 'video' as 'video',
  25. inputPath: path,
  26. outputPath: '/dev/null',
  27. availableEncoders: VideoTranscodingProfilesManager.Instance.getAvailableEncoders(),
  28. profile: 'default',
  29. resolution: +cmd.resolution,
  30. isPortraitMode: false
  31. } as TranscodeOptions
  32. let command = ffmpeg(options.inputPath)
  33. .output(options.outputPath)
  34. command = await buildx264VODCommand(command, options)
  35. command.on('start', (cmdline) => {
  36. console.log(cmdline)
  37. exit()
  38. })
  39. await runCommand({ command })
  40. }