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

Handle videos with FPS < 1

This commit is contained in:
Chocobozzz 2024-05-29 08:56:53 +02:00
parent 67c1f1985f
commit 4ea659d569
No known key found for this signature in database
GPG key ID: 583A612D890159BE
4 changed files with 22 additions and 10 deletions

View file

@ -18,13 +18,15 @@ export function computeOutputFPS (options: {
fps = getClosestFramerateStandard({ fps, type: 'STANDARD' })
}
// Hard FPS limits
if (fps > VIDEO_TRANSCODING_FPS.MAX) fps = getClosestFramerateStandard({ fps, type: 'HD_STANDARD' })
if (fps < VIDEO_TRANSCODING_FPS.MIN) {
throw new Error(`Cannot compute FPS because ${fps} is lower than our minimum value ${VIDEO_TRANSCODING_FPS.MIN}`)
if (fps < VIDEO_TRANSCODING_FPS.HARD_MIN) {
throw new Error(`Cannot compute FPS because ${fps} is lower than our minimum value ${VIDEO_TRANSCODING_FPS.HARD_MIN}`)
}
// Cap min FPS
if (fps < VIDEO_TRANSCODING_FPS.SOFT_MIN) fps = VIDEO_TRANSCODING_FPS.SOFT_MIN
// Cap max FPS
if (fps > VIDEO_TRANSCODING_FPS.SOFT_MAX) fps = getClosestFramerateStandard({ fps, type: 'HD_STANDARD' })
return fps
}