X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Flive-manager.ts;h=d63e79dfc6edb8055aa98ba8bfb9ee32e4127840;hb=992f498e312efcde46f818ba719b50f1f958272f;hp=feb6c527597fb5b7cbcddb45411d2338e0d469c5;hpb=6bff8ce23ac9a2de8c6ddcea9df5f7bd2b653156;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/live-manager.ts b/server/lib/live-manager.ts index feb6c5275..d63e79dfc 100644 --- a/server/lib/live-manager.ts +++ b/server/lib/live-manager.ts @@ -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) {