aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/extra-utils/videos/live-command.ts5
-rw-r--r--shared/extra-utils/videos/live.ts23
-rw-r--r--shared/models/videos/video-transcoding.model.ts1
3 files changed, 22 insertions, 7 deletions
diff --git a/shared/extra-utils/videos/live-command.ts b/shared/extra-utils/videos/live-command.ts
index bf9486a05..81ae458e0 100644
--- a/shared/extra-utils/videos/live-command.ts
+++ b/shared/extra-utils/videos/live-command.ts
@@ -68,11 +68,12 @@ export class LiveCommand extends AbstractCommand {
68 async sendRTMPStreamInVideo (options: OverrideCommandOptions & { 68 async sendRTMPStreamInVideo (options: OverrideCommandOptions & {
69 videoId: number | string 69 videoId: number | string
70 fixtureName?: string 70 fixtureName?: string
71 copyCodecs?: boolean
71 }) { 72 }) {
72 const { videoId, fixtureName } = options 73 const { videoId, fixtureName, copyCodecs } = options
73 const videoLive = await this.get({ videoId }) 74 const videoLive = await this.get({ videoId })
74 75
75 return sendRTMPStream(videoLive.rtmpUrl, videoLive.streamKey, fixtureName) 76 return sendRTMPStream({ rtmpBaseUrl: videoLive.rtmpUrl, streamKey: videoLive.streamKey, fixtureName, copyCodecs })
76 } 77 }
77 78
78 async runAndTestStreamError (options: OverrideCommandOptions & { 79 async runAndTestStreamError (options: OverrideCommandOptions & {
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
diff --git a/shared/models/videos/video-transcoding.model.ts b/shared/models/videos/video-transcoding.model.ts
index 3f2382ce8..f1fe4609b 100644
--- a/shared/models/videos/video-transcoding.model.ts
+++ b/shared/models/videos/video-transcoding.model.ts
@@ -5,6 +5,7 @@ import { VideoResolution } from './video-resolution.enum'
5export type EncoderOptionsBuilder = (params: { 5export type EncoderOptionsBuilder = (params: {
6 input: string 6 input: string
7 resolution: VideoResolution 7 resolution: VideoResolution
8 inputBitrate: number
8 fps?: number 9 fps?: number
9 streamNum?: number 10 streamNum?: number
10}) => Promise<EncoderOptions> | EncoderOptions 11}) => Promise<EncoderOptions> | EncoderOptions