From 41085b1583ade5ea1bb1d69965a62b98cf012209 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 11 Oct 2021 15:59:15 +0200 Subject: [PATCH] Fix live bitrate --- server/lib/live/shared/muxing-session.ts | 2 +- server/lib/transcoding/video-transcoding-profiles.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/lib/live/shared/muxing-session.ts b/server/lib/live/shared/muxing-session.ts index a6907142d..b52363af7 100644 --- a/server/lib/live/shared/muxing-session.ts +++ b/server/lib/live/shared/muxing-session.ts @@ -101,7 +101,7 @@ class MuxingSession extends EventEmitter { this.fps = options.fps this.bitrate = options.bitrate - this.ratio = options.bitrate + this.ratio = options.ratio this.allResolutions = options.allResolutions diff --git a/server/lib/transcoding/video-transcoding-profiles.ts b/server/lib/transcoding/video-transcoding-profiles.ts index a8176dca5..848b823e6 100644 --- a/server/lib/transcoding/video-transcoding-profiles.ts +++ b/server/lib/transcoding/video-transcoding-profiles.ts @@ -237,5 +237,8 @@ export { function capBitrate (inputBitrate: number, targetBitrate: number) { if (!inputBitrate) return targetBitrate - return Math.min(targetBitrate, inputBitrate) + // Add 30% margin to input bitrate + const inputBitrateWithMargin = inputBitrate + (inputBitrate * 0.3) + + return Math.min(targetBitrate, inputBitrateWithMargin) }