From 5e47f6ab984a7d00782e4c7030afffa1ba480add Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 4 May 2023 15:29:34 +0200 Subject: Support studio transcoding in peertube runner --- shared/models/runners/runner-job-payload.model.ts | 13 ++++++++++++- .../models/runners/runner-job-private-payload.model.ts | 12 +++++++++++- shared/models/runners/runner-job-success-body.model.ts | 7 ++++++- shared/models/runners/runner-job-type.type.ts | 3 ++- shared/models/server/custom-config.model.ts | 4 ++++ shared/models/server/job.model.ts | 4 ++++ shared/models/server/server-config.model.ts | 6 +++++- .../videos/studio/video-studio-create-edit.model.ts | 18 ++++++++++++++++++ 8 files changed, 62 insertions(+), 5 deletions(-) (limited to 'shared/models') diff --git a/shared/models/runners/runner-job-payload.model.ts b/shared/models/runners/runner-job-payload.model.ts index 8f0c17135..9f0db0dc4 100644 --- a/shared/models/runners/runner-job-payload.model.ts +++ b/shared/models/runners/runner-job-payload.model.ts @@ -1,3 +1,5 @@ +import { VideoStudioTaskPayload } from '../server' + export type RunnerJobVODPayload = RunnerJobVODWebVideoTranscodingPayload | RunnerJobVODHLSTranscodingPayload | @@ -5,7 +7,8 @@ export type RunnerJobVODPayload = export type RunnerJobPayload = RunnerJobVODPayload | - RunnerJobLiveRTMPHLSTranscodingPayload + RunnerJobLiveRTMPHLSTranscodingPayload | + RunnerJobVideoEditionTranscodingPayload // --------------------------------------------------------------------------- @@ -43,6 +46,14 @@ export interface RunnerJobVODAudioMergeTranscodingPayload { } } +export interface RunnerJobVideoEditionTranscodingPayload { + input: { + videoFileUrl: string + } + + tasks: VideoStudioTaskPayload[] +} + // --------------------------------------------------------------------------- export function isAudioMergeTranscodingPayload (payload: RunnerJobPayload): payload is RunnerJobVODAudioMergeTranscodingPayload { diff --git a/shared/models/runners/runner-job-private-payload.model.ts b/shared/models/runners/runner-job-private-payload.model.ts index c1d8d1045..c8fe0a7d8 100644 --- a/shared/models/runners/runner-job-private-payload.model.ts +++ b/shared/models/runners/runner-job-private-payload.model.ts @@ -1,3 +1,5 @@ +import { VideoStudioTaskPayload } from '../server' + export type RunnerJobVODPrivatePayload = RunnerJobVODWebVideoTranscodingPrivatePayload | RunnerJobVODAudioMergeTranscodingPrivatePayload | @@ -5,7 +7,8 @@ export type RunnerJobVODPrivatePayload = export type RunnerJobPrivatePayload = RunnerJobVODPrivatePayload | - RunnerJobLiveRTMPHLSTranscodingPrivatePayload + RunnerJobLiveRTMPHLSTranscodingPrivatePayload | + RunnerJobVideoEditionTranscodingPrivatePayload // --------------------------------------------------------------------------- @@ -32,3 +35,10 @@ export interface RunnerJobLiveRTMPHLSTranscodingPrivatePayload { masterPlaylistName: string outputDirectory: string } + +// --------------------------------------------------------------------------- + +export interface RunnerJobVideoEditionTranscodingPrivatePayload { + videoUUID: string + originalTasks: VideoStudioTaskPayload[] +} diff --git a/shared/models/runners/runner-job-success-body.model.ts b/shared/models/runners/runner-job-success-body.model.ts index 223b7552d..17e921f69 100644 --- a/shared/models/runners/runner-job-success-body.model.ts +++ b/shared/models/runners/runner-job-success-body.model.ts @@ -11,7 +11,8 @@ export type RunnerJobSuccessPayload = VODWebVideoTranscodingSuccess | VODHLSTranscodingSuccess | VODAudioMergeTranscodingSuccess | - LiveRTMPHLSTranscodingSuccess + LiveRTMPHLSTranscodingSuccess | + VideoEditionTranscodingSuccess export interface VODWebVideoTranscodingSuccess { videoFile: Blob | string @@ -30,6 +31,10 @@ export interface LiveRTMPHLSTranscodingSuccess { } +export interface VideoEditionTranscodingSuccess { + videoFile: Blob | string +} + export function isWebVideoOrAudioMergeTranscodingPayloadSuccess ( payload: RunnerJobSuccessPayload ): payload is VODHLSTranscodingSuccess | VODAudioMergeTranscodingSuccess { diff --git a/shared/models/runners/runner-job-type.type.ts b/shared/models/runners/runner-job-type.type.ts index 36d3b9b25..3b997cb6e 100644 --- a/shared/models/runners/runner-job-type.type.ts +++ b/shared/models/runners/runner-job-type.type.ts @@ -2,4 +2,5 @@ export type RunnerJobType = 'vod-web-video-transcoding' | 'vod-hls-transcoding' | 'vod-audio-merge-transcoding' | - 'live-rtmp-hls-transcoding' + 'live-rtmp-hls-transcoding' | + 'video-edition-transcoding' diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts index 5d2c10278..4202589f3 100644 --- a/shared/models/server/custom-config.model.ts +++ b/shared/models/server/custom-config.model.ts @@ -165,6 +165,10 @@ export interface CustomConfig { videoStudio: { enabled: boolean + + remoteRunners: { + enabled: boolean + } } import: { diff --git a/shared/models/server/job.model.ts b/shared/models/server/job.model.ts index 3fd5bf7f9..22ecee324 100644 --- a/shared/models/server/job.model.ts +++ b/shared/models/server/job.model.ts @@ -225,6 +225,10 @@ export type VideoStudioTaskWatermarkPayload = { options: { file: string + + watermarkSizeRatio: number + horitonzalMarginRatio: number + verticalMarginRatio: number } } diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts index 38b9d0385..024ed35bf 100644 --- a/shared/models/server/server-config.model.ts +++ b/shared/models/server/server-config.model.ts @@ -1,6 +1,6 @@ -import { VideoPrivacy } from '../videos/video-privacy.enum' import { ClientScriptJSON } from '../plugins/plugin-package-json.model' import { NSFWPolicyType } from '../videos/nsfw-policy.type' +import { VideoPrivacy } from '../videos/video-privacy.enum' import { BroadcastMessageLevel } from './broadcast-message-level.type' export interface ServerConfigPlugin { @@ -186,6 +186,10 @@ export interface ServerConfig { videoStudio: { enabled: boolean + + remoteRunners: { + enabled: boolean + } } import: { diff --git a/shared/models/videos/studio/video-studio-create-edit.model.ts b/shared/models/videos/studio/video-studio-create-edit.model.ts index 001d65c90..5e8296dc9 100644 --- a/shared/models/videos/studio/video-studio-create-edit.model.ts +++ b/shared/models/videos/studio/video-studio-create-edit.model.ts @@ -40,3 +40,21 @@ export interface VideoStudioTaskWatermark { file: Blob | string } } + +// --------------------------------------------------------------------------- + +export function isVideoStudioTaskIntro (v: VideoStudioTask): v is VideoStudioTaskIntro { + return v.name === 'add-intro' +} + +export function isVideoStudioTaskOutro (v: VideoStudioTask): v is VideoStudioTaskOutro { + return v.name === 'add-outro' +} + +export function isVideoStudioTaskWatermark (v: VideoStudioTask): v is VideoStudioTaskWatermark { + return v.name === 'add-watermark' +} + +export function hasVideoStudioTaskFile (v: VideoStudioTask): v is VideoStudioTaskIntro | VideoStudioTaskOutro | VideoStudioTaskWatermark { + return isVideoStudioTaskIntro(v) || isVideoStudioTaskOutro(v) || isVideoStudioTaskWatermark(v) +} -- cgit v1.2.3