mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-09-11 21:47:09 +03:00
Handle videos with FPS < 1
This commit is contained in:
parent
67c1f1985f
commit
4ea659d569
@ -120,7 +120,7 @@ export class FFmpegImage {
|
|||||||
|
|
||||||
const filter = [
|
const filter = [
|
||||||
// Fix "t" variable with some videos
|
// Fix "t" variable with some videos
|
||||||
`setpts=N/round(FRAME_RATE)/TB`,
|
`setpts='N/FRAME_RATE/TB'`,
|
||||||
// First frame or the time difference between the last and the current frame is enough for our sprite interval
|
// First frame or the time difference between the last and the current frame is enough for our sprite interval
|
||||||
`select='isnan(prev_selected_t)+gte(t-prev_selected_t,${options.sprites.duration})'`,
|
`select='isnan(prev_selected_t)+gte(t-prev_selected_t,${options.sprites.duration})'`,
|
||||||
`scale=${sprites.size.width}:${sprites.size.height}`,
|
`scale=${sprites.size.width}:${sprites.size.height}`,
|
||||||
|
@ -1,9 +1,18 @@
|
|||||||
export type VideoTranscodingFPS = {
|
export type VideoTranscodingFPS = {
|
||||||
MIN: number
|
// Refuse videos with FPS below this limit
|
||||||
|
HARD_MIN: number
|
||||||
|
// Cap FPS to this min value
|
||||||
|
SOFT_MIN: number
|
||||||
|
|
||||||
STANDARD: number[]
|
STANDARD: number[]
|
||||||
HD_STANDARD: number[]
|
HD_STANDARD: number[]
|
||||||
|
|
||||||
AUDIO_MERGE: number
|
AUDIO_MERGE: number
|
||||||
|
|
||||||
AVERAGE: number
|
AVERAGE: number
|
||||||
MAX: number
|
|
||||||
|
// Cap FPS to this max value
|
||||||
|
SOFT_MAX: number
|
||||||
|
|
||||||
KEEP_ORIGIN_FPS_RESOLUTION_MIN: number
|
KEEP_ORIGIN_FPS_RESOLUTION_MIN: number
|
||||||
}
|
}
|
||||||
|
@ -18,13 +18,15 @@ export function computeOutputFPS (options: {
|
|||||||
fps = getClosestFramerateStandard({ fps, type: 'STANDARD' })
|
fps = getClosestFramerateStandard({ fps, type: 'STANDARD' })
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hard FPS limits
|
if (fps < VIDEO_TRANSCODING_FPS.HARD_MIN) {
|
||||||
if (fps > VIDEO_TRANSCODING_FPS.MAX) fps = getClosestFramerateStandard({ fps, type: 'HD_STANDARD' })
|
throw new Error(`Cannot compute FPS because ${fps} is lower than our minimum value ${VIDEO_TRANSCODING_FPS.HARD_MIN}`)
|
||||||
|
|
||||||
if (fps < VIDEO_TRANSCODING_FPS.MIN) {
|
|
||||||
throw new Error(`Cannot compute FPS because ${fps} is lower than our minimum value ${VIDEO_TRANSCODING_FPS.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
|
return fps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,12 +513,13 @@ const MAX_LOCAL_VIEWER_WATCH_SECTIONS = 100
|
|||||||
let CONTACT_FORM_LIFETIME = 60000 * 60 // 1 hour
|
let CONTACT_FORM_LIFETIME = 60000 * 60 // 1 hour
|
||||||
|
|
||||||
const VIDEO_TRANSCODING_FPS: VideoTranscodingFPS = {
|
const VIDEO_TRANSCODING_FPS: VideoTranscodingFPS = {
|
||||||
MIN: 1,
|
HARD_MIN: 0.1,
|
||||||
|
SOFT_MIN: 1,
|
||||||
STANDARD: [ 24, 25, 30 ],
|
STANDARD: [ 24, 25, 30 ],
|
||||||
HD_STANDARD: [ 50, 60 ],
|
HD_STANDARD: [ 50, 60 ],
|
||||||
AUDIO_MERGE: 25,
|
AUDIO_MERGE: 25,
|
||||||
AVERAGE: 30,
|
AVERAGE: 30,
|
||||||
MAX: 60,
|
SOFT_MAX: 60,
|
||||||
KEEP_ORIGIN_FPS_RESOLUTION_MIN: 720 // We keep the original FPS on high resolutions (720 minimum)
|
KEEP_ORIGIN_FPS_RESOLUTION_MIN: 720 // We keep the original FPS on high resolutions (720 minimum)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user