diff options
Diffstat (limited to 'shared/extra-utils/videos/live.ts')
-rw-r--r-- | shared/extra-utils/videos/live.ts | 23 |
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' | |||
7 | import { buildAbsoluteFixturePath, wait } from '../miscs' | 7 | import { buildAbsoluteFixturePath, wait } from '../miscs' |
8 | import { PeerTubeServer } from '../server/server' | 8 | import { PeerTubeServer } from '../server/server' |
9 | 9 | ||
10 | function sendRTMPStream (rtmpBaseUrl: string, streamKey: string, fixtureName = 'video_short.mp4') { | 10 | function 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 |