AlexxIT / WebRTC

Home Assistant custom component for real-time viewing of almost any camera stream using WebRTC and other technologies.
https://github.com/AlexxIT/Blog
MIT License
1.5k stars 177 forks source link

Tuya camera Webrtc wont stay streaming #717

Open rdkartono opened 4 months ago

rdkartono commented 4 months ago

I have a camera from Tuya (https://expo.tuya.com/product/1106403) that dont have ONVIF nor direct RTSP Port. I know, I regret buying it.

However by using Home Assistant + WebRTC component, I managed to view it in Lovelace card.

type: custom:webrtc-camera
entity: camera.rooftop_ptz
mode: webrtc
server: http://192.168.70.2:1984/
background: true

Then it showed at go2rtc web UI. I pass it to frigate, and create a sub stream from it using "detect-> width" and "detect->height", and succesfully showed at Frigate UI. Quality is bad, but I have no other choice.

Frigate config is

go2rtc:
  hass:
    config: "/hass/config"
    streams:
        # create substream from encoding main stream
       # main stream got from home assistant with entity=camera.rooftop_ptz
          rooftop_sub:
            - ffmpeg:camera.rooftop_ptz#width=640#hardware#video=h264#audio=aac

cameras:
    rooftop:
      enabled: true
      ui:
        order: 7
      live:
        stream_name: rooftop_sub
      ffmpeg:
        inputs:
            # main stream, got from home assistant
          - path: rtsp://127.0.0.1:8554/camera.rooftop_ptz
            roles:
              - record
            # sub stream, got from go2rtc
          - path: rtsp://127.0.0.1:8554/rooftop_sub
            roles:
              - detect

The problem is : It can stay streaming as long as I open the Home Assistant webUI. If i close the Home Assistant webUI, it can not stay streaming . After sometimes, frigate become blank, no frames received. At go2rtc web (port 1984) showed online = 0.

maybe some guidance ?

AlexxIT commented 4 months ago

https://github.com/felipecrs/hass-expose-camera-stream-source