provide stream/hls output params

This commit is contained in:
jb-alvarado 2020-06-28 22:09:40 +02:00
parent 64d9dacd75
commit 0edb0821ba
4 changed files with 17 additions and 2 deletions

View File

@ -98,6 +98,9 @@ out:
helptext: The final playout compression. Set the settings to your needs. helptext: The final playout compression. Set the settings to your needs.
'mode' has the standard options 'desktop', 'hls', 'stream'. Self made outputs 'mode' has the standard options 'desktop', 'hls', 'stream'. Self made outputs
can be define, by adding script in output folder with an 'output' function inside. can be define, by adding script in output folder with an 'output' function inside.
'stream_output' is for streaming output, two ffmpeg instances are fired up, for
pre- and post-processing. 'hls_output' is for direct output to hls playlist,
without pre- and post-processing, mode must be 'hls'.
mode: 'stream' mode: 'stream'
service_name: "Live Stream" service_name: "Live Stream"
service_provider: "example.org" service_provider: "example.org"
@ -113,5 +116,14 @@ out:
-c:a aac -c:a aac
-ar 44100 -ar 44100
-b:a 128k -b:a 128k
stream_output: >-
-flags +global_header -flags +global_header
-f flv "rtmp://localhost/live/stream" -f flv "rtmp://localhost/live/stream"
hls_output: >-
-flags +cgop
-f hls
-hls_time 6
-hls_list_size 600
-hls_delete_threshold 30
-hls_flags append_list+delete_segments+omit_endlist+program_date_time
/var/www/srs/live/stream.m3u8

View File

@ -40,7 +40,7 @@ def output():
'-metadata', 'service_name=' + _playout.name, '-metadata', 'service_name=' + _playout.name,
'-metadata', 'service_provider=' + _playout.provider, '-metadata', 'service_provider=' + _playout.provider,
'-metadata', 'year={}'.format(year) '-metadata', 'year={}'.format(year)
] + _playout.ffmpeg_param ] + _playout.ffmpeg_param + _playout.hls_output
_ff.encoder = Popen(cmd, stdin=PIPE, stderr=PIPE) _ff.encoder = Popen(cmd, stdin=PIPE, stderr=PIPE)

View File

@ -47,7 +47,8 @@ def output():
'-metadata', 'service_name=' + _playout.name, '-metadata', 'service_name=' + _playout.name,
'-metadata', 'service_provider=' + _playout.provider, '-metadata', 'service_provider=' + _playout.provider,
'-metadata', 'year={}'.format(year) '-metadata', 'year={}'.format(year)
] + _playout.ffmpeg_param, stdin=PIPE, stderr=PIPE) ] + _playout.ffmpeg_param + _playout.stream_output,
stdin=PIPE, stderr=PIPE)
enc_err_thread = Thread(target=ffmpeg_stderr_reader, enc_err_thread = Thread(target=ffmpeg_stderr_reader,
args=(_ff.encoder.stderr, False)) args=(_ff.encoder.stderr, False))

View File

@ -222,6 +222,8 @@ def load_config():
_playout.name = cfg['out']['service_name'] _playout.name = cfg['out']['service_name']
_playout.provider = cfg['out']['service_provider'] _playout.provider = cfg['out']['service_provider']
_playout.ffmpeg_param = cfg['out']['ffmpeg_param'].split(' ') _playout.ffmpeg_param = cfg['out']['ffmpeg_param'].split(' ')
_playout.stream_output = cfg['out']['stream_output'].split(' ')
_playout.hls_output = cfg['out']['hls_output'].split(' ')
_init.load = False _init.load = False