Override URL format

This commit is contained in:
Mike K 2019-08-30 14:54:16 +01:00
parent ba71927d53
commit 249f3b347e
2 changed files with 11 additions and 5 deletions

View File

@ -3,8 +3,8 @@ web_port: 5000
mqtt:
host: mqtt.server.com
topic_prefix: frigate
# user: username # Optional -- Uncomment for use
# password: password # Optional -- Uncomment for use
# user: username # Optional -- Uncomment for use
# password: password # Optional -- Uncomment for use
cameras:
back:
@ -15,6 +15,12 @@ cameras:
# values that begin with a "$" will be replaced with environment variable
password: $RTSP_PASSWORD
path: /cam/realmonitor?channel=1&subtype=2
################
## Optional URL format. Specifying this will override the default RTSP URL format.
## Some cameras support the RTMP protocol which may give better performance.
################
# urlformat: rtmp://{host}:{port}{path}&user={user}&password={password}
################
## Optional mask. Must be the same dimensions as your video feed.

View File

@ -58,9 +58,9 @@ def get_frame_shape(rtsp_url):
def get_rtsp_url(rtsp_config):
if (rtsp_config['password'].startswith('$')):
rtsp_config['password'] = os.getenv(rtsp_config['password'][1:])
return 'rtsp://{}:{}@{}:{}{}'.format(rtsp_config['user'],
rtsp_config['password'], rtsp_config['host'], rtsp_config['port'],
rtsp_config['path'])
urlformat = rtsp_config.get('urlformat', 'rtsp://{user}:{password}@{host}:{port}{path}')
return urlformat.format(host=rtsp_config['host'], port=rtsp_config['port'],
path=rtsp_config['path'], user=rtsp_config['user'], password=rtsp_config['password'])
class CameraWatchdog(threading.Thread):
def __init__(self, camera):