diff options
Diffstat (limited to 'server/helpers/ffmpeg-utils.ts')
-rw-r--r-- | server/helpers/ffmpeg-utils.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts index ced56b82d..f8299c36f 100644 --- a/server/helpers/ffmpeg-utils.ts +++ b/server/helpers/ffmpeg-utils.ts | |||
@@ -7,6 +7,28 @@ import { processImage } from './image-utils' | |||
7 | import { logger } from './logger' | 7 | import { logger } from './logger' |
8 | import { checkFFmpegEncoders } from '../initializers/checker' | 8 | import { checkFFmpegEncoders } from '../initializers/checker' |
9 | 9 | ||
10 | function computeResolutionsToTranscode (videoFileHeight: number) { | ||
11 | const resolutionsEnabled: number[] = [] | ||
12 | const configResolutions = CONFIG.TRANSCODING.RESOLUTIONS | ||
13 | |||
14 | // Put in the order we want to proceed jobs | ||
15 | const resolutions = [ | ||
16 | VideoResolution.H_480P, | ||
17 | VideoResolution.H_360P, | ||
18 | VideoResolution.H_720P, | ||
19 | VideoResolution.H_240P, | ||
20 | VideoResolution.H_1080P | ||
21 | ] | ||
22 | |||
23 | for (const resolution of resolutions) { | ||
24 | if (configResolutions[ resolution + 'p' ] === true && videoFileHeight > resolution) { | ||
25 | resolutionsEnabled.push(resolution) | ||
26 | } | ||
27 | } | ||
28 | |||
29 | return resolutionsEnabled | ||
30 | } | ||
31 | |||
10 | async function getVideoFileResolution (path: string) { | 32 | async function getVideoFileResolution (path: string) { |
11 | const videoStream = await getVideoFileStream(path) | 33 | const videoStream = await getVideoFileStream(path) |
12 | 34 | ||
@@ -134,6 +156,7 @@ export { | |||
134 | generateImageFromVideoFile, | 156 | generateImageFromVideoFile, |
135 | transcode, | 157 | transcode, |
136 | getVideoFileFPS, | 158 | getVideoFileFPS, |
159 | computeResolutionsToTranscode, | ||
137 | audio | 160 | audio |
138 | } | 161 | } |
139 | 162 | ||