tarina

git clone https://git.tarina.org/tarina
Log | Files | Refs | README | LICENSE

commit 9afec0b4fee799f9ddc59a779cf4b1899114dd6c
parent f3c25b216182ee0b876b10be27b0f1a7e47e85cf
Author: rbckman <rob@tarina.org>
Date:   Tue,  6 Jul 2021 05:46:25 +0100

if stream fails, notice about it and continue

Diffstat:
Mtarina.py | 14++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tarina.py b/tarina.py @@ -611,7 +611,10 @@ def main(): elif pressed == 'middle' and menu[selected] == 'LIVE:': if stream == '': stream = startstream(camera, stream, plughw, channels) - live = 'yes' + if stream == '': + vumetermessage('something wrong with streaming') + else: + live = 'yes' else: stream = stopstream(camera, stream) live = 'no' @@ -2804,9 +2807,12 @@ def startstream(camera, stream, plughw, channels): key = fp.readlines() print('using key: ' + key[0]) stream_cmd = 'ffmpeg -f h264 -r 25 -i - -itsoffset 5.5 -fflags nobuffer -f alsa -ac '+str(channels)+' -i hw:'+str(plughw)+' -ar 44100 -vcodec copy -acodec libmp3lame -b:a 128k -ar 44100 -map 0:0 -map 1:0 -strict experimental -f flv ' + youtube + key[0] - stream = subprocess.Popen(stream_cmd, shell=True, stdin=subprocess.PIPE) - now = time.strftime("%Y-%m-%d-%H:%M:%S") - camera.start_recording(stream.stdin, format='h264', bitrate = 2000000) + try: + stream = subprocess.Popen(stream_cmd, shell=True, stdin=subprocess.PIPE) + camera.start_recording(stream.stdin, format='h264', bitrate = 2000000) + except: + stream = '' + #now = time.strftime("%Y-%m-%d-%H:%M:%S") return stream def stopstream(camera, stream):