mrlt8 / docker-wyze-bridge

WebRTC/RTSP/RTMP/LL-HLS bridge for Wyze cams in a docker container
GNU Affero General Public License v3.0
2.68k stars 171 forks source link

WebRTC 404, SetRemoteDescription called with no ice-ufrag #1230

Open bpmich opened 6 months ago

bpmich commented 6 months ago

Describe the bug

Provide a clear and concise description of the issue and include logs if applicable. WebRTC streams are failing to connect in Frigate

Error in Question (produced by Frigate) SetRemoteDescription called with no ice-ufrag" stream=alley

docker-wyze-bridge Docker Compose:

version: "2.4"
services:
  wyze-bridge:
    logging:
      driver: "syslog"
      options:
        syslog-address: "udp://192.168.1.244:2514"
        syslog-format: "rfc3164"
        tag: "wyze-bridge"
    container_name: wyze-bridge
    restart: unless-stopped
    image: mrlt8/wyze-bridge:latest
    ports:
        - 1936:1935 # RTMP
        - 8556:8554 # RTSP
        - 8888:8888 # HLS
        - 8889:8889 #WebRTC
        - 8189:8189/udp # WebRTC/ICE
        - 5500:5000 # WEB-UI
    environment:
        - WB_AUTH=False
        - WYZE_EMAIL=${WYZE_EMAIL}
        - WYZE_PASSWORD=${WYZE_PASSWORD}
        - API_ID=redacted
        - API_KEY=redacted
        - ROTATE_CAM_ALLEY_CAMERA=2
        - ENABLE_AUDIO=True
        - WB_IP=192.168.1.244
    networks:
      - proxy

networks:
  proxy:
    external: true

Relevant docker-wyze-bridge logs: [WyzeBridge] 172.18.0.1 - - [26/May/2024 02:15:00] "POST /living-room-camera/ HTTP/1.1" 404 -

Relevant Frigate config:

go2rtc:
  streams:
    alley:
    - webrtc:http://192.168.1.244:8889/alley-camera/
    backyard:
    - webrtc:http://192.168.1.244:8889/backyard-camera/
    living_room:
    - webrtc:http://192.168.1.244:5500/living-room-camera/
  webrtc:
    candidates:
    - 192.168.1.244:8555
    - stun:8555

Environment (if applicable)

bpmich commented 5 months ago

Update, after enabling auth and reconfiguring Frigate, I get a new error from the go2rtc component.

error="streams: sdp: syntax error at pos 1: \"0\"" stream=living_room

Relevant Frigate Config

go2rtc:
  streams:
    #alley:
    #- webrtc:http://192.168.1.244:8889/alley-camera/
    #backyard:
    #- webrtc:http://192.168.1.244:8889/backyard-camera/
    living_room:
      - webrtc:http://wb:v5sygxSOi9KDmB9xRN8xL28xHyUZ2xvkHsgkCrkG@192.168.1.244:8889/living-room-camera/
    front_porch_1:
      - ffmpeg:http://192.168.1.33/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=record&password=password#video=copy#audio=copy#audio=opus
    front_porch_1_sub:
      - ffmpeg:http://192.168.1.33/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=record&password=password
    front_porch_2:
      - ffmpeg:http://192.168.1.34/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=record&password=password#video=copy#audio=copy#audio=opus
    front_porch_2_sub:
      - ffmpeg:http://192.168.1.34/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=record&password=password
    front_porch_3:
      - ffmpeg:http://192.168.1.35/flv?port=1935&app=bcs&stream=channel0_sub.bcs&user=record&password=password#video=copy#audio=copy#audio=opus
  webrtc:
    candidates:
      - 192.168.1.244:8555
      - stun:8555
bpmich commented 4 months ago

Looking to see what I can add to help diagnose this issue. Any suggestions?

mrlt8 commented 4 months ago

Have you tried the RTSP stream?

bpmich commented 4 months ago

Have you tried the RTSP stream?

Yes, I can confirm the RTSP stream is functional. Here is the go2rtc config I have set up in order to test different docker-wyze-bridge env vars:

go2rtc:
  streams:
    #alley:
    #  - webrtc:http://192.168.1.244:8889/alley-camera/
    #backyard:
    #  - webrtc:http://192.168.1.244:8889/backyard-camera/
    #living_room:
    #  - webrtc:http://192.168.1.244:8889/signaling/living-room-camera?kvs#format=wyze
    alley:
      - ffmpeg:rtsp://192.168.1.244:8556/alley-camera
      - "ffmpeg:alley#audio=aac"
    backyard:
      - ffmpeg:rtsp://192.168.1.244:8556/backyard-camera
      - "ffmpeg:backyard#audio=aac"
    living_room:
      - ffmpeg:rtsp://192.168.1.244:8556/living-room-camera
      - "ffmpeg:living_room#audio=aac"
  webrtc:
    candidates:
      - 192.168.1.244:8555
      - stun:8555

These cameras were working using webrtc prior to the wyze-api update. At that time, I was pointing directly to the docker-wyze-bridge WebUI port to get the WebRTC stream working. The go2rtc config looked like this:

go2rtc:
  streams:
    alley:
      - webrtc:http://192.168.1.244:5000/signaling/alley-camera?kvs#format=wyze
    backyard:
      - webrtc:http://192.168.1.244:5000/signaling/backyard-camera?kvs#format=wyze
    living_room:
      - webrtc:http://192.168.1.244:5000/signaling/living-room-camera?kvs#format=wyze
  webrtc:
    candidates:
      - 192.168.1.244:8555
      - stun:8555

For posterity, here is my current docker-compose for docker-wyze-bridge

version: "2.4"
services:
  wyze-bridge:
    logging:
      driver: "syslog"
      options:
        syslog-address: "udp://192.168.1.244:2514"
        syslog-format: "rfc3164"
        tag: "wyze-bridge"
    container_name: wyze-bridge
    restart: unless-stopped
    image: mrlt8/wyze-bridge:latest
    ports:
        - 1936:1935 # RTMP
        - 8556:8554 # RTSP
        - 8888:8888 # HLS
        - 8889:8889 #WebRTC
        - 8189:8189/udp # WebRTC/ICE
        - 5500:5000 # WEB-UI
    environment:
        - WB_AUTH=False
        - WYZE_EMAIL=${WYZE_EMAIL}
        - WYZE_PASSWORD=${WYZE_PASSWORD}
        - API_ID=REDACTED
        - API_KEY=REDACTED
        - ROTATE_CAM_ALLEY_CAMERA=2
        - ENABLE_AUDIO=True
        - ON_DEMAND=false
        - NET_MODE=P2P
        - IGNORE_OFFLINE=true
        - WB_IP=192.168.1.244
        - FILTER_NAMES=Driveway
        - FILTER_BLOCK=true
    networks:
      - proxy

networks:
  proxy:
    external: true
bpmich commented 4 months ago

Could this be related to #1195? Frigate reports incorrect SDP as the error, Home Assistant may be reporting a different error for SDP, "wrong response on DESCRIBE"

mrlt8 commented 4 months ago

try:

webrtc:http://wb:v5sygxSOi9KDmB9xRN8xL28xHyUZ2xvkHsgkCrkG@192.168.1.244:5000/signaling/<cam-name>#format=wyze

I believe the latency for WebRTC and RTSP should be negligible when ingesting the streams into Frigate, so if the RTSP stream is working, that may be a better option since it's more straightforward and you don't have to deal with NAT punching.