diff options
author | Chocobozzz <me@florianbigard.com> | 2022-09-28 10:32:42 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-09-28 10:32:42 +0200 |
commit | e15bc9dcd59ebb6102d1455450d2e8bbf9f49c27 (patch) | |
tree | dfee1358afa42d3ba3b219230b25626659f10ba5 /server/helpers | |
parent | 49aa917509568a3b96967732512b5ef4ecc50b1b (diff) | |
parent | 1ce4256a6577d0607320a320d9c5d328bdd162f7 (diff) | |
download | PeerTube-e15bc9dcd59ebb6102d1455450d2e8bbf9f49c27.tar.gz PeerTube-e15bc9dcd59ebb6102d1455450d2e8bbf9f49c27.tar.zst PeerTube-e15bc9dcd59ebb6102d1455450d2e8bbf9f49c27.zip |
Merge branch 'release/4.3.0' into develop
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/ffmpeg/ffmpeg-live.ts | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/server/helpers/ffmpeg/ffmpeg-live.ts b/server/helpers/ffmpeg/ffmpeg-live.ts index 8377dc7e2..379d7b1ad 100644 --- a/server/helpers/ffmpeg/ffmpeg-live.ts +++ b/server/helpers/ffmpeg/ffmpeg-live.ts | |||
@@ -23,11 +23,24 @@ async function getLiveTranscodingCommand (options: { | |||
23 | fps: number | 23 | fps: number |
24 | bitrate: number | 24 | bitrate: number |
25 | ratio: number | 25 | ratio: number |
26 | hasAudio: boolean | ||
26 | 27 | ||
27 | availableEncoders: AvailableEncoders | 28 | availableEncoders: AvailableEncoders |
28 | profile: string | 29 | profile: string |
29 | }) { | 30 | }) { |
30 | const { inputUrl, outPath, resolutions, fps, bitrate, availableEncoders, profile, masterPlaylistName, ratio, latencyMode } = options | 31 | const { |
32 | inputUrl, | ||
33 | outPath, | ||
34 | resolutions, | ||
35 | fps, | ||
36 | bitrate, | ||
37 | availableEncoders, | ||
38 | profile, | ||
39 | masterPlaylistName, | ||
40 | ratio, | ||
41 | latencyMode, | ||
42 | hasAudio | ||
43 | } = options | ||
31 | 44 | ||
32 | const command = getFFmpeg(inputUrl, 'live') | 45 | const command = getFFmpeg(inputUrl, 'live') |
33 | 46 | ||
@@ -47,6 +60,7 @@ async function getLiveTranscodingCommand (options: { | |||
47 | addDefaultEncoderGlobalParams(command) | 60 | addDefaultEncoderGlobalParams(command) |
48 | 61 | ||
49 | for (let i = 0; i < resolutions.length; i++) { | 62 | for (let i = 0; i < resolutions.length; i++) { |
63 | const streamMap: string[] = [] | ||
50 | const resolution = resolutions[i] | 64 | const resolution = resolutions[i] |
51 | const resolutionFPS = computeFPS(fps, resolution) | 65 | const resolutionFPS = computeFPS(fps, resolution) |
52 | 66 | ||
@@ -94,9 +108,11 @@ async function getLiveTranscodingCommand (options: { | |||
94 | options: `w=-2:h=${resolution}`, | 108 | options: `w=-2:h=${resolution}`, |
95 | outputs: `vout${resolution}` | 109 | outputs: `vout${resolution}` |
96 | }) | 110 | }) |
111 | |||
112 | streamMap.push(`v:${i}`) | ||
97 | } | 113 | } |
98 | 114 | ||
99 | { | 115 | if (hasAudio) { |
100 | const streamType: StreamType = 'audio' | 116 | const streamType: StreamType = 'audio' |
101 | const builderResult = await getEncoderBuilderResult({ ...baseEncoderBuilderParams, streamType }) | 117 | const builderResult = await getEncoderBuilderResult({ ...baseEncoderBuilderParams, streamType }) |
102 | if (!builderResult) { | 118 | if (!builderResult) { |
@@ -114,9 +130,11 @@ async function getLiveTranscodingCommand (options: { | |||
114 | 130 | ||
115 | command.outputOption(`${buildStreamSuffix('-c:a', i)} ${builderResult.encoder}`) | 131 | command.outputOption(`${buildStreamSuffix('-c:a', i)} ${builderResult.encoder}`) |
116 | applyEncoderOptions(command, builderResult.result) | 132 | applyEncoderOptions(command, builderResult.result) |
133 | |||
134 | streamMap.push(`a:${i}`) | ||
117 | } | 135 | } |
118 | 136 | ||
119 | varStreamMap.push(`v:${i},a:${i}`) | 137 | varStreamMap.push(streamMap.join(',')) |
120 | } | 138 | } |
121 | 139 | ||
122 | command.complexFilter(complexFilter) | 140 | command.complexFilter(complexFilter) |