1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Fix transcoding error

When transcoding.always_transcode_original_resolution is false
This commit is contained in:
Chocobozzz 2023-05-30 09:35:21 +02:00
parent 89eda2aab0
commit 29c7319c8a
No known key found for this signature in database
GPG key ID: 583A612D890159BE
4 changed files with 33 additions and 36 deletions

View file

@ -2,6 +2,27 @@ import { CONFIG } from '@server/initializers/config'
import { toEven } from '@shared/core-utils'
import { VideoResolution } from '@shared/models'
export function buildOriginalFileResolution (inputResolution: number) {
if (CONFIG.TRANSCODING.ALWAYS_TRANSCODE_ORIGINAL_RESOLUTION === true) {
return toEven(inputResolution)
}
const resolutions = computeResolutionsToTranscode({
input: inputResolution,
type: 'vod',
includeInput: false,
strictLower: false,
// We don't really care about the audio resolution in this context
hasAudio: true
})
if (resolutions.length === 0) {
return toEven(inputResolution)
}
return Math.max(...resolutions)
}
export function computeResolutionsToTranscode (options: {
input: number
type: 'vod' | 'live'