felipecrs / hass-expose-camera-stream-source

Allows to import Home Assistant cameras into go2rtc and Frigate
MIT License
100 stars 4 forks source link

Stream not working externally #30

Closed pergolafabio closed 10 months ago

pergolafabio commented 10 months ago

Version of the custom_component: 0.1.3

Configuration

streams:
  deurbel:
    - rtsp://syno:xxxx@192.168.0.14:554/Sms=24.unicast
    - isapi://admin:xxxx@192.168.0.70:80/
  pepe_sale:
    - echo:bash /config/custom_components/expose_camera_stream_source/get_stream.sh camera.pepe_sale

        - type: custom:frigate-card
          cameras:
            - camera_entity: camera.pepe_sale
              live_provider: go2rtc
              go2rtc:
                url: https://go2rtc:xxxx@go2rtc.mydomain:8123
                stream: pepe_sale
                modes:
                  - webrtc

        - type: custom:frigate-card
          cameras:
            - camera_entity: camera.deurbel
              live_provider: go2rtc
              go2rtc:
                url: https://go2rtc:xxxx@go2rtc.mydomain:8123
                stream: deurbel
                modes:
                  - webrtc

image

Describe the bug

Hi @felipecrs , as you are aware, i have an hikvision doorbel (deurbel), it works great with go2rtc and frigate, when i'm on mobile , i can see perfecty live video/audio, i have exposes go2rtc to external with nginx... also when i browse to the go2rtc page and click on stream, i can see remote view...

As discussed yesteday, my tuya camera now exposes finally an rtsps stream, so i added the camera "pepe_sale" with HA Tuya integration, i can see live view in HA... Next i tried your component, see yaml above, if i'm home on same local network, i can see the stream perfecty and live! But when i'm on mobile/remote network, it doesnt work anymore, alltough there should be no difference in the hikvision config? Why is the hikvision working remotely and the tuya not? Is this an issue on go2rtc side? or Does it have todo with your script? I dont see the difference? Any idea?

Debug log

No log/error visible, just no stream
pergolafabio commented 10 months ago

I restarted the go2rtc addon, then clicked on "stream" link within the go2rtc page, and then it worked But not in frigate, seems its unstable, cause when sometimes clicking again on stream, it doesnt work anymore, so my guess it has nothing todo with "external"

I saw also this in the addon log:

10:23:10.114 INF [streams] can't get track error="wrong response on DESCRIBE"
10:23:10.115 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="start from CONN state" url="echo:bash /config/custom_components/expose_camera_stream_source/get_stream.sh camera.pepe_sale"
felipecrs commented 10 months ago

I have noticed issues like these with some Tuya cameras from my brother. However, this integration cannot do anything to help. It only serves as a bridge, forwarding the RTSP URL Home Assistant gets to go2rtc.

Is the stream over Home Assistant (not go2rtc) working consistently stable for you?

pergolafabio commented 10 months ago

Yeah, fro HA i always get a valid stream, it takes a few seconds, but it always plays Seems after a restart off the go2rtc addon, when i click on "stream" , it now works, only the frigate card doesnt work, and not sure why

image

pergolafabio commented 10 months ago

Here is full config of card, its basicly a copy/paste from my other doorbell config:

        - type: custom:frigate-card
          cameras:
            - camera_entity: camera.pepe_sale
              live_provider: go2rtc
              go2rtc:
                url: https://aaaa:xxxxxx@go2rtc.mydomain:8123
                stream: pepe_sale
                modes:
                  - webrtc
          menu:
            style: outside
            position: bottom
            buttons:
              screenshot:
                enabled: false
              download:
                enabled: false
              fullscreen:
                enabled: false
              snapshots:
                enabled: false
              timeline:
                enabled: false
              media_player:
                enabled: false
              clips:
                enabled: false
              live:
                enabled: false
              cameras:
                enabled: false
              frigate:
                enabled: false
              camera_ui:
                enabled: false
          live:
            auto_mute: never
            auto_unmute: all
            controls:
              builtin: true
              title:
                mode: none
            layout:
              fit: fill
          dimensions:
            aspect_ratio_mode: static
            aspect_ratio: '16:9'
felipecrs commented 10 months ago

Try MSE mode, just to see. And I think you should open an issue in go2rtc with your go2rtc logs. Maybe go2rtc is not reconnecting/re-requesting the stream when it expires.

pergolafabio commented 10 months ago

ok, i think i found it, i had webrtc mode forced, removed this , and not it works!

                modes:
                  - webrtc