diff --git a/install.sh b/install.sh index 100dab4..8dd2feb 100755 --- a/install.sh +++ b/install.sh @@ -50,7 +50,7 @@ read #Install needed packages sudo apt-get update -sudo apt-get install vlc sed coreutils fbset openssl procps python3-pygame python3-yaml python3-openssl python3 libraspberrypi-bin -y +sudo apt-get install vlc sed coreutils fbset ffmpeg openssl procps python3-pygame python3-yaml python3-openssl python3 libraspberrypi-bin -y if ! is_vlc_mmal_present;then echo "Your version of vlc does not have the needed mmal options. Rpisurv needs those" diff --git a/surveillance/core/CameraStream.py b/surveillance/core/CameraStream.py index 82bc02b..f85a79d 100644 --- a/surveillance/core/CameraStream.py +++ b/surveillance/core/CameraStream.py @@ -6,6 +6,7 @@ import os import sys import io +import subprocess import urllib.request, urllib.error, urllib.parse from urllib.parse import urlparse @@ -57,7 +58,7 @@ def __init__(self, name, camera_stream, drawinstance, display_hdmi_id): self.obfuscated_credentials_url = self._manipulate_credentials_in_url("obfuscate") - if self.scheme not in ["rtsp", "http", "https", "file"]: + if self.scheme not in ["rtsp", "http", "https", "file", "rtmp"]: logger.error("CameraStream: " + self.name + " Scheme " + self.scheme + " in " + self.obfuscated_credentials_url + " is currently not supported, you can make a feature request on https://community.rpisurv.net") sys.exit() @@ -97,6 +98,17 @@ def _urllib2open_wrapper(self): return urllib.request.urlopen(request, timeout=self.probe_timeout) def is_connectable(self): + if self.scheme == "rtmp": + try: + ffprobeoutput = subprocess.check_output(['/usr/bin/ffprobe', '-v', 'quiet', "-print_format", "flat", "-show_error", self.url], text=True, timeout=self.probe_timeout) + return True + except subprocess.TimeoutExpired as e: + logger.error(f"CameraStream: {self.name} {self.obfuscated_credentials_url} Not Connectable (ffprobe timed out, try increasing probe_timeout for this stream), configured timeout: {self.probe_timeout}") + return False + except Exception as e: + erroroutput_newlinesremoved=e.output.replace('\n', ' ') + logger.error(f"CameraStream: {self.name} {self.obfuscated_credentials_url} Not Connectable ({erroroutput_newlinesremoved}), configured timeout: {self.probe_timeout}") + return False if self.scheme == "rtsp": try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) diff --git a/surveillance/surveillance.py b/surveillance/surveillance.py index bedc92a..82396cd 100644 --- a/surveillance/surveillance.py +++ b/surveillance/surveillance.py @@ -152,7 +152,7 @@ def sigterm_handler(_signo, _stack_frame): #Setup logger logger = setup_logging() - fullversion_for_installer = "3.0.0-beta5" + fullversion_for_installer = "3.0.0-beta6" version = fullversion_for_installer logger.info("Starting rpisurv " + version)