[Bug]: Onvif PTZ obtains local LAN address of remote port forwarded camera #12528
Describe the problem you are havingI have a remote PTZ camera that I access via the WAN and port forwarding on the remote side. I can't get the onvif PTZ controls to display while the camera displays and records just fine. Steps to reproduceClick on remote camera from main thumbnail page to bring up full page display of camera. Version0.14.0 beta 4 Frigate config file# yaml-language-server: $schema=http://192.168.88.95:5000/api/config/schema.json
logger:
default: info
tls:
enabled: true
auth:
enabled: true
# reset_admin_password: true
ffmpeg:
hwaccel_args: preset-nvidia-h264 # default preset
# hwaccel_args: preset-vaapi
# hwaccel_args: preset-intel-qsv-h264
mqtt:
enabled: true
host: 192.168.88.95
port: 1883
topic_prefix: frigate
client_id: frigate
detectors:
# tensorrt:
# type: tensorrt
# device: 0
coral_pci:
type: edgetpu
device: pci
# coral_usb:
# type: edgetpu
# device: usb
#model:
# path: /config/model_cache/tensorrt/yolov7-320.trt
# input_tensor: nchw
# input_pixel_format: rgb
# width: 320
# height: 320
# cpu1:
# type: cpu
# num_threads: 3
birdseye:
restream: true
mode: motion
quality: 2
layout:
max_cameras: 4
record:
enabled: true
expire_interval: 60
snapshots:
enabled: true
clean_copy: true
retain:
default: 30
ui:
# use_experimental: false
time_format: 24hour
date_style: full
telemetry:
version_check: true
cameras:
##################################################
########## 01 Front PTZ ##########################
##################################################
01_Front_PTZ:
enabled: true
ffmpeg:
hwaccel_args: preset-nvidia-h265
inputs:
# - path:
# rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@192.168.88.14:554/Streaming/channels/102
# roles:
# - detect
- path:
rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@192.168.88.14:554/Streaming/channels/101
roles:
- record
- detect
# input_args: -tag:v hvc1
# output_args:
# record: -f segment -segment_time 10 -segment_format mp4 -c:v rawvideo
birdseye:
enabled: true
order: 1
quality: 4
mode: objects
detect:
fps: 5
stationary:
interval: 120
threshold: 120
motion:
threshold: 51
contour_area: 30
# mask:
improve_contrast: 'true'
record:
enabled: true
events:
pre_capture: 0
post_capture: 5
retain:
default: 365
mode: motion
objects:
track:
- person
- dog
- car
- cat
- motorcycle
- bicycle
- bus
filters:
car:
mask:
- 509,337,381,95,167,120,244,374
zones:
Cat:
coordinates: 1280,720,1206,214,0,416,0,651
onvif:
host: 192.168.88.14
port: 80
user: admin
password: pscle.com1100
##################################################
########## 12 Front PTZ ##########################
##################################################
12_Front_PTZ:
enabled: false
ffmpeg:
inputs:
- path:
rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@192.168.88.69:554/cam/realmonitor?channel=1&subtype=1
roles:
- detect
- path: rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@192.168.88.69:554/live
roles:
- record
birdseye:
enabled: true
order: 1
quality: 4
mode: objects
detect:
fps: 5
stationary:
interval: 120
threshold: 120
motion:
threshold: 25
contour_area: 30
mask:
- 1280,0,1280,31,852,32,861,0
record:
enabled: true
events:
pre_capture: 0
post_capture: 5
retain:
default: 365
mode: motion
objects:
track:
- person
- dog
- car
- cat
- motorcycle
- bicycle
- bus
filters:
car:
mask:
- 509,337,381,95,167,120,244,374
zones:
Cat:
coordinates: 0,693,1280,720,1280,438,0,440
onvif:
host: 192.168.88.69
port: 80
user: admin
password: pscle.com1100
autotracking:
enabled: true
calibrate_on_startup: false
zooming: relative
zoom_factor: 0.3
track:
- person
required_zones:
- Cat
return_preset: home
movement_weights: 0.25, 1.0, 4.2627904415130615, 4.305746229746008, 0.6394811230321096
##################################################
########## 02 Front Door #########################
##################################################
02_Front_Door:
enabled: False
ffmpeg:
inputs:
# - path: rtsp://ubnt:ubnt@192.168.88.13:554/s1
# roles:
# - detect
# - audio
- path: rtsp://admin:Jane,4499@192.168.88.2:3302/stream?cameraNum=4
roles:
- record
- detect
- audio
output_args:
record: preset-record-generic-audio-copy
audio:
enabled: true
listen:
- bark
- scream
- speech
- hiss
- meow
- knock
birdseye:
enabled: true
order: 2
quality: 4
mode: objects
detect:
fps: 5
stationary:
interval: 120
threshold: 120
motion:
threshold: 48
contour_area: 30
improve_contrast: 'true'
record:
enabled: true
events:
pre_capture: 5
post_capture: 5
retain:
default: 365
objects:
track:
- person
- dog
- car
- cat
zones:
Cat:
coordinates: 295,720,1280,668,1280,0,238,0
##################################################
########## 13 Cat #########################
##################################################
13_Cat:
enabled: false
ffmpeg:
inputs:
- path: rtsp://ubnt:ubnt@192.168.88.11:554/s0
roles:
- detect
- audio
- record
output_args:
record: preset-record-generic-audio-copy
audio:
enabled: true
listen:
- hiss
- meow
birdseye:
enabled: false
order: 2
quality: 4
mode: objects
detect:
stationary:
interval: 120
threshold: 120
motion:
threshold: 25
contour_area: 30
record:
enabled: true
events:
pre_capture: 5
post_capture: 5
retain:
default: 365
objects:
track:
- dog
- cat
# zones:
# Cat:
# coordinates: 295,720,1280,668,1280,0,238,0
##################################################
########## 03 Patio PTZ ##########################
##################################################
03_Patio_PTZ:
enabled: true
ffmpeg:
inputs:
- path: rtsp://admin:1234@192.168.88.15:554/cam/realmonitor?channel=1&subtype=0
#rtsp://admin:1234@192.168.88.15:554/cam/realmonitor?channel=1&subtype=0
roles:
- record
- detect
birdseye:
enabled: true
order: 3
quality: 4
mode: objects
detect:
stationary:
interval: 120
threshold: 120
motion:
threshold: 59
contour_area: 30
improve_contrast: 'true'
record:
enabled: true
events:
pre_capture: 5
post_capture: 5
retain:
default: 365
objects:
track:
- person
- cat
- dog
- bird
zones:
Patio:
coordinates: 145,1080,1042,1080,1505,601,1128,195,452,333
onvif:
host: 192.168.88.15
port: 80
user: admin
password: '1234'
##################################################
########## 04 Yard PTZ ###########################
##################################################
04_Yard_PTZ:
enabled: false
ffmpeg:
inputs:
- path: rtsp://admin:1234@192.168.88.17:554/cam/realmonitor?channel=1&subtype=0
roles:
- record
- detect
# - path: rtsp://admin:1234@192.168.88.17:554/cam/realmonitor?channel=1&subtype=1
# roles:
# - detect
birdseye:
enabled: true
order: 4
quality: 4
mode: objects
detect:
fps: 5
stationary:
interval: 120
threshold: 120
motion:
threshold: 25
contour_area: 30
mask:
- 1920,0,1920,86,1274,89,1276,0
record:
enabled: true
events:
pre_capture: 5
post_capture: 5
retain:
default: 365
objects:
track:
- person
- dog
- car
- cat
onvif:
host: 192.168.88.17
port: 80
user: admin
password: '1234'
##################################################
########## 05 Tarmac 1 ###########################
##################################################
05_Tarmac_1:
enabled: true
ffmpeg:
inputs:
- path:
rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@192.168.88.16:554/Streaming/channels/101
roles:
- record
- detect
# - path:
# rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@192.168.88.16:554/Streaming/channels/102
# roles:
# - detect
birdseye:
enabled: true
order: 5
quality: 4
mode: objects
detect:
fps: 5
stationary:
interval: 120
threshold: 120
motion:
threshold: 46
contour_area: 30
improve_contrast: 'true'
record:
enabled: true
events:
pre_capture: 5
post_capture: 5
retain:
default: 365
objects:
track:
- person
- dog
- car
- cat
filters:
car:
mask:
- 485,235,1135,324,1010,0,472,0
##################################################
########## 06 Tarmac 2 ###########################
##################################################
06_Tarmac_2:
enabled: true
ffmpeg:
hwaccel_args: preset-nvidia-h265
inputs:
- path:
rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@192.168.88.19:554/Streaming/channels/101
roles:
- record
- detect
# - path:
# rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@192.168.88.19:554/Streaming/channels/102
# roles:
# - detect
birdseye:
enabled: true
order: 6
quality: 4
mode: objects
detect:
stationary:
interval: 120
threshold: 120
motion:
threshold: 61
contour_area: 30
improve_contrast: 'true'
record:
enabled: true
events:
pre_capture: 5
post_capture: 5
retain:
default: 365
objects:
track:
- person
- dog
- car
- cat
filters:
car:
mask:
- 189,368,824,260,742,28,104,115
##################################################
########## 07 Carport ############################
##################################################
07_Carport:
enabled: true
ffmpeg:
hwaccel_args: preset-nvidia-h265
inputs:
- path:
rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@192.168.88.18:554/Streaming/channels/101
roles:
- record
- detect
# - path:
# rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@192.168.88.18:554/Streaming/channels/102
# roles:
# - detect
birdseye:
enabled: true
order: 7
quality: 4
mode: motion
detect:
fps: 5
stationary:
interval: 120
threshold: 60
motion:
threshold: 25
contour_area: 30
mask:
- 647,720,1280,720,1280,427,1044,194,845,133,740,125,641,146,556,320
record:
enabled: true
events:
pre_capture: 5
post_capture: 5
retain:
default: 365
##################################################
########## 08 West Dock #########################
##################################################
08_West_Dock:
enabled: true
ffmpeg:
inputs:
- path:
rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@162.NNN.25.NNN:8002/Streaming/channels/101
roles:
- record
- detect
birdseye:
enabled: false
order: 8
quality: 2
mode: objects
detect:
stationary:
interval: 120
threshold: 120
motion:
threshold: 46
contour_area: 30
improve_contrast: 'true'
record:
enabled: true
events:
pre_capture: 5
post_capture: 5
retain:
default: 365
objects:
track:
- person
- dog
- boat
onvif:
host: 162.NNN.25.NNN
port: 62080
user: admin
password: XXXXXXXXXXXX
# autotracking:
# enabled: true
# calibrate_on_startup: true
# zooming: disabled
# track:
# - person
# required_zones:
# - Patio
# return_preset: 01
go2rtc:
webrtc:
# candidates:
# - 192.168.88.95:8555
# - stun:8555
streams:
01_Front_PTZ:
- rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@192.168.88.14:554/Streaming/channels/101
02_Front_Door:
- rtsp://ubnt:ubnt@192.168.88.13:554/s0
03_Patio_PTZ:
- rtsp://admin:1234@192.168.88.15:554/cam/realmonitor?channel=1&subtype=0
# 04_Yard_PTZ:
# - rtsp://admin:1234@192.168.88.17:554/cam/realmonitor?channel=1&subtype=0
# 05_Tarmac_1:
# - rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@192.168.88.16:554/Streaming/channels/101
# 06_Tarmac_2:
# - rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@192.168.88.19:554/Streaming/channels/101
# 07_Carport:
# - rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@192.168.88.18:554/Streaming/channels/101
08_West_Dock:
- rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@162.155.25.74:8002/Streaming/channels/101
# 012_Front_PTZ:
# - rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@192.168.88.69/live
# 09_COC:
# - path: rtsp://ubnt:pscle.com1100@67.219.159.174:4300/s0
10_LYC_East:
- rtsp://lyc:lyc@162.155.25.74:8882/s0
# 11_LYC_West:
# - rtsp://lyc:lyc@162.155.25.74:8881/s0
version: 0.14
camera_groups:
home:
order: 1
icon: LuAlertCircle
cameras:
- 01_Front_PTZ
- 02_Front_Door
- 03_Patio_PTZ
- 04_Yard_PTZ
- 05_Tarmac_1
- 06_Tarmac_2
- 07_CarportRelevant log output2024-07-20 11:23:56.479858869 [2024-07-20 11:23:56] frigate.ptz.onvif ERROR : Unable to get Onvif media profiles for camera: 08_West_Dock: Unknown error: HTTPConnectionPool(host='192.168.20.246', port=80): Max retries exceeded with url: /onvif/Media (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fef389b9df0>: Failed to establish a new connection: [Errno 110] Connection timed out'))Operating systemDebian Install methodDocker Compose Network connectionWired Camera make and modelHikvision DS-2DE2A404IW-DE3 Any other information that may be helpfulThe address in the host log entry is in fact the LAN address of the camera: 192.168.20.246 as is port 80. To my untrained mind, Frigate somehow obtains the local LAN address of the remote camera then tries to look for that camera which doesn't exist on the Frigate LAN. It should be looking for the camera from the onvif settings in the config. Onvif host and password are altered. Do not know when this started happening, I just started to dig into the PTZ problem after months of ignoring it. To my knowledge, it has never worked and is my only remote PTZ camera. Camera is using Onvif version 17.12 |
Replies: 4 comments 1 reply
|
Frigate isn't doing anything special with the ONVIF connection. As you can see from the code, it's pulling from the config settings directly: Line 49 in 29345c4 However, the ONVIF response from the camera contains the camera's local address, which is then used for other ONVIF calls. This is behaving as expected from Frigate's end and isn't anything we can work around. You could file an issue with the |
|
Roger that, thanks for the clarification. |
|
not a clean workaround but I was able to hardcode the correct IP in the configuration of the camera itself this will different depending on the vendor and firmware but in mine it was /etc/onvif.conf hardcode %s to the forwarded IP and port |
|
In my case I had the camera under a second router, and to workaround I setup an static routing. For destination: localaddressIp, use gateway, ipoftherouterWithPortForwarding, now It works |
Frigate isn't doing anything special with the ONVIF connection. As you can see from the code, it's pulling from the config settings directly:
frigate/frigate/ptz/onvif.py
Line 49 in 29345c4
However, the ONVIF response from the camera contains the camera's local address, which is then used for other ONVIF calls.
This is behaving as expected from Frigate's end and isn't anything we can work around. You could file an issue with the
python-onvif-zeeppackage that Frigate uses. There is a PR open there that may be relevant: FalkTannhaeuser/python-onvif-zeep#75