aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/live/live-manager.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-08-06 13:35:25 +0200
committerChocobozzz <me@florianbigard.com>2021-08-06 14:13:26 +0200
commit679c12e69c9f3a2d003ee3abe8b8da49f25b2bd3 (patch)
tree03abf589275db05e5b1fa1c89f57049cd807324a /server/lib/live/live-manager.ts
parentc826f34a45757b324a20f71665b44ed10e6953b5 (diff)
downloadPeerTube-679c12e69c9f3a2d003ee3abe8b8da49f25b2bd3.tar.gz
PeerTube-679c12e69c9f3a2d003ee3abe8b8da49f25b2bd3.tar.zst
PeerTube-679c12e69c9f3a2d003ee3abe8b8da49f25b2bd3.zip
Improve target bitrate calculation
Diffstat (limited to 'server/lib/live/live-manager.ts')
-rw-r--r--server/lib/live/live-manager.ts13
1 files changed, 8 insertions, 5 deletions
diff --git a/server/lib/live/live-manager.ts b/server/lib/live/live-manager.ts
index b19ecef6f..2a429fb33 100644
--- a/server/lib/live/live-manager.ts
+++ b/server/lib/live/live-manager.ts
@@ -202,7 +202,7 @@ class LiveManager {
202 const now = Date.now() 202 const now = Date.now()
203 const probe = await ffprobePromise(rtmpUrl) 203 const probe = await ffprobePromise(rtmpUrl)
204 204
205 const [ { videoFileResolution }, fps, bitrate ] = await Promise.all([ 205 const [ { resolution, ratio }, fps, bitrate ] = await Promise.all([
206 getVideoFileResolution(rtmpUrl, probe), 206 getVideoFileResolution(rtmpUrl, probe),
207 getVideoFileFPS(rtmpUrl, probe), 207 getVideoFileFPS(rtmpUrl, probe),
208 getVideoFileBitrate(rtmpUrl, probe) 208 getVideoFileBitrate(rtmpUrl, probe)
@@ -210,13 +210,13 @@ class LiveManager {
210 210
211 logger.info( 211 logger.info(
212 '%s probing took %d ms (bitrate: %d, fps: %d, resolution: %d)', 212 '%s probing took %d ms (bitrate: %d, fps: %d, resolution: %d)',
213 rtmpUrl, Date.now() - now, bitrate, fps, videoFileResolution, lTags(sessionId, video.uuid) 213 rtmpUrl, Date.now() - now, bitrate, fps, resolution, lTags(sessionId, video.uuid)
214 ) 214 )
215 215
216 const allResolutions = this.buildAllResolutionsToTranscode(videoFileResolution) 216 const allResolutions = this.buildAllResolutionsToTranscode(resolution)
217 217
218 logger.info( 218 logger.info(
219 'Will mux/transcode live video of original resolution %d.', videoFileResolution, 219 'Will mux/transcode live video of original resolution %d.', resolution,
220 { allResolutions, ...lTags(sessionId, video.uuid) } 220 { allResolutions, ...lTags(sessionId, video.uuid) }
221 ) 221 )
222 222
@@ -229,6 +229,7 @@ class LiveManager {
229 rtmpUrl, 229 rtmpUrl,
230 fps, 230 fps,
231 bitrate, 231 bitrate,
232 ratio,
232 allResolutions 233 allResolutions
233 }) 234 })
234 } 235 }
@@ -240,9 +241,10 @@ class LiveManager {
240 rtmpUrl: string 241 rtmpUrl: string
241 fps: number 242 fps: number
242 bitrate: number 243 bitrate: number
244 ratio: number
243 allResolutions: number[] 245 allResolutions: number[]
244 }) { 246 }) {
245 const { sessionId, videoLive, streamingPlaylist, allResolutions, fps, bitrate, rtmpUrl } = options 247 const { sessionId, videoLive, streamingPlaylist, allResolutions, fps, bitrate, ratio, rtmpUrl } = options
246 const videoUUID = videoLive.Video.uuid 248 const videoUUID = videoLive.Video.uuid
247 const localLTags = lTags(sessionId, videoUUID) 249 const localLTags = lTags(sessionId, videoUUID)
248 250
@@ -257,6 +259,7 @@ class LiveManager {
257 streamingPlaylist, 259 streamingPlaylist,
258 rtmpUrl, 260 rtmpUrl,
259 bitrate, 261 bitrate,
262 ratio,
260 fps, 263 fps,
261 allResolutions 264 allResolutions
262 }) 265 })