Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebRTC Dashcast Nest Google Hub stops working #661

Closed
adoreparler opened this issue Feb 29, 2024 · 15 comments
Closed

WebRTC Dashcast Nest Google Hub stops working #661

adoreparler opened this issue Feb 29, 2024 · 15 comments
Labels
bug Something isn't working

Comments

@adoreparler
Copy link

I have a Google Nest Hub and Home Assistant and also WebRTC Installed.
My Cameras are Ubiquiti cameras and in the options for the camera I turned on RTSPS Link for High Definition.

I created a script:

alias: Streaming Outside Camera to Kitchen Display
sequence:
  - service: webrtc.dash_cast
    data:
      entity_id: media_player.kitchen_display
      url: rtspx://11.0.0.71:7441/{UniqueIdentifierWasHere}
      force: true
mode: single
icon: mdi:webcam

When I tell the google hub the alias above it starts displaying and I can see the camera feed with about a 2 - 3 second lag. But after about 5 seconds the stream goes black and does not load back up. If I close out and say the alias again it works again for about 5 seconds and the stream goes black.

I turned on Debug logging but I am not sure where to go to see the debug logging. I went to system -> Logs and dont see anything in there around WebRTC.

@AlexxIT AlexxIT added the question Further information is requested label Feb 29, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Feb 29, 2024

You can open go2rtc WebUI and check stream info when stream active

@adoreparler
Copy link
Author

adoreparler commented Feb 29, 2024

{
  "producers": [
    {
      "type": "RTSP active producer",
      "url": "rtsps://11.0.0.71:7441/{UniqueIdentHidden}/",
      "remote_addr": "11.0.0.71:7441",
      "user_agent": "go2rtc/1.8.5",
      "sdp": "v=0\r\no=- 1476 0 IN IP4 11.0.0.71\r\ns=AC8BA98F79F9_0\r\nu=www.ui.com\r\n[email protected]\r\nc=IN IP4 11.0.0.71\r\nt=0 0\r\na=recvonly\r\na=control:*\r\na=range:npt=now-\r\nm=audio 0 RTP/AVP 96\r\na=recvonly\r\na=rtpmap:96 mpeg4-generic/16000/1\r\na=control:trackID=0\r\na=fmtp:96 streamtype=5; profile-level-id=15; mode=AAC-hbr; config=1408; SizeLength=13; IndexLength=3; IndexDeltaLength=3;\r\nm=audio 0 RTP/AVP 96\r\na=recvonly\r\na=rtpmap:96 opus/48000/2\r\na=control:trackID=1\r\na=fmtp:96\r\nm=video 0 RTP/AVP 97\r\na=recvonly\r\na=control:trackID=2\r\na=rtpmap:97 H264/90000\r\na=fmtp:97 profile-level-id=4d4032; packetization-mode=1; sprop-parameter-sets=Z01AMqaAKgC/+WbgICAoAAAfSAAHVOTtBEI1,aOqPIA==\r\n",
      "medias": [
        "audio, recvonly, MPEG4-GENERIC/16000",
        "audio, recvonly, OPUS/48000/2",
        "video, recvonly, H.264 Main 5.0"
      ],
      "receivers": [
        "97 H264, bytes=12978016, senders=1",
        "96 MPEG4-GENERIC/16000, bytes=196463, senders=0",
        "96 OPUS/48000/2, bytes=199318, senders=1"
      ],
      "recv": 13402933
    }
  ],
  "consumers": [
    {
      "type": "WebRTC/WebSocket async passive consumer",
      "remote_addr": "udp4 prflx 11.0.0.251:44454 related :0",
      "user_agent": "Mozilla/5.0 (Fuchsia) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 CrKey/1.56.500000",
      "medias": [
        "video, sendonly, VP8, RTX, VP9, H264, AV1, RED, ULPFEC, FLEXFEC-03",
        "audio, sendonly, OPUS/48000/2, RED/48000/2, G722/8000, PCMU/8000, PCMA/8000, CN/8000, TELEPHONE-EVENT/48000, TELEPHONE-EVENT/8000, L16, PCML"
      ],
      "senders": [
        "100 H264, bytes=12978016, receivers=1",
        "111 OPUS/48000/2, bytes=199318, receivers=1"
      ],
      "send": 13349588
    }
  ]
}

@AlexxIT
Copy link
Owner

AlexxIT commented Feb 29, 2024

11.0.0.251 - is this IP of your Nest? All looks fine in the info

PS. I don't like "Main 5.0". This maybe case of problem. Too high profile for low end devices like Nest Hub:
https://developers.google.com/cast/docs/media

@adoreparler
Copy link
Author

Yes, that is the IP of the Nest Hub. Most of the time it shows the bar at the bottom counting but just has a black screen. Sometimes it shows the feed for 5 seconds and then goes to the black screen.

