ActivityPub-federated video streaming platform using P2P directly in your web browser
Handle videos with FPS < 1
Chocobozzz4ea659d569d5
diff --git a/packages/ffmpeg/src/ffmpeg-images.ts b/packages/ffmpeg/src/ffmpeg-images.tsindex 52076de546..b34e22f5e0 100644--- a/packages/ffmpeg/src/ffmpeg-images.ts+++ b/packages/ffmpeg/src/ffmpeg-images.ts@@ -120,7 +120,7 @@ export class FFmpegImage {const filter = [// 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`select='isnan(prev_selected_t)+gte(t-prev_selected_t,${options.sprites.duration})'`,`scale=${sprites.size.width}:${sprites.size.height}`,diff --git a/packages/models/src/videos/transcoding/video-transcoding-fps.model.ts b/packages/models/src/videos/transcoding/video-transcoding-fps.model.tsindex 9a330ac94b..c0a44c5d1e 100644--- a/packages/models/src/videos/transcoding/video-transcoding-fps.model.ts+++ b/packages/models/src/videos/transcoding/video-transcoding-fps.model.ts@@ -1,9 +1,18 @@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[]HD_STANDARD: number[]+AUDIO_MERGE: number+AVERAGE: number- MAX: number++ // Cap FPS to this max value+ SOFT_MAX: number+KEEP_ORIGIN_FPS_RESOLUTION_MIN: number}diff --git a/server/core/helpers/ffmpeg/framerate.ts b/server/core/helpers/ffmpeg/framerate.tsindex 8aef6f021d..7d06cd3b1e 100644--- a/server/core/helpers/ffmpeg/framerate.ts+++ b/server/core/helpers/ffmpeg/framerate.ts@@ -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}diff --git a/server/core/initializers/constants.ts b/server/core/initializers/constants.tsindex a3a0b4951d..4b6eecadc5 100644--- a/server/core/initializers/constants.ts+++ b/server/core/initializers/constants.ts@@ -513,12 +513,13 @@ const MAX_LOCAL_VIEWER_WATCH_SECTIONS = 100let CONTACT_FORM_LIFETIME = 60000 * 60 // 1 hourconst VIDEO_TRANSCODING_FPS: VideoTranscodingFPS = {- MIN: 1,+ HARD_MIN: 0.1,+ SOFT_MIN: 1,STANDARD: [ 24, 25, 30 ],HD_STANDARD: [ 50, 60 ],AUDIO_MERGE: 25,AVERAGE: 30,- MAX: 60,+ SOFT_MAX: 60,KEEP_ORIGIN_FPS_RESOLUTION_MIN: 720 // We keep the original FPS on high resolutions (720 minimum)}