mirror of https://github.com/Chocobozzz/PeerTube
Fix retranscoding of odd resolution
parent
c0a9de6652
commit
f30ef8cf98
|
@ -15,6 +15,7 @@ import {
|
||||||
import { VideoResolution, VideoTranscodingFPS } from '@shared/models'
|
import { VideoResolution, VideoTranscodingFPS } from '@shared/models'
|
||||||
import { CONFIG } from '../../initializers/config'
|
import { CONFIG } from '../../initializers/config'
|
||||||
import { VIDEO_TRANSCODING_FPS } from '../../initializers/constants'
|
import { VIDEO_TRANSCODING_FPS } from '../../initializers/constants'
|
||||||
|
import { toEven } from '../core-utils'
|
||||||
import { logger } from '../logger'
|
import { logger } from '../logger'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -133,7 +134,8 @@ function computeResolutionsToTranscode (options: {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includeInput) {
|
if (includeInput) {
|
||||||
resolutionsEnabled.add(input)
|
// Always use an even resolution to avoid issues with ffmpeg
|
||||||
|
resolutionsEnabled.add(toEven(input))
|
||||||
}
|
}
|
||||||
|
|
||||||
return Array.from(resolutionsEnabled)
|
return Array.from(resolutionsEnabled)
|
||||||
|
|
|
@ -444,7 +444,9 @@ async function generateHlsPlaylistCommon (options: {
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildOriginalFileResolution (inputResolution: number) {
|
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({
|
const resolutions = computeResolutionsToTranscode({
|
||||||
input: inputResolution,
|
input: inputResolution,
|
||||||
|
@ -455,7 +457,9 @@ function buildOriginalFileResolution (inputResolution: number) {
|
||||||
hasAudio: true
|
hasAudio: true
|
||||||
})
|
})
|
||||||
|
|
||||||
if (resolutions.length === 0) return toEven(inputResolution)
|
if (resolutions.length === 0) {
|
||||||
|
return toEven(inputResolution)
|
||||||
|
}
|
||||||
|
|
||||||
return Math.max(...resolutions)
|
return Math.max(...resolutions)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue