go2rtc
go2rtc copied to clipboard
help! my camera works with go2rtc bundled in Frigate, but not go2rtc add-on in Home Assistant
I have an Anpviz IPC-D363WD-SA camera, which is a Hikvision clone with two-way audio. I have been able to add it to my Frigate 0.13.2 instance running in a docker container. However, when I try to add it to my go2rtc add-on in Home Assistant running on a vm, I get a "146" error. What am I doing wrong in the go2rtc add-on in Home Assistant?
My go2rtc add-on config is:
log:
level: info
api: trace
exec: debug
ngrok: info
rtsp: trace
streams: trace
webrtc: fatal
streams:
cam101:
- "ffmpeg:rtsp://username:[email protected]:554/Streaming/Channels/101"
- "isapi://username:[email protected]:80/"
Here is the log showing the error:
3/8/2024, 8:46:18 PM info go2rtc version 1.8.5 linux/amd64
3/8/2024, 8:46:18 PM trace [api] register path path=/
3/8/2024, 8:46:18 PM trace [api] register path path=/api
3/8/2024, 8:46:18 PM trace [api] register path path=/api/config
3/8/2024, 8:46:18 PM trace [api] register path path=/api/exit
3/8/2024, 8:46:18 PM trace [api] register path path=/api/restart
3/8/2024, 8:46:18 PM trace [api] register path path=/api/log
3/8/2024, 8:46:18 PM trace [api] register path path=/api/ws
3/8/2024, 8:46:18 PM trace [api] register path path=/api/streams
3/8/2024, 8:46:18 PM info [rtsp] listen addr=:8554
3/8/2024, 8:46:18 PM info [api] listen addr=:1984
3/8/2024, 8:46:18 PM trace [api] register path path=/api/webrtc
3/8/2024, 8:46:18 PM trace [api] register path path=/api/frame.mp4
3/8/2024, 8:46:18 PM trace [api] register path path=/api/stream.mp4
3/8/2024, 8:46:18 PM trace [api] register path path=/api/stream.m3u8
3/8/2024, 8:46:18 PM trace [api] register path path=/api/hls/playlist.m3u8
3/8/2024, 8:46:18 PM trace [api] register path path=/api/hls/segment.ts
3/8/2024, 8:46:18 PM trace [api] register path path=/api/hls/init.mp4
3/8/2024, 8:46:18 PM trace [api] register path path=/api/hls/segment.m4s
3/8/2024, 8:46:18 PM trace [api] register path path=/api/frame.jpeg
3/8/2024, 8:46:18 PM trace [api] register path path=/api/stream.mjpeg
3/8/2024, 8:46:18 PM trace [api] register path path=/static
3/8/2024, 8:46:18 PM trace [api] register path path=/streams
3/8/2024, 8:46:18 PM trace [api] register path path=/stream/
3/8/2024, 8:46:18 PM trace [api] register path path=/api/hass
3/8/2024, 8:46:18 PM trace [api] register path path=/onvif/
3/8/2024, 8:46:18 PM trace [api] register path path=/api/onvif
3/8/2024, 8:46:18 PM trace [api] register path path=/api/webtorrent
3/8/2024, 8:46:18 PM trace [api] register path path=/api/stream.flv
3/8/2024, 8:46:18 PM trace [api] register path path=/api/ffmpeg/devices
3/8/2024, 8:46:18 PM trace [api] register path path=/api/ffmpeg/hardware
3/8/2024, 8:46:18 PM trace [api] register path path=/api/stream
3/8/2024, 8:46:18 PM trace [api] register path path=/api/dvrip
3/8/2024, 8:46:18 PM trace [api] register path path=/api/stream.ts
3/8/2024, 8:46:18 PM trace [api] register path path=/api/stream.aac
3/8/2024, 8:46:18 PM trace [api] register path path=/api/roborock
3/8/2024, 8:46:18 PM trace [api] register path path=/api/homekit
3/8/2024, 8:46:18 PM trace [api] register path path=/api/nest
3/8/2024, 8:46:18 PM trace [api] register path path=/api/gopro
3/8/2024, 8:46:18 PM trace [api] register path path=/api/stack
3/8/2024, 8:50:56 PM trace [api] GET / 172.30.32.2:33822
3/8/2024, 8:50:56 PM trace [api] GET /main.js 172.30.32.2:33822
3/8/2024, 8:50:56 PM trace [api] GET /api 172.30.32.2:33822
3/8/2024, 8:50:56 PM trace [api] GET /api/streams 172.30.32.2:33822
3/8/2024, 8:51:00 PM trace [api] GET /log.html 172.30.32.2:33822
3/8/2024, 8:51:00 PM trace [api] GET /main.js 172.30.32.2:33822
3/8/2024, 8:51:00 PM trace [api] GET /api/log 172.30.32.2:33822
3/8/2024, 8:51:05 PM trace [api] GET /api/log 172.30.32.2:33822
3/8/2024, 8:51:05 PM trace [api] GET /api/streams 172.30.32.2:33822
3/8/2024, 8:51:05 PM trace [api] GET /api 172.30.32.2:58978
3/8/2024, 8:51:11 PM trace [api] GET /stream.html?src=cam101&mode=mse 172.30.32.2:58978
3/8/2024, 8:51:12 PM trace [api] GET /video-stream.js 172.30.32.2:58978
3/8/2024, 8:51:12 PM trace [api] GET /video-rtc.js 172.30.32.2:58978
3/8/2024, 8:51:12 PM trace [api] GET /api/ws?src=cam101 172.30.32.2:58978
3/8/2024, 8:51:12 PM trace [streams] check cons=0 media=video, sendonly, H264, H265
3/8/2024, 8:51:12 PM debug [exec] run url=exec:ffmpeg -hide_banner -v error -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://username:[email protected]:554/Streaming/Channels/101 -c copy -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}
3/8/2024, 8:51:17 PM trace [streams] skip prod=ffmpeg:rtsp://username:[email protected]:554/Streaming/Channels/101 error=exec: exit status 146
3/8/2024, 8:51:47 PM trace [streams] skip prod=isapi://username:[email protected]:80/ error=Get "http://192.168.20.100:80/ISAPI/System/TwoWayAudio/channels": dial tcp 192.168.20.100:80: i/o timeout
3/8/2024, 8:51:47 PM trace [streams] check cons=0 media=audio, sendonly, MPEG4-GENERIC, PCMA, PCMU, L16, PCML, OPUS
3/8/2024, 8:51:47 PM debug [exec] run url=exec:ffmpeg -hide_banner -v error -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://username:[email protected]:554/Streaming/Channels/101 -c copy -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}
3/8/2024, 8:51:52 PM trace [streams] skip prod=ffmpeg:rtsp://username:[email protected]:554/Streaming/Channels/101 error=exec: exit status 146
3/8/2024, 8:52:20 PM trace [api] GET /api/streams 172.30.32.2:58492
3/8/2024, 8:52:20 PM trace [api] GET /api 172.30.32.2:58476
3/8/2024, 8:52:21 PM trace [api] GET /log.html 172.30.32.2:58476
3/8/2024, 8:52:21 PM trace [api] GET /main.js 172.30.32.2:58476
3/8/2024, 8:52:21 PM trace [api] GET /api/log 172.30.32.2:58476
3/8/2024, 8:52:22 PM trace [streams] skip prod=isapi://username:[email protected]:80/ error=Get "http://192.168.20.100:80/ISAPI/System/TwoWayAudio/channels": dial tcp 192.168.20.100:80: i/o timeout
3/8/2024, 8:52:22 PM debug [streams] can't stop none producer
3/8/2024, 8:52:22 PM debug [streams] can't stop none producer
3/8/2024, 8:52:26 PM trace [api] GET /api/log 172.30.32.2:58476
3/8/2024, 8:52:31 PM trace [api] GET /api/log 172.30.32.2:58476
3/8/2024, 8:52:36 PM trace [api] GET /api/log 172.30.32.2:58476
3/8/2024, 8:52:41 PM trace [api] GET /api/log 172.30.32.2:58476
3/8/2024, 8:52:46 PM trace [api] GET /api/log 172.30.32.2:58476
3/8/2024, 8:52:51 PM trace [api] GET /api/log 172.30.32.2:58476
3/8/2024, 8:52:56 PM trace [api] GET /api/log 172.30.32.2:58476
3/8/2024, 8:53:01 PM trace [api] GET /api/log 172.30.32.2:58476
3/8/2024, 8:53:06 PM trace [api] GET /api/log 172.30.32.2:58476
3/8/2024, 8:53:11 PM trace [api] GET /api/log 172.30.32.2:58476
3/8/2024, 8:53:16 PM trace [api] GET /api/log 172.30.32.2:58476
Here is my Frigate config.yml. Again, this works fine.
mqtt:
enabled: False
detectors:
coral:
type: edgetpu
device: usb
record:
enabled: True
retain:
days: 14
mode: all
events:
retain:
default: 7
mode: motion
go2rtc:
streams:
cam101:
- "ffmpeg:rtsp://username:[email protected]:554/Streaming/Channels/101"
- "isapi://username:[email protected]:80/"
webrtc:
candidates:
- 192.168.1.20:8555
- stun:8555
cameras:
cam101:
ffmpeg:
hwaccel_args: preset-vaapi
output_args:
record: preset-record-generic-audio-aac
inputs:
- path: rtsp://username:[email protected]/stream0/
roles:
- record
- path: rtsp://username:[email protected]/stream1/
roles:
- detect
detect:
enabled: True
width: 704
height: 480
fps: 5
objects:
track:
- person
record:
enabled: True
snapshots:
enabled: True
timestamp: False
bounding_box: True
retain:
default: 14
ui:
Here is the config file for Frigate's go2rtc instance. Unfortunately, when I use this same config file in my go2rtc add-on in Home Assistant, it does not work.
api:
origin: '*'
ffmpeg:
h264/rk: -c:v h264_rkmpp_encoder -g 50 -bf 0
h265/rk: -c:v hevc_rkmpp_encoder -g 50 -bf 0
hass:
config: /config
log:
api: trace
exec: debug
format: text
level: info
ngrok: info
rtsp: trace
streams: trace
webrtc: fatal
rtsp:
default_query: mp4
streams:
cam101:
- "ffmpeg:rtsp://username:[email protected]:554/Streaming/Channels/101"
- "isapi://username:[email protected]:80/"
webrtc:
candidates:
- 192.168.1.20:8555
- stun:8555
listen: :8555
Here is another clue. The Frigate instance of go2rtc and the Home Assistant add-on go2rtc differ in what the info about the streams shows.
Frigate reports:
{
"cam101": {
"consumers": [],
"producers": [
{
"url": "ffmpeg:rtsp://*:*@192.168.20.100:554/Streaming/Channels/101"
},
{
"url": "isapi://*:*@192.168.20.100:80/"
}
]
}
}
While Home Assistant's go2rtc add-on shows:
{
"producers": [
{
"url": "ffmpeg:rtsp://*:*@192.168.20.100:554/Streaming/Channels/101"
},
{
"url": "isapi://*:*@192.168.20.100:80/"
}
],
"consumers": null
}
Why would the same config yield these differences, particularly for "consumers"? This must be related to the issue I'm having.
I don't know what is "exit status 146". You need to increase log level for exec module to trace and check FFmpeg error
@Cold-Lemonade one obvious thing is to check the version of go2rtc. Latest stable Frigate for example is using 1.8.4 and not 1.8.5 like the go2rtc add-on.
Please let me know if the problem is relevant