aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/job-queue/handlers/video-studio-edition.ts6
-rw-r--r--server/lib/runners/job-handlers/abstract-job-handler.ts10
-rw-r--r--server/lib/runners/job-handlers/index.ts2
-rw-r--r--server/lib/runners/job-handlers/runner-job-handlers.ts4
-rw-r--r--server/lib/runners/job-handlers/video-studio-transcoding-job-handler.ts (renamed from server/lib/runners/job-handlers/video-edition-transcoding-job-handler.ts)24
-rw-r--r--server/lib/transcoding/default-transcoding-profiles.ts145
-rw-r--r--server/lib/video-studio.ts8
7 files changed, 30 insertions, 169 deletions
diff --git a/server/lib/job-queue/handlers/video-studio-edition.ts b/server/lib/job-queue/handlers/video-studio-edition.ts
index df73caf72..caf051bfa 100644
--- a/server/lib/job-queue/handlers/video-studio-edition.ts
+++ b/server/lib/job-queue/handlers/video-studio-edition.ts
@@ -6,7 +6,7 @@ import { CONFIG } from '@server/initializers/config'
6import { VideoTranscodingProfilesManager } from '@server/lib/transcoding/default-transcoding-profiles' 6import { VideoTranscodingProfilesManager } from '@server/lib/transcoding/default-transcoding-profiles'
7import { isAbleToUploadVideo } from '@server/lib/user' 7import { isAbleToUploadVideo } from '@server/lib/user'
8import { VideoPathManager } from '@server/lib/video-path-manager' 8import { VideoPathManager } from '@server/lib/video-path-manager'
9import { approximateIntroOutroAdditionalSize, onVideoEditionEnded, safeCleanupStudioTMPFiles } from '@server/lib/video-studio' 9import { approximateIntroOutroAdditionalSize, onVideoStudioEnded, safeCleanupStudioTMPFiles } from '@server/lib/video-studio'
10import { UserModel } from '@server/models/user/user' 10import { UserModel } from '@server/models/user/user'
11import { VideoModel } from '@server/models/video/video' 11import { VideoModel } from '@server/models/video/video'
12import { MVideo, MVideoFullLight } from '@server/types/models' 12import { MVideo, MVideoFullLight } from '@server/types/models'
@@ -24,7 +24,7 @@ import {
24} from '@shared/models' 24} from '@shared/models'
25import { logger, loggerTagsFactory } from '../../../helpers/logger' 25import { logger, loggerTagsFactory } from '../../../helpers/logger'
26 26
27const lTagsBase = loggerTagsFactory('video-edition') 27const lTagsBase = loggerTagsFactory('video-studio')
28 28
29async function processVideoStudioEdition (job: Job) { 29async function processVideoStudioEdition (job: Job) {
30 const payload = job.data as VideoStudioEditionPayload 30 const payload = job.data as VideoStudioEditionPayload
@@ -74,7 +74,7 @@ async function processVideoStudioEdition (job: Job) {
74 74
75 logger.info('Video edition ended for video %s.', video.uuid, lTags) 75 logger.info('Video edition ended for video %s.', video.uuid, lTags)
76 76
77 await onVideoEditionEnded({ video, editionResultPath, tasks: payload.tasks }) 77 await onVideoStudioEnded({ video, editionResultPath, tasks: payload.tasks })
78 } catch (err) { 78 } catch (err) {
79 await safeCleanupStudioTMPFiles(payload.tasks) 79 await safeCleanupStudioTMPFiles(payload.tasks)
80 80
diff --git a/server/lib/runners/job-handlers/abstract-job-handler.ts b/server/lib/runners/job-handlers/abstract-job-handler.ts
index 76fd1c5ac..28c3e1eda 100644
--- a/server/lib/runners/job-handlers/abstract-job-handler.ts
+++ b/server/lib/runners/job-handlers/abstract-job-handler.ts
@@ -15,8 +15,8 @@ import {
15 RunnerJobSuccessPayload, 15 RunnerJobSuccessPayload,
16 RunnerJobType, 16 RunnerJobType,
17 RunnerJobUpdatePayload, 17 RunnerJobUpdatePayload,
18 RunnerJobVideoEditionTranscodingPayload, 18 RunnerJobStudioTranscodingPayload,
19 RunnerJobVideoEditionTranscodingPrivatePayload, 19 RunnerJobVideoStudioTranscodingPrivatePayload,
20 RunnerJobVODAudioMergeTranscodingPayload, 20 RunnerJobVODAudioMergeTranscodingPayload,
21 RunnerJobVODAudioMergeTranscodingPrivatePayload, 21 RunnerJobVODAudioMergeTranscodingPrivatePayload,
22 RunnerJobVODHLSTranscodingPayload, 22 RunnerJobVODHLSTranscodingPayload,
@@ -47,9 +47,9 @@ type CreateRunnerJobArg =
47 privatePayload: RunnerJobLiveRTMPHLSTranscodingPrivatePayload 47 privatePayload: RunnerJobLiveRTMPHLSTranscodingPrivatePayload
48 } | 48 } |
49 { 49 {
50 type: Extract<RunnerJobType, 'video-edition-transcoding'> 50 type: Extract<RunnerJobType, 'video-studio-transcoding'>
51 payload: RunnerJobVideoEditionTranscodingPayload 51 payload: RunnerJobStudioTranscodingPayload
52 privatePayload: RunnerJobVideoEditionTranscodingPrivatePayload 52 privatePayload: RunnerJobVideoStudioTranscodingPrivatePayload
53 } 53 }
54 54
55export abstract class AbstractJobHandler <C, U extends RunnerJobUpdatePayload, S extends RunnerJobSuccessPayload> { 55export abstract class AbstractJobHandler <C, U extends RunnerJobUpdatePayload, S extends RunnerJobSuccessPayload> {
diff --git a/server/lib/runners/job-handlers/index.ts b/server/lib/runners/job-handlers/index.ts
index a40cee865..40ad2f97a 100644
--- a/server/lib/runners/job-handlers/index.ts
+++ b/server/lib/runners/job-handlers/index.ts
@@ -1,7 +1,7 @@
1export * from './abstract-job-handler' 1export * from './abstract-job-handler'
2export * from './live-rtmp-hls-transcoding-job-handler' 2export * from './live-rtmp-hls-transcoding-job-handler'
3export * from './runner-job-handlers' 3export * from './runner-job-handlers'
4export * from './video-edition-transcoding-job-handler' 4export * from './video-studio-transcoding-job-handler'
5export * from './vod-audio-merge-transcoding-job-handler' 5export * from './vod-audio-merge-transcoding-job-handler'
6export * from './vod-hls-transcoding-job-handler' 6export * from './vod-hls-transcoding-job-handler'
7export * from './vod-web-video-transcoding-job-handler' 7export * from './vod-web-video-transcoding-job-handler'
diff --git a/server/lib/runners/job-handlers/runner-job-handlers.ts b/server/lib/runners/job-handlers/runner-job-handlers.ts
index 4ea6684ea..85551c365 100644
--- a/server/lib/runners/job-handlers/runner-job-handlers.ts
+++ b/server/lib/runners/job-handlers/runner-job-handlers.ts
@@ -2,7 +2,7 @@ import { MRunnerJob } from '@server/types/models/runners'
2import { RunnerJobSuccessPayload, RunnerJobType, RunnerJobUpdatePayload } from '@shared/models' 2import { RunnerJobSuccessPayload, RunnerJobType, RunnerJobUpdatePayload } from '@shared/models'
3import { AbstractJobHandler } from './abstract-job-handler' 3import { AbstractJobHandler } from './abstract-job-handler'
4import { LiveRTMPHLSTranscodingJobHandler } from './live-rtmp-hls-transcoding-job-handler' 4import { LiveRTMPHLSTranscodingJobHandler } from './live-rtmp-hls-transcoding-job-handler'
5import { VideoEditionTranscodingJobHandler } from './video-edition-transcoding-job-handler' 5import { VideoStudioTranscodingJobHandler } from './video-studio-transcoding-job-handler'
6import { VODAudioMergeTranscodingJobHandler } from './vod-audio-merge-transcoding-job-handler' 6import { VODAudioMergeTranscodingJobHandler } from './vod-audio-merge-transcoding-job-handler'
7import { VODHLSTranscodingJobHandler } from './vod-hls-transcoding-job-handler' 7import { VODHLSTranscodingJobHandler } from './vod-hls-transcoding-job-handler'
8import { VODWebVideoTranscodingJobHandler } from './vod-web-video-transcoding-job-handler' 8import { VODWebVideoTranscodingJobHandler } from './vod-web-video-transcoding-job-handler'
@@ -12,7 +12,7 @@ const processors: Record<RunnerJobType, new() => AbstractJobHandler<unknown, Run
12 'vod-hls-transcoding': VODHLSTranscodingJobHandler, 12 'vod-hls-transcoding': VODHLSTranscodingJobHandler,
13 'vod-audio-merge-transcoding': VODAudioMergeTranscodingJobHandler, 13 'vod-audio-merge-transcoding': VODAudioMergeTranscodingJobHandler,
14 'live-rtmp-hls-transcoding': LiveRTMPHLSTranscodingJobHandler, 14 'live-rtmp-hls-transcoding': LiveRTMPHLSTranscodingJobHandler,
15 'video-edition-transcoding': VideoEditionTranscodingJobHandler 15 'video-studio-transcoding': VideoStudioTranscodingJobHandler
16} 16}
17 17
18export function getRunnerJobHandlerClass (job: MRunnerJob) { 18export function getRunnerJobHandlerClass (job: MRunnerJob) {
diff --git a/server/lib/runners/job-handlers/video-edition-transcoding-job-handler.ts b/server/lib/runners/job-handlers/video-studio-transcoding-job-handler.ts
index 39a755c48..f604382b7 100644
--- a/server/lib/runners/job-handlers/video-edition-transcoding-job-handler.ts
+++ b/server/lib/runners/job-handlers/video-studio-transcoding-job-handler.ts
@@ -1,7 +1,7 @@
1 1
2import { basename } from 'path' 2import { basename } from 'path'
3import { logger } from '@server/helpers/logger' 3import { logger } from '@server/helpers/logger'
4import { onVideoEditionEnded, safeCleanupStudioTMPFiles } from '@server/lib/video-studio' 4import { onVideoStudioEnded, safeCleanupStudioTMPFiles } from '@server/lib/video-studio'
5import { MVideo } from '@server/types/models' 5import { MVideo } from '@server/types/models'
6import { MRunnerJob } from '@server/types/models/runners' 6import { MRunnerJob } from '@server/types/models/runners'
7import { buildUUID } from '@shared/extra-utils' 7import { buildUUID } from '@shared/extra-utils'
@@ -11,9 +11,9 @@ import {
11 isVideoStudioTaskWatermark, 11 isVideoStudioTaskWatermark,
12 RunnerJobState, 12 RunnerJobState,
13 RunnerJobUpdatePayload, 13 RunnerJobUpdatePayload,
14 RunnerJobVideoEditionTranscodingPayload, 14 RunnerJobStudioTranscodingPayload,
15 RunnerJobVideoEditionTranscodingPrivatePayload, 15 RunnerJobVideoStudioTranscodingPrivatePayload,
16 VideoEditionTranscodingSuccess, 16 VideoStudioTranscodingSuccess,
17 VideoState, 17 VideoState,
18 VideoStudioTaskPayload 18 VideoStudioTaskPayload
19} from '@shared/models' 19} from '@shared/models'
@@ -28,13 +28,13 @@ type CreateOptions = {
28} 28}
29 29
30// eslint-disable-next-line max-len 30// eslint-disable-next-line max-len
31export class VideoEditionTranscodingJobHandler extends AbstractJobHandler<CreateOptions, RunnerJobUpdatePayload, VideoEditionTranscodingSuccess> { 31export class VideoStudioTranscodingJobHandler extends AbstractJobHandler<CreateOptions, RunnerJobUpdatePayload, VideoStudioTranscodingSuccess> {
32 32
33 async create (options: CreateOptions) { 33 async create (options: CreateOptions) {
34 const { video, priority, tasks } = options 34 const { video, priority, tasks } = options
35 35
36 const jobUUID = buildUUID() 36 const jobUUID = buildUUID()
37 const payload: RunnerJobVideoEditionTranscodingPayload = { 37 const payload: RunnerJobStudioTranscodingPayload = {
38 input: { 38 input: {
39 videoFileUrl: generateRunnerTranscodingVideoInputFileUrl(jobUUID, video.uuid) 39 videoFileUrl: generateRunnerTranscodingVideoInputFileUrl(jobUUID, video.uuid)
40 }, 40 },
@@ -67,13 +67,13 @@ export class VideoEditionTranscodingJobHandler extends AbstractJobHandler<Create
67 }) 67 })
68 } 68 }
69 69
70 const privatePayload: RunnerJobVideoEditionTranscodingPrivatePayload = { 70 const privatePayload: RunnerJobVideoStudioTranscodingPrivatePayload = {
71 videoUUID: video.uuid, 71 videoUUID: video.uuid,
72 originalTasks: tasks 72 originalTasks: tasks
73 } 73 }
74 74
75 const job = await this.createRunnerJob({ 75 const job = await this.createRunnerJob({
76 type: 'video-edition-transcoding', 76 type: 'video-studio-transcoding',
77 jobUUID, 77 jobUUID,
78 payload, 78 payload,
79 privatePayload, 79 privatePayload,
@@ -103,10 +103,10 @@ export class VideoEditionTranscodingJobHandler extends AbstractJobHandler<Create
103 103
104 protected async specificComplete (options: { 104 protected async specificComplete (options: {
105 runnerJob: MRunnerJob 105 runnerJob: MRunnerJob
106 resultPayload: VideoEditionTranscodingSuccess 106 resultPayload: VideoStudioTranscodingSuccess
107 }) { 107 }) {
108 const { runnerJob, resultPayload } = options 108 const { runnerJob, resultPayload } = options
109 const privatePayload = runnerJob.privatePayload as RunnerJobVideoEditionTranscodingPrivatePayload 109 const privatePayload = runnerJob.privatePayload as RunnerJobVideoStudioTranscodingPrivatePayload
110 110
111 const video = await loadTranscodingRunnerVideo(runnerJob, this.lTags) 111 const video = await loadTranscodingRunnerVideo(runnerJob, this.lTags)
112 if (!video) { 112 if (!video) {
@@ -116,7 +116,7 @@ export class VideoEditionTranscodingJobHandler extends AbstractJobHandler<Create
116 116
117 const videoFilePath = resultPayload.videoFile as string 117 const videoFilePath = resultPayload.videoFile as string
118 118
119 await onVideoEditionEnded({ video, editionResultPath: videoFilePath, tasks: privatePayload.originalTasks }) 119 await onVideoStudioEnded({ video, editionResultPath: videoFilePath, tasks: privatePayload.originalTasks })
120 120
121 logger.info( 121 logger.info(
122 'Runner video edition transcoding job %s for %s ended.', 122 'Runner video edition transcoding job %s for %s ended.',
@@ -146,7 +146,7 @@ export class VideoEditionTranscodingJobHandler extends AbstractJobHandler<Create
146 }) { 146 }) {
147 const { runnerJob } = options 147 const { runnerJob } = options
148 148
149 const payload = runnerJob.privatePayload as RunnerJobVideoEditionTranscodingPrivatePayload 149 const payload = runnerJob.privatePayload as RunnerJobVideoStudioTranscodingPrivatePayload
150 await safeCleanupStudioTMPFiles(payload.originalTasks) 150 await safeCleanupStudioTMPFiles(payload.originalTasks)
151 151
152 const video = await loadTranscodingRunnerVideo(options.runnerJob, this.lTags) 152 const video = await loadTranscodingRunnerVideo(options.runnerJob, this.lTags)
diff --git a/server/lib/transcoding/default-transcoding-profiles.ts b/server/lib/transcoding/default-transcoding-profiles.ts
index 5251784ac..8f8fdd026 100644
--- a/server/lib/transcoding/default-transcoding-profiles.ts
+++ b/server/lib/transcoding/default-transcoding-profiles.ts
@@ -1,88 +1,7 @@
1 1
2import { logger } from '@server/helpers/logger' 2import { logger } from '@server/helpers/logger'
3import { getAverageBitrate, getMinLimitBitrate } from '@shared/core-utils' 3import { FFmpegCommandWrapper, getDefaultAvailableEncoders } from '@shared/ffmpeg'
4import { buildStreamSuffix, FFmpegCommandWrapper, ffprobePromise, getAudioStream, getMaxAudioBitrate } from '@shared/ffmpeg' 4import { AvailableEncoders, EncoderOptionsBuilder } from '@shared/models'
5import { AvailableEncoders, EncoderOptionsBuilder, EncoderOptionsBuilderParams, VideoResolution } from '@shared/models'
6import { canDoQuickAudioTranscode } from './transcoding-quick-transcode'
7
8/**
9 *
10 * Available encoders and profiles for the transcoding jobs
11 * These functions are used by ffmpeg-utils that will get the encoders and options depending on the chosen profile
12 *
13 * Resources:
14 * * https://slhck.info/video/2017/03/01/rate-control.html
15 * * https://trac.ffmpeg.org/wiki/Limiting%20the%20output%20bitrate
16 */
17
18// ---------------------------------------------------------------------------
19// Default builders
20// ---------------------------------------------------------------------------
21
22const defaultX264VODOptionsBuilder: EncoderOptionsBuilder = (options: EncoderOptionsBuilderParams) => {
23 const { fps, inputRatio, inputBitrate, resolution } = options
24
25 // TODO: remove in 4.2, fps is not optional anymore
26 if (!fps) return { outputOptions: [ ] }
27
28 const targetBitrate = getTargetBitrate({ inputBitrate, ratio: inputRatio, fps, resolution })
29
30 return {
31 outputOptions: [
32 ...getCommonOutputOptions(targetBitrate),
33
34 `-r ${fps}`
35 ]
36 }
37}
38
39const defaultX264LiveOptionsBuilder: EncoderOptionsBuilder = (options: EncoderOptionsBuilderParams) => {
40 const { streamNum, fps, inputBitrate, inputRatio, resolution } = options
41
42 const targetBitrate = getTargetBitrate({ inputBitrate, ratio: inputRatio, fps, resolution })
43
44 return {
45 outputOptions: [
46 ...getCommonOutputOptions(targetBitrate, streamNum),
47
48 `${buildStreamSuffix('-r:v', streamNum)} ${fps}`,
49 `${buildStreamSuffix('-b:v', streamNum)} ${targetBitrate}`
50 ]
51 }
52}
53
54const defaultAACOptionsBuilder: EncoderOptionsBuilder = async ({ input, streamNum, canCopyAudio }) => {
55 const probe = await ffprobePromise(input)
56
57 if (canCopyAudio && await canDoQuickAudioTranscode(input, probe)) {
58 logger.debug('Copy audio stream %s by AAC encoder.', input)
59 return { copy: true, outputOptions: [ ] }
60 }
61
62 const parsedAudio = await getAudioStream(input, probe)
63
64 // We try to reduce the ceiling bitrate by making rough matches of bitrates
65 // Of course this is far from perfect, but it might save some space in the end
66
67 const audioCodecName = parsedAudio.audioStream['codec_name']
68
69 const bitrate = getMaxAudioBitrate(audioCodecName, parsedAudio.bitrate)
70
71 logger.debug('Calculating audio bitrate of %s by AAC encoder.', input, { bitrate: parsedAudio.bitrate, audioCodecName })
72
73 // Force stereo as it causes some issues with HLS playback in Chrome
74 const base = [ '-channel_layout', 'stereo' ]
75
76 if (bitrate !== -1) {
77 return { outputOptions: base.concat([ buildStreamSuffix('-b:a', streamNum), bitrate + 'k' ]) }
78 }
79
80 return { outputOptions: base }
81}
82
83const defaultLibFDKAACVODOptionsBuilder: EncoderOptionsBuilder = ({ streamNum }) => {
84 return { outputOptions: [ buildStreamSuffix('-q:a', streamNum), '5' ] }
85}
86 5
87// --------------------------------------------------------------------------- 6// ---------------------------------------------------------------------------
88// Profile manager to get and change default profiles 7// Profile manager to get and change default profiles
@@ -97,27 +16,7 @@ class VideoTranscodingProfilesManager {
97 live: this.buildDefaultEncodersPriorities() 16 live: this.buildDefaultEncodersPriorities()
98 } 17 }
99 18
100 private readonly availableEncoders = { 19 private readonly availableEncoders = getDefaultAvailableEncoders()
101 vod: {
102 libx264: {
103 default: defaultX264VODOptionsBuilder
104 },
105 aac: {
106 default: defaultAACOptionsBuilder
107 },
108 libfdk_aac: {
109 default: defaultLibFDKAACVODOptionsBuilder
110 }
111 },
112 live: {
113 libx264: {
114 default: defaultX264LiveOptionsBuilder
115 },
116 aac: {
117 default: defaultAACOptionsBuilder
118 }
119 }
120 }
121 20
122 private availableProfiles = { 21 private availableProfiles = {
123 vod: [] as string[], 22 vod: [] as string[],
@@ -242,41 +141,3 @@ class VideoTranscodingProfilesManager {
242export { 141export {
243 VideoTranscodingProfilesManager 142 VideoTranscodingProfilesManager
244} 143}
245
246// ---------------------------------------------------------------------------
247
248function getTargetBitrate (options: {
249 inputBitrate: number
250 resolution: VideoResolution
251 ratio: number
252 fps: number
253}) {
254 const { inputBitrate, resolution, ratio, fps } = options
255
256 const capped = capBitrate(inputBitrate, getAverageBitrate({ resolution, fps, ratio }))
257 const limit = getMinLimitBitrate({ resolution, fps, ratio })
258
259 return Math.max(limit, capped)
260}
261
262function capBitrate (inputBitrate: number, targetBitrate: number) {
263 if (!inputBitrate) return targetBitrate
264
265 // Add 30% margin to input bitrate
266 const inputBitrateWithMargin = inputBitrate + (inputBitrate * 0.3)
267
268 return Math.min(targetBitrate, inputBitrateWithMargin)
269}
270
271function getCommonOutputOptions (targetBitrate: number, streamNum?: number) {
272 return [
273 `-preset veryfast`,
274 `${buildStreamSuffix('-maxrate:v', streamNum)} ${targetBitrate}`,
275 `${buildStreamSuffix('-bufsize:v', streamNum)} ${targetBitrate * 2}`,
276
277 // NOTE: b-strategy 1 - heuristic algorithm, 16 is optimal B-frames for it
278 `-b_strategy 1`,
279 // NOTE: Why 16: https://github.com/Chocobozzz/PeerTube/pull/774. b-strategy 2 -> B-frames<16
280 `-bf 16`
281 ]
282}
diff --git a/server/lib/video-studio.ts b/server/lib/video-studio.ts
index 2c993faeb..0d3db8f60 100644
--- a/server/lib/video-studio.ts
+++ b/server/lib/video-studio.ts
@@ -9,13 +9,13 @@ import { getVideoStreamDuration } from '@shared/ffmpeg'
9import { VideoStudioEditionPayload, VideoStudioTask, VideoStudioTaskPayload } from '@shared/models' 9import { VideoStudioEditionPayload, VideoStudioTask, VideoStudioTaskPayload } from '@shared/models'
10import { federateVideoIfNeeded } from './activitypub/videos' 10import { federateVideoIfNeeded } from './activitypub/videos'
11import { JobQueue } from './job-queue' 11import { JobQueue } from './job-queue'
12import { VideoEditionTranscodingJobHandler } from './runners' 12import { VideoStudioTranscodingJobHandler } from './runners'
13import { createOptimizeOrMergeAudioJobs } from './transcoding/create-transcoding-job' 13import { createOptimizeOrMergeAudioJobs } from './transcoding/create-transcoding-job'
14import { getTranscodingJobPriority } from './transcoding/transcoding-priority' 14import { getTranscodingJobPriority } from './transcoding/transcoding-priority'
15import { buildNewFile, removeHLSPlaylist, removeWebTorrentFile } from './video-file' 15import { buildNewFile, removeHLSPlaylist, removeWebTorrentFile } from './video-file'
16import { VideoPathManager } from './video-path-manager' 16import { VideoPathManager } from './video-path-manager'
17 17
18const lTags = loggerTagsFactory('video-edition') 18const lTags = loggerTagsFactory('video-studio')
19 19
20export function buildTaskFileFieldname (indice: number, fieldName = 'file') { 20export function buildTaskFileFieldname (indice: number, fieldName = 'file') {
21 return `tasks[${indice}][options][${fieldName}]` 21 return `tasks[${indice}][options][${fieldName}]`
@@ -78,14 +78,14 @@ export async function createVideoStudioJob (options: {
78 const priority = await getTranscodingJobPriority({ user, type: 'studio', fallback: 0 }) 78 const priority = await getTranscodingJobPriority({ user, type: 'studio', fallback: 0 })
79 79
80 if (CONFIG.VIDEO_STUDIO.REMOTE_RUNNERS.ENABLED) { 80 if (CONFIG.VIDEO_STUDIO.REMOTE_RUNNERS.ENABLED) {
81 await new VideoEditionTranscodingJobHandler().create({ video, tasks: payload.tasks, priority }) 81 await new VideoStudioTranscodingJobHandler().create({ video, tasks: payload.tasks, priority })
82 return 82 return
83 } 83 }
84 84
85 await JobQueue.Instance.createJob({ type: 'video-studio-edition', payload, priority }) 85 await JobQueue.Instance.createJob({ type: 'video-studio-edition', payload, priority })
86} 86}
87 87
88export async function onVideoEditionEnded (options: { 88export async function onVideoStudioEnded (options: {
89 editionResultPath: string 89 editionResultPath: string
90 tasks: VideoStudioTaskPayload[] 90 tasks: VideoStudioTaskPayload[]
91 video: MVideoFullLight 91 video: MVideoFullLight