1
0
Fork 0

Fix retranscoding of odd resolution

This commit is contained in:
Chocobozzz 2022-11-07 10:43:22 +01:00
parent c0a9de6652
commit f30ef8cf98
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 9 additions and 3 deletions

View file

@ -15,6 +15,7 @@ import {
import { VideoResolution, VideoTranscodingFPS } from '@shared/models'
import { CONFIG } from '../../initializers/config'
import { VIDEO_TRANSCODING_FPS } from '../../initializers/constants'
import { toEven } from '../core-utils'
import { logger } from '../logger'
/**
@ -133,7 +134,8 @@ function computeResolutionsToTranscode (options: {
}
if (includeInput) {
resolutionsEnabled.add(input)
// Always use an even resolution to avoid issues with ffmpeg
resolutionsEnabled.add(toEven(input))
}
return Array.from(resolutionsEnabled)

View file

@ -444,7 +444,9 @@ async function generateHlsPlaylistCommon (options: {
}
function buildOriginalFileResolution (inputResolution: number) {
if (CONFIG.TRANSCODING.ALWAYS_TRANSCODE_ORIGINAL_RESOLUTION === true) return toEven(inputResolution)
if (CONFIG.TRANSCODING.ALWAYS_TRANSCODE_ORIGINAL_RESOLUTION === true) {
return toEven(inputResolution)
}
const resolutions = computeResolutionsToTranscode({
input: inputResolution,
@ -455,7 +457,9 @@ function buildOriginalFileResolution (inputResolution: number) {
hasAudio: true
})
if (resolutions.length === 0) return toEven(inputResolution)
if (resolutions.length === 0) {
return toEven(inputResolution)
}
return Math.max(...resolutions)
}