From 0edb0821ba06a2c964647ee91f3b9b6731b01fcc Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Sun, 28 Jun 2020 22:09:40 +0200 Subject: [PATCH] provide stream/hls output params --- ffplayout.yml | 12 ++++++++++++ ffplayout/output/hls.py | 2 +- ffplayout/output/stream.py | 3 ++- ffplayout/utils.py | 2 ++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ffplayout.yml b/ffplayout.yml index 6563dcc9..f23f4a33 100644 --- a/ffplayout.yml +++ b/ffplayout.yml @@ -98,6 +98,9 @@ out: helptext: The final playout compression. Set the settings to your needs. '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. + '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' service_name: "Live Stream" service_provider: "example.org" @@ -113,5 +116,14 @@ out: -c:a aac -ar 44100 -b:a 128k + stream_output: >- -flags +global_header -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 diff --git a/ffplayout/output/hls.py b/ffplayout/output/hls.py index 7efe4eba..6a821df8 100644 --- a/ffplayout/output/hls.py +++ b/ffplayout/output/hls.py @@ -40,7 +40,7 @@ def output(): '-metadata', 'service_name=' + _playout.name, '-metadata', 'service_provider=' + _playout.provider, '-metadata', 'year={}'.format(year) - ] + _playout.ffmpeg_param + ] + _playout.ffmpeg_param + _playout.hls_output _ff.encoder = Popen(cmd, stdin=PIPE, stderr=PIPE) diff --git a/ffplayout/output/stream.py b/ffplayout/output/stream.py index 200aa1dc..551bcb03 100644 --- a/ffplayout/output/stream.py +++ b/ffplayout/output/stream.py @@ -47,7 +47,8 @@ def output(): '-metadata', 'service_name=' + _playout.name, '-metadata', 'service_provider=' + _playout.provider, '-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, args=(_ff.encoder.stderr, False)) diff --git a/ffplayout/utils.py b/ffplayout/utils.py index 143bedcc..ae8e7cba 100644 --- a/ffplayout/utils.py +++ b/ffplayout/utils.py @@ -222,6 +222,8 @@ def load_config(): _playout.name = cfg['out']['service_name'] _playout.provider = cfg['out']['service_provider'] _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