From c729caf6cc34630877a0e5a1bda1719384cd0c8a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 11 Feb 2022 10:51:33 +0100 Subject: Add basic video editor support --- shared/models/server/custom-config.model.ts | 4 +++ shared/models/server/job.model.ts | 39 ++++++++++++++++++++ shared/models/server/server-config.model.ts | 4 +++ shared/models/videos/editor/index.ts | 1 + .../editor/video-editor-create-edit.model.ts | 42 ++++++++++++++++++++++ shared/models/videos/index.ts | 1 + .../transcoding/video-transcoding-fps.model.ts | 1 + .../videos/transcoding/video-transcoding.model.ts | 7 ++-- shared/models/videos/video-state.enum.ts | 3 +- 9 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 shared/models/videos/editor/index.ts create mode 100644 shared/models/videos/editor/video-editor-create-edit.model.ts (limited to 'shared/models') diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts index 52d3d9588..c9e7654de 100644 --- a/shared/models/server/custom-config.model.ts +++ b/shared/models/server/custom-config.model.ts @@ -143,6 +143,10 @@ export interface CustomConfig { } } + videoEditor: { + enabled: boolean + } + import: { videos: { concurrency: number diff --git a/shared/models/server/job.model.ts b/shared/models/server/job.model.ts index 1519d1c3e..d0293f542 100644 --- a/shared/models/server/job.model.ts +++ b/shared/models/server/job.model.ts @@ -1,4 +1,5 @@ import { ContextType } from '../activitypub/context' +import { VideoEditorTaskCut } from '../videos/editor' import { VideoResolution } from '../videos/file/video-resolution.enum' import { SendEmailOptions } from './emailer.model' @@ -20,6 +21,7 @@ export type JobType = | 'video-live-ending' | 'actor-keys' | 'move-to-object-storage' + | 'video-edition' export interface Job { id: number @@ -155,3 +157,40 @@ export interface MoveObjectStoragePayload { videoUUID: string isNewVideo: boolean } + +export type VideoEditorTaskCutPayload = VideoEditorTaskCut + +export type VideoEditorTaskIntroPayload = { + name: 'add-intro' + + options: { + file: string + } +} + +export type VideoEditorTaskOutroPayload = { + name: 'add-outro' + + options: { + file: string + } +} + +export type VideoEditorTaskWatermarkPayload = { + name: 'add-watermark' + + options: { + file: string + } +} + +export type VideoEditionTaskPayload = + VideoEditorTaskCutPayload | + VideoEditorTaskIntroPayload | + VideoEditorTaskOutroPayload | + VideoEditorTaskWatermarkPayload + +export interface VideoEditionPayload { + videoUUID: string + tasks: VideoEditionTaskPayload[] +} diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts index 32be96b9d..0fe8b0de8 100644 --- a/shared/models/server/server-config.model.ts +++ b/shared/models/server/server-config.model.ts @@ -167,6 +167,10 @@ export interface ServerConfig { } } + videoEditor: { + enabled: boolean + } + import: { videos: { http: { diff --git a/shared/models/videos/editor/index.ts b/shared/models/videos/editor/index.ts new file mode 100644 index 000000000..3436f2c3f --- /dev/null +++ b/shared/models/videos/editor/index.ts @@ -0,0 +1 @@ +export * from './video-editor-create-edit.model' diff --git a/shared/models/videos/editor/video-editor-create-edit.model.ts b/shared/models/videos/editor/video-editor-create-edit.model.ts new file mode 100644 index 000000000..36b7c8d55 --- /dev/null +++ b/shared/models/videos/editor/video-editor-create-edit.model.ts @@ -0,0 +1,42 @@ +export interface VideoEditorCreateEdition { + tasks: VideoEditorTask[] +} + +export type VideoEditorTask = + VideoEditorTaskCut | + VideoEditorTaskIntro | + VideoEditorTaskOutro | + VideoEditorTaskWatermark + +export interface VideoEditorTaskCut { + name: 'cut' + + options: { + start?: number + end?: number + } +} + +export interface VideoEditorTaskIntro { + name: 'add-intro' + + options: { + file: Blob | string + } +} + +export interface VideoEditorTaskOutro { + name: 'add-outro' + + options: { + file: Blob | string + } +} + +export interface VideoEditorTaskWatermark { + name: 'add-watermark' + + options: { + file: Blob | string + } +} diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.ts index 67614efc9..e8eb227ab 100644 --- a/shared/models/videos/index.ts +++ b/shared/models/videos/index.ts @@ -3,6 +3,7 @@ export * from './caption' export * from './change-ownership' export * from './channel' export * from './comment' +export * from './editor' export * from './live' export * from './file' export * from './import' diff --git a/shared/models/videos/transcoding/video-transcoding-fps.model.ts b/shared/models/videos/transcoding/video-transcoding-fps.model.ts index 25fc1c2da..9a330ac94 100644 --- a/shared/models/videos/transcoding/video-transcoding-fps.model.ts +++ b/shared/models/videos/transcoding/video-transcoding-fps.model.ts @@ -2,6 +2,7 @@ export type VideoTranscodingFPS = { MIN: number STANDARD: number[] HD_STANDARD: number[] + AUDIO_MERGE: number AVERAGE: number MAX: number KEEP_ORIGIN_FPS_RESOLUTION_MIN: number diff --git a/shared/models/videos/transcoding/video-transcoding.model.ts b/shared/models/videos/transcoding/video-transcoding.model.ts index 3a7fb6472..91eacf8dc 100644 --- a/shared/models/videos/transcoding/video-transcoding.model.ts +++ b/shared/models/videos/transcoding/video-transcoding.model.ts @@ -7,8 +7,11 @@ export type EncoderOptionsBuilderParams = { resolution: VideoResolution - // Could be null for "merge audio" transcoding - fps?: number + // If PeerTube applies a filter, transcoding profile must not copy input stream + canCopyAudio: boolean + canCopyVideo: boolean + + fps: number // Could be undefined if we could not get input bitrate (some RTMP streams for example) inputBitrate: number diff --git a/shared/models/videos/video-state.enum.ts b/shared/models/videos/video-state.enum.ts index 09268d2ff..e45e4adc2 100644 --- a/shared/models/videos/video-state.enum.ts +++ b/shared/models/videos/video-state.enum.ts @@ -6,5 +6,6 @@ export const enum VideoState { LIVE_ENDED = 5, TO_MOVE_TO_EXTERNAL_STORAGE = 6, TRANSCODING_FAILED = 7, - TO_MOVE_TO_EXTERNAL_STORAGE_FAILED = 8 + TO_MOVE_TO_EXTERNAL_STORAGE_FAILED = 8, + TO_EDIT = 9 } -- cgit v1.2.3