fuatakgun / eufy_security

Home Assistant integration to manage Eufy Security devices as cameras, home base stations, doorbells, motion and contact sensors.
842 stars 73 forks source link

webRTC streams not working #1111

Closed domb84 closed 4 months ago

domb84 commented 4 months ago

When I attempt to start and stream a webRTC stream, the codec appears to be invalid.

The stream starts and navigating to the go2rtc web ui and getting the stream info shows a valid stream:

{ "producers": [ { "url": "T8142N93214313EB" }, { "type": "Bitstream producer", "medias": [ "video, recvonly, H.264 High 4.2" ], "receivers": [ "255 H264, bytes=598262, senders=1" ], "recv": 608321 } ], "consumers": [ { "type": "RTSP passive consumer", "url": "rtsp://192.168.0.11:8554/T8142N93214313EB", "remote_addr": "192.168.0.11:59630", "user_agent": "Lavf60.3.100", "sdp": "v=0\r\no=- 1 1 IN IP4 0.0.0.0\r\ns=go2rtc/1.8.5\r\nc=IN IP4 0.0.0.0\r\nt=0 0\r\nm=video 0 RTP/AVP 96\r\na=rtpmap:96 H264/90000\r\na=fmtp:96 packetization-mode=1;profile-level-id=64002a;sprop-parameter-sets=J2QAKq0AzoB4AiflmoCAgPgAAAMACAAAAwDxoAAQRAABhmG//4FA,KO48sA==\r\na=control:trackID=0\r\n", "medias": [ "video, sendonly, ANY", "audio, sendonly, ANY" ], "senders": [ "96 H264, bytes=380376, receivers=1" ], "send": 397572 } ] }

Playing it in the go2rtc web ui using the standard stream.html i get this error:

undefined error=streams: codecs not matched: H264 => JPEG caller=github.com/AlexxIT/go2rtc/internal/mjpeg/init.go:166

If I select any of the rtsp streams i.e. rtsp://192.168.0.11:8554/T8142N93214313EB, i can playback without issue in VLC, so the stream is working.

Nothing is ever shown in the home assistant ui when using this card:

type: custom:webrtc-camera
entity: camera.back_door
poster: image.entrance_event_image
ui: true
shortcuts:
  - name: Play
    icon: mdi:play
    service: camera.turn_on
    service_data:
      entity_id: camera.back_door
  - name: Stop
    icon: mdi:stop
    service: camera.turn_off
    service_data:
      entity_id: camera.back_door

The black image remains there at all times, whether streaming or not.

image

Am I missing a step? It looks as though it is trying to pull the wrong stream perhaps?

domb84 commented 4 months ago

``I'm not sure what happened overnight but the webrtc integration was removed after the homeassistant container got updated. I've re-added the integration and it's working!

If anyone else comes across the issues.

  1. Make sure to use fuatakgun/WebRTC component git clone https://github.com/fuatakgun/WebRTC.git cd WebRTC git filter-branch --subdirectory-filter custom_components/webrtc If you installed the standard one, remove it and ensure you restart the homeassistant container.
  2. Opera does not support h.264 for some reason, the video plays back fine in Brave
  3. To fix the thumbnails make sure you actually reference the camera event image
type: custom:webrtc-camera
entity: camera.back_door
poster: image.back_door_event_image
ui: true
shortcuts:
  - name: Play
    icon: mdi:play
    service: camera.turn_on
    service_data:
      entity_id: camera.back_door
  - name: Stop
    icon: mdi:stop
    service: camera.turn_off
    service_data:
      entity_id: camera.back_door
  1. If you get a DESCRIBE error, naviagte to the go2rtc web ui and delete the problem stream and try again. This fixed it for me on the one camera that wasn't working.
fuatakgun commented 4 months ago

thanks, with the recent add-on version, p2p streaming is not working because of AES encyription key, needs to be fixed on eufy-security-client