diff --git a/config/config.yml b/config/config.yml index 86e95b960..0ce6261b9 100644 --- a/config/config.yml +++ b/config/config.yml @@ -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. diff --git a/frigate/video.py b/frigate/video.py index c4891edcf..3f492fd71 100644 --- a/frigate/video.py +++ b/frigate/video.py @@ -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):