aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models/videos/transcoding
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-11-18 14:35:08 +0100
committerChocobozzz <me@florianbigard.com>2021-11-18 15:20:57 +0100
commitad5db1044c8599eaaaa2a578b350777ae996b068 (patch)
tree3e003cccf021152405d49b21c6c91b703c8ae96c /shared/models/videos/transcoding
parentb46cf4b920984492df598c1b61179acfc7f6f22e (diff)
downloadPeerTube-ad5db1044c8599eaaaa2a578b350777ae996b068.tar.gz
PeerTube-ad5db1044c8599eaaaa2a578b350777ae996b068.tar.zst
PeerTube-ad5db1044c8599eaaaa2a578b350777ae996b068.zip
Add ability to run transcoding jobs
Diffstat (limited to 'shared/models/videos/transcoding')
-rw-r--r--shared/models/videos/transcoding/index.ts3
-rw-r--r--shared/models/videos/transcoding/video-transcoding-create.model.ts3
-rw-r--r--shared/models/videos/transcoding/video-transcoding-fps.model.ts8
-rw-r--r--shared/models/videos/transcoding/video-transcoding.model.ts64
4 files changed, 78 insertions, 0 deletions
diff --git a/shared/models/videos/transcoding/index.ts b/shared/models/videos/transcoding/index.ts
new file mode 100644
index 000000000..14472d900
--- /dev/null
+++ b/shared/models/videos/transcoding/index.ts
@@ -0,0 +1,3 @@
1export * from './video-transcoding-create.model'
2export * from './video-transcoding-fps.model'
3export * from './video-transcoding.model'
diff --git a/shared/models/videos/transcoding/video-transcoding-create.model.ts b/shared/models/videos/transcoding/video-transcoding-create.model.ts
new file mode 100644
index 000000000..aeb393e57
--- /dev/null
+++ b/shared/models/videos/transcoding/video-transcoding-create.model.ts
@@ -0,0 +1,3 @@
1export interface VideoTranscodingCreate {
2 transcodingType: 'hls' | 'webtorrent'
3}
diff --git a/shared/models/videos/transcoding/video-transcoding-fps.model.ts b/shared/models/videos/transcoding/video-transcoding-fps.model.ts
new file mode 100644
index 000000000..25fc1c2da
--- /dev/null
+++ b/shared/models/videos/transcoding/video-transcoding-fps.model.ts
@@ -0,0 +1,8 @@
1export type VideoTranscodingFPS = {
2 MIN: number
3 STANDARD: number[]
4 HD_STANDARD: number[]
5 AVERAGE: number
6 MAX: number
7 KEEP_ORIGIN_FPS_RESOLUTION_MIN: number
8}
diff --git a/shared/models/videos/transcoding/video-transcoding.model.ts b/shared/models/videos/transcoding/video-transcoding.model.ts
new file mode 100644
index 000000000..3a7fb6472
--- /dev/null
+++ b/shared/models/videos/transcoding/video-transcoding.model.ts
@@ -0,0 +1,64 @@
1import { VideoResolution } from '../file/video-resolution.enum'
2
3// Types used by plugins and ffmpeg-utils
4
5export type EncoderOptionsBuilderParams = {
6 input: string
7
8 resolution: VideoResolution
9
10 // Could be null for "merge audio" transcoding
11 fps?: number
12
13 // Could be undefined if we could not get input bitrate (some RTMP streams for example)
14 inputBitrate: number
15 inputRatio: number
16
17 // For lives
18 streamNum?: number
19}
20
21export type EncoderOptionsBuilder = (params: EncoderOptionsBuilderParams) => Promise<EncoderOptions> | EncoderOptions
22
23export interface EncoderOptions {
24 copy?: boolean // Copy stream? Default to false
25
26 scaleFilter?: {
27 name: string
28 }
29
30 inputOptions?: string[]
31 outputOptions?: string[]
32}
33
34// All our encoders
35
36export interface EncoderProfile <T> {
37 [ profile: string ]: T
38
39 default: T
40}
41
42export type AvailableEncoders = {
43 available: {
44 live: {
45 [ encoder: string ]: EncoderProfile<EncoderOptionsBuilder>
46 }
47
48 vod: {
49 [ encoder: string ]: EncoderProfile<EncoderOptionsBuilder>
50 }
51 }
52
53 encodersToTry: {
54 vod: {
55 video: string[]
56 audio: string[]
57 }
58
59 live: {
60 video: string[]
61 audio: string[]
62 }
63 }
64}