aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/transcoding/shared/ffmpeg-builder.ts
blob: 441445ec4da1cd56a4d6e69931cdf5ae2ca98513 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { Job } from 'bullmq'
import { getFFmpegCommandWrapperOptions } from '@server/helpers/ffmpeg'
import { logger } from '@server/helpers/logger'
import { FFmpegVOD } from '@shared/ffmpeg'
import { VideoTranscodingProfilesManager } from '../default-transcoding-profiles'

export function buildFFmpegVOD (job?: Job) {
  return new FFmpegVOD({
    ...getFFmpegCommandWrapperOptions('vod', VideoTranscodingProfilesManager.Instance.getAvailableEncoders()),

    updateJobProgress: progress => {
      if (!job) return

      job.updateProgress(progress)
        .catch(err => logger.error('Cannot update ffmpeg job progress', { err }))
    }
  })
}