diff options
author | Chocobozzz <me@florianbigard.com> | 2023-05-30 09:35:21 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-05-30 09:35:21 +0200 |
commit | 29c7319c8a42d5c4831d08a80f4d111d3a72f52c (patch) | |
tree | 476b180ea7f84fd4d55b12fb1c06285676e173fd /server/lib/transcoding/transcoding-resolutions.ts | |
parent | 89eda2aab005e6c8f548acc80471ce4bad039ecd (diff) | |
download | PeerTube-29c7319c8a42d5c4831d08a80f4d111d3a72f52c.tar.gz PeerTube-29c7319c8a42d5c4831d08a80f4d111d3a72f52c.tar.zst PeerTube-29c7319c8a42d5c4831d08a80f4d111d3a72f52c.zip |
Fix transcoding error
When transcoding.always_transcode_original_resolution is false
Diffstat (limited to 'server/lib/transcoding/transcoding-resolutions.ts')
-rw-r--r-- | server/lib/transcoding/transcoding-resolutions.ts | 21 |
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' | |||
2 | import { toEven } from '@shared/core-utils' | 2 | import { toEven } from '@shared/core-utils' |
3 | import { VideoResolution } from '@shared/models' | 3 | import { VideoResolution } from '@shared/models' |
4 | 4 | ||
5 | export 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 | |||
5 | export function computeResolutionsToTranscode (options: { | 26 | export function computeResolutionsToTranscode (options: { |
6 | input: number | 27 | input: number |
7 | type: 'vod' | 'live' | 28 | type: 'vod' | 'live' |