diff options
Diffstat (limited to 'server/lib/live/live-manager.ts')
-rw-r--r-- | server/lib/live/live-manager.ts | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/server/lib/live/live-manager.ts b/server/lib/live/live-manager.ts index f106d69fb..b19ecef6f 100644 --- a/server/lib/live/live-manager.ts +++ b/server/lib/live/live-manager.ts | |||
@@ -1,7 +1,13 @@ | |||
1 | 1 | ||
2 | import { createServer, Server } from 'net' | 2 | import { createServer, Server } from 'net' |
3 | import { isTestInstance } from '@server/helpers/core-utils' | 3 | import { isTestInstance } from '@server/helpers/core-utils' |
4 | import { computeResolutionsToTranscode, getVideoFileFPS, getVideoFileResolution } from '@server/helpers/ffprobe-utils' | 4 | import { |
5 | computeResolutionsToTranscode, | ||
6 | ffprobePromise, | ||
7 | getVideoFileBitrate, | ||
8 | getVideoFileFPS, | ||
9 | getVideoFileResolution | ||
10 | } from '@server/helpers/ffprobe-utils' | ||
5 | import { logger, loggerTagsFactory } from '@server/helpers/logger' | 11 | import { logger, loggerTagsFactory } from '@server/helpers/logger' |
6 | import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config' | 12 | import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config' |
7 | import { P2P_MEDIA_LOADER_PEER_VERSION, VIDEO_LIVE, VIEW_LIFETIME } from '@server/initializers/constants' | 13 | import { P2P_MEDIA_LOADER_PEER_VERSION, VIDEO_LIVE, VIEW_LIFETIME } from '@server/initializers/constants' |
@@ -193,11 +199,20 @@ class LiveManager { | |||
193 | 199 | ||
194 | const rtmpUrl = 'rtmp://127.0.0.1:' + config.rtmp.port + streamPath | 200 | const rtmpUrl = 'rtmp://127.0.0.1:' + config.rtmp.port + streamPath |
195 | 201 | ||
196 | const [ { videoFileResolution }, fps ] = await Promise.all([ | 202 | const now = Date.now() |
197 | getVideoFileResolution(rtmpUrl), | 203 | const probe = await ffprobePromise(rtmpUrl) |
198 | getVideoFileFPS(rtmpUrl) | 204 | |
205 | const [ { videoFileResolution }, fps, bitrate ] = await Promise.all([ | ||
206 | getVideoFileResolution(rtmpUrl, probe), | ||
207 | getVideoFileFPS(rtmpUrl, probe), | ||
208 | getVideoFileBitrate(rtmpUrl, probe) | ||
199 | ]) | 209 | ]) |
200 | 210 | ||
211 | logger.info( | ||
212 | '%s probing took %d ms (bitrate: %d, fps: %d, resolution: %d)', | ||
213 | rtmpUrl, Date.now() - now, bitrate, fps, videoFileResolution, lTags(sessionId, video.uuid) | ||
214 | ) | ||
215 | |||
201 | const allResolutions = this.buildAllResolutionsToTranscode(videoFileResolution) | 216 | const allResolutions = this.buildAllResolutionsToTranscode(videoFileResolution) |
202 | 217 | ||
203 | logger.info( | 218 | logger.info( |
@@ -213,6 +228,7 @@ class LiveManager { | |||
213 | streamingPlaylist, | 228 | streamingPlaylist, |
214 | rtmpUrl, | 229 | rtmpUrl, |
215 | fps, | 230 | fps, |
231 | bitrate, | ||
216 | allResolutions | 232 | allResolutions |
217 | }) | 233 | }) |
218 | } | 234 | } |
@@ -223,9 +239,10 @@ class LiveManager { | |||
223 | streamingPlaylist: MStreamingPlaylistVideo | 239 | streamingPlaylist: MStreamingPlaylistVideo |
224 | rtmpUrl: string | 240 | rtmpUrl: string |
225 | fps: number | 241 | fps: number |
242 | bitrate: number | ||
226 | allResolutions: number[] | 243 | allResolutions: number[] |
227 | }) { | 244 | }) { |
228 | const { sessionId, videoLive, streamingPlaylist, allResolutions, fps, rtmpUrl } = options | 245 | const { sessionId, videoLive, streamingPlaylist, allResolutions, fps, bitrate, rtmpUrl } = options |
229 | const videoUUID = videoLive.Video.uuid | 246 | const videoUUID = videoLive.Video.uuid |
230 | const localLTags = lTags(sessionId, videoUUID) | 247 | const localLTags = lTags(sessionId, videoUUID) |
231 | 248 | ||
@@ -239,6 +256,7 @@ class LiveManager { | |||
239 | videoLive, | 256 | videoLive, |
240 | streamingPlaylist, | 257 | streamingPlaylist, |
241 | rtmpUrl, | 258 | rtmpUrl, |
259 | bitrate, | ||
242 | fps, | 260 | fps, |
243 | allResolutions | 261 | allResolutions |
244 | }) | 262 | }) |