@adoreparler
Copy link
Author

I have the option to use medium or low quality RTSP Links from Unifi. I can try that first. If that does not work, does the links in the WebRTC UI for the rtsp stream provide lower quality streaming and does it add lag if it has to convert it to lower quality (if that is what the different links do in the UI?).

From the page you linked:
Google Nest Hub

H.264 High Profile up to level 4.1 (720p/60fps)
VP9 up to level 4.0 (720p/60fps)

Nest Hub Max

H.264 High Profile up to level 4.1 (720p/30fps)
VP9 up to level 4.0 (720p/30fps)

@adoreparler
Copy link
Author

Using the Medium Resolution (1280x720) link from Unifi Camera seems to work. I will test it over the next couple of days and then close out this question. Thanks for your help.

@ddean6232
Copy link

ddean6232 commented Mar 7, 2024

Maybe related but may be not....
Home Assistant version 20224.3.0 seems to break WebRTC.dash_cast service (see below).
@adoreparler you never mention your version of HASS and what platform its running on
I rolled back to HASS 2024.2.5 and DashCast is working again.
@AlexxIT, I have included the HASS 2024.3.0 log for your information. Let me know if you need anything else if you look into this break.
YAML in HASS

service: webrtc.dash_cast
data:
  entity_id: media_player.apartment_tv
  url: rtsp://192.168.0.5:8554/OfficeEast
  force: true

ERROR IN HASS LOG

This error originated from a custom integration.

Logger: custom_components.webrtc.utils
Source: custom_components/webrtc/utils.py:191
integration: WebRTC Camera (documentation, issues)
First occurred: 3:59:21 PM (2 occurrences)
Last logged: 4:01:54 PM

Can't DashCast to ['media_player.apartment_tv']
Traceback (most recent call last):
  File "/config/custom_components/webrtc/utils.py", line 191, in dash_cast
    entity.dashcast.load_url(url, force)
TypeError: DashCastController.load_url() takes 2 positional arguments but 3 were given

@AlexxIT
Copy link
Owner

AlexxIT commented Mar 8, 2024

@ddean6232 fixed in latest master version

@hankfic
Copy link

hankfic commented Mar 8, 2024

@ddean6232 fixed in latest master version

Confirming the fix works here, had the same issue as @ddean6232

Even when working though, I struggle with a similar issue that @adoreparler reports with Google Nest Hub but not sure it's WebRTC since I get the same results with generic camera stream. I'm using an Amcrest camera, and even at the lowest resolution, bitrate, and quality settings, the stream works great for about 5 minutes until loading wheel of death and then it needs to be restarted only to happen again.

@damianrovira
Copy link

Having the same issue, I am not able to stream using dash cast, it was working normal, streaming my reolink cameras with automation.

@ddean6232
Copy link

ddean6232 commented Mar 8, 2024

@hankfic @AlexxIT Havent got the fix to work.... HASS still reporting error as:

This error originated from a custom integration.

Logger: custom_components.webrtc.utils
Source: custom_components/webrtc/utils.py:191
integration: WebRTC Camera (documentation, issues)
First occurred: 2:15:27 PM (2 occurrences)
Last logged: 2:18:59 PM

Can't DashCast to ['media_player.apartment_tv']
Traceback (most recent call last):
  File "/config/custom_components/webrtc/utils.py", line 191, in dash_cast
    entity.dashcast.load_url(url, force = force)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DashCastController.load_url() takes 2 positional arguments but 3 were given

I even went directly into the custom_components/webrtc folder and checked that the fix was applied... it was

@hankfic How did you apply the fix? redownload through HACS and restart HASS? I rolled back to HASS v2024.2.5 and everything (webrtc cards and dashcast) is working again

@hankfic
Copy link

hankfic commented Mar 9, 2024

@ddean6232 are you running off master? delete webrtc integration and then add it back again selecting master branch instead of latest version (default).

@ddean6232
Copy link

I think I got it now.... not sure why it didnt take the first time.... The steps this time were:

  1. get the repo direct from master branch
  2. delete the WebRTC integration in HASS
  3. copy the custom_components/webrtc repo structure over the HASS custom_components\webrtc structure
  4. add back the WebRTC integration
  5. upgrade HASS from 2024.2.5 to 2024.3
  6. test dash_cast service --> success

Thanks @hankfic @AlexxIT

@cgilis
Copy link

cgilis commented Mar 15, 2024

Small question, will this be fixed in a later update ?

@AlexxIT AlexxIT added bug Something isn't working and removed question Further information is requested labels Apr 7, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Apr 7, 2024

Original problem was with very hi video profile for chromecast device "Main 5.0"

@AlexxIT AlexxIT closed this as completed Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants