aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers/video-transcoding.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/job-queue/handlers/video-transcoding.ts')
-rw-r--r--server/lib/job-queue/handlers/video-transcoding.ts42
1 files changed, 7 insertions, 35 deletions
diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts
index c020057c9..46add57d4 100644
--- a/server/lib/job-queue/handlers/video-transcoding.ts
+++ b/server/lib/job-queue/handlers/video-transcoding.ts
@@ -1,9 +1,14 @@
1import * as Bull from 'bull' 1import * as Bull from 'bull'
2import { VideoResolution } from '../../../../shared' 2import {
3 MergeAudioTranscodingPayload,
4 NewResolutionTranscodingPayload,
5 OptimizeTranscodingPayload,
6 VideoTranscodingPayload
7} from '../../../../shared'
3import { logger } from '../../../helpers/logger' 8import { logger } from '../../../helpers/logger'
4import { VideoModel } from '../../../models/video/video' 9import { VideoModel } from '../../../models/video/video'
5import { JobQueue } from '../job-queue' 10import { JobQueue } from '../job-queue'
6import { federateVideoIfNeeded } from '../../activitypub' 11import { federateVideoIfNeeded } from '../../activitypub/videos'
7import { retryTransactionWrapper } from '../../../helpers/database-utils' 12import { retryTransactionWrapper } from '../../../helpers/database-utils'
8import { sequelizeTypescript } from '../../../initializers' 13import { sequelizeTypescript } from '../../../initializers'
9import { computeResolutionsToTranscode } from '../../../helpers/ffmpeg-utils' 14import { computeResolutionsToTranscode } from '../../../helpers/ffmpeg-utils'
@@ -12,39 +17,6 @@ import { Notifier } from '../../notifier'
12import { CONFIG } from '../../../initializers/config' 17import { CONFIG } from '../../../initializers/config'
13import { MVideoFullLight, MVideoUUID, MVideoWithFile } from '@server/typings/models' 18import { MVideoFullLight, MVideoUUID, MVideoWithFile } from '@server/typings/models'
14 19
15interface BaseTranscodingPayload {
16 videoUUID: string
17 isNewVideo?: boolean
18}
19
20interface HLSTranscodingPayload extends BaseTranscodingPayload {
21 type: 'hls'
22 isPortraitMode?: boolean
23 resolution: VideoResolution
24 copyCodecs: boolean
25}
26
27interface NewResolutionTranscodingPayload extends BaseTranscodingPayload {
28 type: 'new-resolution'
29 isPortraitMode?: boolean
30 resolution: VideoResolution
31}
32
33interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
34 type: 'merge-audio'
35 resolution: VideoResolution
36}
37
38interface OptimizeTranscodingPayload extends BaseTranscodingPayload {
39 type: 'optimize'
40}
41
42export type VideoTranscodingPayload =
43 HLSTranscodingPayload
44 | NewResolutionTranscodingPayload
45 | OptimizeTranscodingPayload
46 | MergeAudioTranscodingPayload
47
48async function processVideoTranscoding (job: Bull.Job) { 20async function processVideoTranscoding (job: Bull.Job) {
49 const payload = job.data as VideoTranscodingPayload 21 const payload = job.data as VideoTranscodingPayload
50 logger.info('Processing video file in job %d.', job.id) 22 logger.info('Processing video file in job %d.', job.id)