aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/transcoding/transcoding-resolutions.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/transcoding/transcoding-resolutions.ts')
-rw-r--r--server/lib/transcoding/transcoding-resolutions.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/server/lib/transcoding/transcoding-resolutions.ts b/server/lib/transcoding/transcoding-resolutions.ts
index 91f4d18d8..9a6bf5722 100644
--- a/server/lib/transcoding/transcoding-resolutions.ts
+++ b/server/lib/transcoding/transcoding-resolutions.ts
@@ -2,6 +2,27 @@ import { CONFIG } from '@server/initializers/config'
2import { toEven } from '@shared/core-utils' 2import { toEven } from '@shared/core-utils'
3import { VideoResolution } from '@shared/models' 3import { VideoResolution } from '@shared/models'
4 4
5export function buildOriginalFileResolution (inputResolution: number) {
6 if (CONFIG.TRANSCODING.ALWAYS_TRANSCODE_ORIGINAL_RESOLUTION === true) {
7 return toEven(inputResolution)
8 }
9
10 const resolutions = computeResolutionsToTranscode({
11 input: inputResolution,
12 type: 'vod',
13 includeInput: false,
14 strictLower: false,
15 // We don't really care about the audio resolution in this context
16 hasAudio: true
17 })
18
19 if (resolutions.length === 0) {
20 return toEven(inputResolution)
21 }
22
23 return Math.max(...resolutions)
24}
25
5export function computeResolutionsToTranscode (options: { 26export function computeResolutionsToTranscode (options: {
6 input: number 27 input: number
7 type: 'vod' | 'live' 28 type: 'vod' | 'live'