WebRTC icon indicating copy to clipboard operation
WebRTC copied to clipboard

Not working after update UniFi Protect

Open shgubar opened this issue 2 years ago • 40 comments

Hi Today I made an update to UniFi Protect from version 1.21.6 to 2.0.0. After that, your component stopped working. At the moment I use the web version of the camera 2.3.0. i'm trying with 2.2.0 - same issue. The screen displays "Error: EOF", starts the restart and again the same - a dark screen.

shgubar avatar May 27 '22 17:05 shgubar

I forgot to write about the error in the browser (Chrome's Developer Tools):

Screenshot 2022-05-27 at 21 35 27

shgubar avatar May 27 '22 18:05 shgubar

I seem to be having the same issue

pghattas avatar May 29 '22 17:05 pghattas

Same issue, would be nice with an update or workaround. Seems Ubiquiti added a 2nd audio stream, see attached screenshot.

codec info

danthel avatar May 30 '22 14:05 danthel

Same issue as well. Please let me know if there is anymore detail I can provide to help troubleshoot. Really regret updating Unifi Protect...

Home Assistant Core 2022.5.5 Home Assistant Supervisor 2022.05.3 Home Assistant OS 8.1 WebRTC Camera 2.3.0 Unifi Protect 2.0.0 Cameras: G4 Dome and G4 Doorbell (Firmware Version 4.51.14)

home-assistant.log error:

2022-05-31 09:17:03 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 09:17:03 Stream Try Connect rtsp://192.168.10.55:7447/i9VQ4hpe19mEhTwk 2022-05-31 09:17:03 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 09:17:03 Stream Try Connect rtsp://192.168.10.55:7447/BcpyYHzfm6vR1KXM 2022-05-31 09:17:03 DEBUG (webrtc) [custom_components.webrtc.utils] panic: runtime error: index out of range [2] with length 2 2022-05-31 09:17:03 DEBUG (webrtc) [custom_components.webrtc.utils] 2022-05-31 09:17:03 DEBUG (webrtc) [custom_components.webrtc.utils] goroutine 33 [running]: 2022-05-31 09:17:03 DEBUG (webrtc) [custom_components.webrtc.utils] github.com/deepch/vdk/format/mp4f.(*Muxer).WritePacket(0xc0000b9900, 0x201, 0xf4240, 0x1558f03f8500, 0x3ef1480, 0xc0002f6000, 0x8c73, 0xa000, 0x400, 0xc000280d60, ...) 2022-05-31 09:17:03 DEBUG (webrtc) [custom_components.webrtc.utils] C:/Users/Alexey/go/pkg/mod/github.com/deepch/[email protected]/format/mp4f/muxer.go:287 +0x425 2022-05-31 09:17:03 DEBUG (webrtc) [custom_components.webrtc.utils] main.startMSE(0xc0000f6e10, 0xc0002391cc, 0x2a) 2022-05-31 09:17:03 DEBUG (webrtc) [custom_components.webrtc.utils] q:/Development/Go/RTSPtoWebRTC/http.go:305 +0x89e 2022-05-31 09:17:03 DEBUG (webrtc) [custom_components.webrtc.utils] created by main.ws 2022-05-31 09:17:03 DEBUG (webrtc) [custom_components.webrtc.utils] q:/Development/Go/RTSPtoWebRTC/http.go:237 +0x454 2022-05-31 09:17:03 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 09:17:03 Server Start Awaiting Signal

One more entry:

2022-05-31 10:10:32 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:32 Stream Try Connect rtsp://192.168.10.55:7447/i9VQ4hpe19mEhTwk 2022-05-31 10:10:32 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:32 Stream Try Connect rtsp://192.168.10.55:7447/BcpyYHzfm6vR1KXM 2022-05-31 10:10:32 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:32 Set ICEServers [stun:stun.l.google.com:19302] 2022-05-31 10:10:32 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:32 Set UDP ports to 2 .. 20 2022-05-31 10:10:32 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:32 WebRTC Ignore Audio Track codec not supported WebRTC support only PCM_ALAW or PCM_MULAW 2022-05-31 10:10:32 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:32 Set ICEServers [stun:stun.l.google.com:19302] 2022-05-31 10:10:32 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:32 Set UDP ports to 2 .. 20 2022-05-31 10:10:32 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:32 WebRTC Ignore Audio Track codec not supported WebRTC support only PCM_ALAW or PCM_MULAW 2022-05-31 10:10:33 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:33 Set ICEServers [stun:stun.l.google.com:19302] 2022-05-31 10:10:33 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:33 Set UDP ports to 2 .. 20 2022-05-31 10:10:33 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:33 WebRTC Ignore Audio Track codec not supported WebRTC support only PCM_ALAW or PCM_MULAW 2022-05-31 10:10:33 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:33 Set ICEServers [stun:stun.l.google.com:19302] 2022-05-31 10:10:33 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:33 Set UDP ports to 2 .. 20 2022-05-31 10:10:33 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:33 WebRTC Ignore Audio Track codec not supported WebRTC support only PCM_ALAW or PCM_MULAW 2022-05-31 10:10:33 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:33 Set ICEServers [stun:stun.l.google.com:19302] 2022-05-31 10:10:33 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:33 Set UDP ports to 2 .. 20 2022-05-31 10:10:33 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:33 WebRTC Ignore Audio Track codec not supported WebRTC support only PCM_ALAW or PCM_MULAW 2022-05-31 10:10:33 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:33 Set ICEServers [stun:stun.l.google.com:19302] 2022-05-31 10:10:33 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:33 Set UDP ports to 2 .. 20 2022-05-31 10:10:33 DEBUG (webrtc) [custom_components.webrtc.utils] 2022/05/31 10:10:33 WebRTC Ignore Audio Track codec not supported WebRTC support only PCM_ALAW or PCM_MULAW

writemike avatar May 30 '22 23:05 writemike

I'm also having this issue. Webrtc keeps restarting connection in Home Assistant.

Home Assistant Core 2022.5.5 Home Assistant Supervisor 2022.05.3 Home Assistant OS 8.1 WebRTC Camera 2.3.0 Unifi Protect 2.0.0 Cameras: G4 bullet (4x) and G4 Doorbell (all at Firmware Version 4.51.14)

Boromore avatar May 31 '22 12:05 Boromore

I am also having the same issue since Unifi Protect was updated to V2.0.0

Home Assistant Core 2022.6.0 Home Assistant Supervisor 2022.05.3 Home Assistant OS 8.1 WebRTC Camera 2.3.0

Cameras affected G2 Bullet, G3 Bullet, G3 Flex, G3 Instant, G4 Doorbell, G4 Bullet.

MuttzNuttz avatar Jun 01 '22 18:06 MuttzNuttz

FYI: Protect 2.0.1 does not fixed RTSP stream.

shgubar avatar Jun 03 '22 07:06 shgubar

Same issue here, trying an Early Release update to Protect now

stubble0seven avatar Jun 03 '22 20:06 stubble0seven

FYI I was able to downgrade to unifi protect 1.21.6 and I disabled auto update in the unifi console and I have webrtc working again

PLEASE BE aware you will lose your recordings and settings, so you need to have a backup prior to 2.0. USE AT your own risk!!!

Here are the steps;

Login via ssh goto the shell Remove Protect completely reinstall protect

  • unifi-os shell

  • apt purge unifi-protect

  • apt-get update

  • apt-get install unifi-protect=1.21.6

pghattas avatar Jun 04 '22 11:06 pghattas

The issue isn't Protect really, they're compliant with RTSP afaik. What they did is to add a 2nd audio stream, clients utilizing the stream need to add support for that.

danthel avatar Jun 04 '22 15:06 danthel

Reading the forums, people using Blue Iris, Frigate, Synology and others are all having issues with their integrations after they upgraded to Protect 2.0.x. Im curious if all of these integration solutions are all related to the second audio stream.

pghattas avatar Jun 04 '22 15:06 pghattas

Another FYI, I read frigate has a workaround, they have a workaround by ignoring the audio stream completely. Even prior protect 2.0, the webrtc plugin never played audio even though my cameras did have audio (which I was fine with). If we can get a workaround to ignore the audio on the rtsp stream, that would be a good enough workaround for me. (sigghhh I wish I knew python)

pghattas avatar Jun 04 '22 15:06 pghattas

Sorry for all the serial comments, can anyone try to add "muted: true" (without quotes) to their lovelace for the webrtc camera to see if this is a workaround and report back?

pghattas avatar Jun 04 '22 15:06 pghattas

Tried this already, but without luck.

Boromore avatar Jun 04 '22 17:06 Boromore

Tried this already, but without luck.

Thanks for confirming.

pghattas avatar Jun 04 '22 17:06 pghattas

I have rolled protect back to 1.21.6 and restored from a backup (Pre 2.0) to get WebRTC displaying feeds in HA again. I have also turned off Auto update for the unifi apps as a temporary measure until this is solved. I also use [https://github.com/Anonymousdog/displaycameras] on a PI in my office and this was unaffected by the update to V2.0 of protect. Just thought I would add that for info as it does use the same rtsp streams.

MuttzNuttz avatar Jun 06 '22 09:06 MuttzNuttz

I can confirm I'm also being affected by this issue, going to hold off rolling back in the hope this one gets fixed soon.

Haloooch avatar Jun 20 '22 01:06 Haloooch

I have the same Problem with this. After Update to Protect version > 2.0.0 this stops working. Nothing on logs. I using it on Home Assistant as HACS.

PLEASE fix it.

fahhome123 avatar Jul 04 '22 10:07 fahhome123

Someone needs to share your camera stream with me. It's better to contact with me in Telegram (same nickname)

AlexxIT avatar Jul 12 '22 17:07 AlexxIT

I test it with Version 2.3.1. Problem is not fixed. :(

fahhome123 avatar Jul 13 '22 10:07 fahhome123

Also no luck with 2.3.1 Even removed webrtc integration and reinstalled it. image Now I get this message.

Boromore avatar Jul 13 '22 11:07 Boromore

You need to use mse: false setting for this cameras. Before I can find time to fix this bug. https://github.com/AlexxIT/WebRTC#configuration

I'll fix the problem in the next major version. But it may not be soon.

Also Unify has the wrong RTSP implementation for this case:

  • They using same payload type (96) for both audio tracks. Not all clients can support it.
  • Also they added the video track last. Some players may have problems.
  • Also they used codec names in lowercase. Some players may have problems.

Let them know about the bugs, if it possible.

m=audio 0 RTP/AVP 96
a=recvonly
a=rtpmap:96 mpeg4-generic/48000/1
a=control:trackID=0
a=fmtp:96 streamtype=5; profile-level-id=15; mode=AAC-hbr; config=1188; SizeLength=13; IndexLength=3; IndexDeltaLength=3;
m=audio 0 RTP/AVP 96
a=recvonly
a=rtpmap:96 opus/48000/2
a=control:trackID=1
a=fmtp:96
m=video 0 RTP/AVP 97
a=recvonly
a=control:trackID=2
a=rtpmap:97 H264/90000
a=fmtp:97 profile-level-id=4d4033; packetization-mode=1; sprop-parameter-sets=Z01AM42NQB4AIf/gLcBAQFAAAD6AAAu4CdoIhGo=,aO44gA==

AlexxIT avatar Jul 13 '22 12:07 AlexxIT

Update: Appeared to be an issue with the setup. Reinstalled v2.3.1 and the below config now works correctly 👍

Lovelace yaml type: custom:webrtc-camera url: rtsp://[IP]:7447/[UnifiID] title: Testing mse: false

tech-byte avatar Jul 14 '22 06:07 tech-byte

This config works for me. Unifi protect and G4 doorbell.

type: custom:webrtc-camera url: rtsp://[IP]:7447/[UnifiID] poster: http://[IP]/snap.jpeg muted: false mse: false webrtc: true

Boromore avatar Jul 14 '22 07:07 Boromore

I can also confirm the 'msc: false' is working for me if I use the webrct-camera card, unfortunately for me I use the frigate-card to display all my feeds :(

Haloooch avatar Jul 14 '22 07:07 Haloooch

Just testing now using mse: false parameter and so far this is working on my setup. WebRTC Camera V 2.3.1 Protect V2.1.1

Unifi G4 Doorbell G4 Bullets G3 Bullets G3 Flex G3 Instant & even G2 bullets all working based on the additional parameter being used.

MuttzNuttz avatar Jul 15 '22 10:07 MuttzNuttz

Modify the Unifi url which you can find under protect camera settings advanced rtsps://IP:7441/UnifiID?enableSrtp to rtsp://IP:7447/UnifiID

You can find it under camera settings advanced

image

Boromore avatar Jul 18 '22 05:07 Boromore

You need to use mse: false setting for this cameras. Before I can find time to fix this bug. https://github.com/AlexxIT/WebRTC#configuration

I'll fix the problem in the next major version. But it may not be soon.

Also Unify has the wrong RTSP implementation for this case:

  • They using same payload type (96) for both audio tracks. Not all clients can support it.
  • Also they added the video track last. Some players may have problems.
  • Also they used codec names in lowercase. Some players may have problems.

Let them know about the bugs, if it possible.

m=audio 0 RTP/AVP 96
a=recvonly
a=rtpmap:96 mpeg4-generic/48000/1
a=control:trackID=0
a=fmtp:96 streamtype=5; profile-level-id=15; mode=AAC-hbr; config=1188; SizeLength=13; IndexLength=3; IndexDeltaLength=3;
m=audio 0 RTP/AVP 96
a=recvonly
a=rtpmap:96 opus/48000/2
a=control:trackID=1
a=fmtp:96
m=video 0 RTP/AVP 97
a=recvonly
a=control:trackID=2
a=rtpmap:97 H264/90000
a=fmtp:97 profile-level-id=4d4033; packetization-mode=1; sprop-parameter-sets=Z01AM42NQB4AIf/gLcBAQFAAAD6AAAu4CdoIhGo=,aO44gA==

Thanks @AlexxIT, I was able to resolve this with my G4 Doorbell and a Lovelace card. But how do I add the mse setting when using the WebRTC "Create a link" service?

struz7 avatar Jul 31 '22 09:07 struz7

Try to add &mse=false to link.

AlexxIT avatar Jul 31 '22 10:07 AlexxIT

Try to add &mse=false to link.

Thanks again @AlexxIT this has resolved my issue.

struz7 avatar Jul 31 '22 23:07 struz7