aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos/live.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-08-06 10:39:40 +0200
committerChocobozzz <me@florianbigard.com>2021-08-06 10:39:40 +0200
commitc826f34a45757b324a20f71665b44ed10e6953b5 (patch)
treeff29bdff8b4519bbdbbcd3aa0d68521ce2b06ff5 /shared/extra-utils/videos/live.ts
parent421ff4618da64f0849353383f690a014024c40da (diff)
downloadPeerTube-c826f34a45757b324a20f71665b44ed10e6953b5.tar.gz
PeerTube-c826f34a45757b324a20f71665b44ed10e6953b5.tar.zst
PeerTube-c826f34a45757b324a20f71665b44ed10e6953b5.zip
Limit live bitrate
Diffstat (limited to 'shared/extra-utils/videos/live.ts')
-rw-r--r--shared/extra-utils/videos/live.ts23
1 files changed, 18 insertions, 5 deletions
diff --git a/shared/extra-utils/videos/live.ts b/shared/extra-utils/videos/live.ts
index 94f5f5b59..6aa405b19 100644
--- a/shared/extra-utils/videos/live.ts
+++ b/shared/extra-utils/videos/live.ts
@@ -7,16 +7,29 @@ import { join } from 'path'
7import { buildAbsoluteFixturePath, wait } from '../miscs' 7import { buildAbsoluteFixturePath, wait } from '../miscs'
8import { PeerTubeServer } from '../server/server' 8import { PeerTubeServer } from '../server/server'
9 9
10function sendRTMPStream (rtmpBaseUrl: string, streamKey: string, fixtureName = 'video_short.mp4') { 10function sendRTMPStream (options: {
11 rtmpBaseUrl: string
12 streamKey: string
13 fixtureName?: string // default video_short.mp4
14 copyCodecs?: boolean // default false
15}) {
16 const { rtmpBaseUrl, streamKey, fixtureName = 'video_short.mp4', copyCodecs = false } = options
17
11 const fixture = buildAbsoluteFixturePath(fixtureName) 18 const fixture = buildAbsoluteFixturePath(fixtureName)
12 19
13 const command = ffmpeg(fixture) 20 const command = ffmpeg(fixture)
14 command.inputOption('-stream_loop -1') 21 command.inputOption('-stream_loop -1')
15 command.inputOption('-re') 22 command.inputOption('-re')
16 command.outputOption('-c:v libx264') 23
17 command.outputOption('-g 50') 24 if (copyCodecs) {
18 command.outputOption('-keyint_min 2') 25 command.outputOption('-c:v libx264')
19 command.outputOption('-r 60') 26 command.outputOption('-g 50')
27 command.outputOption('-keyint_min 2')
28 command.outputOption('-r 60')
29 } else {
30 command.outputOption('-c copy')
31 }
32
20 command.outputOption('-f flv') 33 command.outputOption('-f flv')
21 34
22 const rtmpUrl = rtmpBaseUrl + '/' + streamKey 35 const rtmpUrl = rtmpBaseUrl + '/' + streamKey