aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/ffmpeg/ffprobe-utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/ffmpeg/ffprobe-utils.ts')
-rw-r--r--server/helpers/ffmpeg/ffprobe-utils.ts22
1 files changed, 14 insertions, 8 deletions
diff --git a/server/helpers/ffmpeg/ffprobe-utils.ts b/server/helpers/ffmpeg/ffprobe-utils.ts
index 7bcd27665..c45f9ec99 100644
--- a/server/helpers/ffmpeg/ffprobe-utils.ts
+++ b/server/helpers/ffmpeg/ffprobe-utils.ts
@@ -91,11 +91,12 @@ async function getAudioStreamCodec (path: string, existingProbe?: FfprobeData) {
91// --------------------------------------------------------------------------- 91// ---------------------------------------------------------------------------
92 92
93function computeResolutionsToTranscode (options: { 93function computeResolutionsToTranscode (options: {
94 inputResolution: number 94 input: number
95 type: 'vod' | 'live' 95 type: 'vod' | 'live'
96 includeInputResolution: boolean 96 includeInput: boolean
97 strictLower: boolean
97}) { 98}) {
98 const { inputResolution, type, includeInputResolution } = options 99 const { input, type, includeInput, strictLower } = options
99 100
100 const configResolutions = type === 'vod' 101 const configResolutions = type === 'vod'
101 ? CONFIG.TRANSCODING.RESOLUTIONS 102 ? CONFIG.TRANSCODING.RESOLUTIONS
@@ -117,13 +118,18 @@ function computeResolutionsToTranscode (options: {
117 ] 118 ]
118 119
119 for (const resolution of availableResolutions) { 120 for (const resolution of availableResolutions) {
120 if (configResolutions[resolution + 'p'] === true && inputResolution > resolution) { 121 // Resolution not enabled
121 resolutionsEnabled.add(resolution) 122 if (configResolutions[resolution + 'p'] !== true) continue
122 } 123 // Too big resolution for input file
124 if (input < resolution) continue
125 // We only want lower resolutions than input file
126 if (strictLower && input === resolution) continue
127
128 resolutionsEnabled.add(resolution)
123 } 129 }
124 130
125 if (includeInputResolution) { 131 if (includeInput) {
126 resolutionsEnabled.add(inputResolution) 132 resolutionsEnabled.add(input)
127 } 133 }
128 134
129 return Array.from(resolutionsEnabled) 135 return Array.from(resolutionsEnabled)