vision module is not using rtmp stream anymore

jpeg webstream now runs with nearly zerolatency (currently limited to 640x480px)
This commit is contained in:
Joel 2021-02-04 16:02:45 +01:00
parent 6c579bb5fb
commit d4b577046e
No known key found for this signature in database
GPG key ID: BDDDBECD0808290E
5 changed files with 20 additions and 8 deletions

View file

@ -16,6 +16,8 @@ except Exception as e:
__run = """raspivid -t 0 -b 5000000 -w 1280 -h 720 -fps 30 -n -o - | gst-launch-1.0 fdsrc ! video/x-h264,width=1280,height=720,framerate=30/1,noise-reduction=1,profile=high,stream-format=byte-stream ! h264parse ! queue ! flvmux streamable=true ! rtmpsink location=\"rtmp://localhost/live/stream\""""
STREAM_RASPI = False if os.getenv("STREAM_RASPI", "false") == "false" else True
def check_battery():
while True:
@ -40,6 +42,7 @@ if __name__ == '__main__':
systemd.daemon.notify('READY=1')
logstash_logger.info("starting battery checker")
battery_checker = None
try:
battery_checker = threading.Thread(target=check_battery)
battery_checker.start()
@ -47,6 +50,14 @@ if __name__ == '__main__':
except Exception as e:
logstash_logger.error(f"could not start battery checker -> {str(e)}")
logstash_logger.info("starting gstreamer background process")
os.system(__run)
logstash_logger.error("gstreamer stopped...")
if STREAM_RASPI:
logstash_logger.info("starting gstreamer background process")
os.system(__run)
logstash_logger.error("gstreamer stopped...")
else:
logstash_logger.info("not starting gstreamer background process and only checking for battery")
if battery_checker is not None:
battery_checker.join()
else:
logstash_logger.info("battery checker failed to initialize.. sleeping for a day")
time.sleep(60*60*24)