]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/live-manager.ts
add title attribute for exact view counters (#3365)
[github/Chocobozzz/PeerTube.git] / server / lib / live-manager.ts
index feb6c527597fb5b7cbcddb45411d2338e0d469c5..d63e79dfc6edb8055aa98ba8bfb9ee32e4127840 100644 (file)
@@ -4,13 +4,8 @@ import { FfmpegCommand } from 'fluent-ffmpeg'
 import { ensureDir, stat } from 'fs-extra'
 import { basename } from 'path'
 import { isTestInstance } from '@server/helpers/core-utils'
-import {
-  computeResolutionsToTranscode,
-  getVideoFileFPS,
-  getVideoFileResolution,
-  runLiveMuxing,
-  runLiveTranscoding
-} from '@server/helpers/ffmpeg-utils'
+import { getLiveMuxingCommand, getLiveTranscodingCommand } from '@server/helpers/ffmpeg-utils'
+import { computeResolutionsToTranscode, getVideoFileFPS, getVideoFileResolution } from '@server/helpers/ffprobe-utils'
 import { logger } from '@server/helpers/logger'
 import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config'
 import { MEMOIZE_TTL, P2P_MEDIA_LOADER_PEER_VERSION, VIDEO_LIVE, VIEW_LIFETIME, WEBSERVER } from '@server/initializers/constants'
@@ -27,6 +22,7 @@ import { JobQueue } from './job-queue'
 import { PeerTubeSocket } from './peertube-socket'
 import { isAbleToUploadVideo } from './user'
 import { getHLSDirectory } from './video-paths'
+import { availableEncoders } from './video-transcoding-profiles'
 
 import memoizee = require('memoizee')
 const NodeRtmpServer = require('node-media-server/node_rtmp_server')
@@ -269,8 +265,16 @@ class LiveManager {
     const deleteSegments = videoLive.saveReplay === false
 
     const ffmpegExec = CONFIG.LIVE.TRANSCODING.ENABLED
-      ? runLiveTranscoding(rtmpUrl, outPath, allResolutions, fps, deleteSegments)
-      : runLiveMuxing(rtmpUrl, outPath, deleteSegments)
+      ? await getLiveTranscodingCommand({
+        rtmpUrl,
+        outPath,
+        resolutions: allResolutions,
+        fps,
+        deleteSegments,
+        availableEncoders,
+        profile: 'default'
+      })
+      : getLiveMuxingCommand(rtmpUrl, outPath, deleteSegments)
 
     logger.info('Running live muxing/transcoding for %s.', videoUUID)
     this.transSessions.set(sessionId, ffmpegExec)
@@ -387,6 +391,8 @@ class LiveManager {
     })
 
     ffmpegExec.on('end', () => onFFmpegEnded())
+
+    ffmpegExec.run()
   }
 
   private async onEndTransmuxing (videoId: number, cleanupNow = false) {