Realtime camera streaming without any delay - WebRTC

@keiran.harris I can try to limit listeners on docker interfaces in new go2rtc project.

2 Likes

Hello guys. I am wondering if it possible to combine webrtc-camera card with the picture glance. In other words i would like to have a live feed from sd sream but when i click inside the picture i would like to see the hd stream at bigger window. Thanks.

PS, i am using the tapo integration. My card is looking like this at the moment:

type: custom:stack-in-card
cards:
  - type: custom:webrtc-camera
    url: rtsp://lXXXXX:[email protected]:554/stream2
    camera_view: live
    entities:
      - entity: camera.tapo_camera_sd
        icon: mdi:arrow-left-drop-circle-outline
        tap_action:
          action: call-service
          service: tapo_control.ptz
          service_data:
            entity_id: camera.tapo_camera_sd
            pan: LEFT
      - entity: camera.tapo_camera_sd
        icon: mdi:arrow-up-drop-circle-outline
        tap_action:
          action: call-service
          service: tapo_control.ptz
          service_data:
            entity_id: camera.tapo_camera_sd
            tilt: UP
      - entity: camera.tapo_camera_sd
        icon: mdi:arrow-down-drop-circle-outline
        tap_action:
          action: call-service
          service: tapo_control.ptz
          service_data:
            entity_id: camera.tapo_camera_sd
            tilt: DOWN
      - entity: camera.tapo_camera_sd
        icon: mdi:arrow-right-drop-circle-outline
        tap_action:
          action: call-service
          service: tapo_control.ptz
          service_data:
            entity_id: camera.tapo_camera_sd
            pan: RIGHT
  - type: glance
    show_icon: true
    show_name: false
    show_state: false
    style: |
      ha-card.type-glance .entities, 
      ha-card.type-glance .entity {
        padding: 0px;
        margin: 0px;
      }
      ha-card.type-glance {
        margin-bottom: 0px;
      }
    entities:
      - entity: camera.tapo_camera_hd
        icon: mdi:cctv
        tap_action:
          action: call-service
          service: tapo_control.set_motion_detection_mode
          service_data:
            entity_id: camera.tapo_camera_hd
            motion_detection_mode: low
      - entity: camera.tapo_camera_sd
        icon: mdi:cctv-off
        tap_action:
          action: call-service
          service: tapo_control.set_motion_detection_mode
          service_data:
            entity_id: camera.tapo_camera_hd
            motion_detection_mode: 'off'
      - entity: camera.tapo_camera_sd
        icon: mdi:weather-sunny
        tap_action:
          action: call-service
          service: tapo_control.set_day_night_mode
          service_data:
            entity_id: camera.tapo_camera_sd
            day_night_mode: 'off'
      - entity: camera.tapo_camera_sd
        icon: mdi:weather-night
        tap_action:
          action: call-service
          service: tapo_control.set_day_night_mode
          service_data:
            entity_id: camera.tapo_camera_sd
            day_night_mode: 'on'
  - type: entities
    entities:
      - entity: binary_sensor.tapo_motion_detection
        name: Motion Sensor
    style: |
      ha-card.type-entities {
        margin-right: 14px;
      }
      ha-card.type-entities #states {
        padding-top: 10px;
      }
1 Like

go2rtc compatible with default picture glance card

Thanks @AlexxIT - wow go2rtc looks really promising! Thanks for all you dev!!

Thinking about my issue more (and anyone with their setup using docker and non-host-mode networking) … i think the feature request may simply be - allow the user to configure what IP address HASS is known on the local network (not the inside docker network). For instance inside my hass docker instance is 172.x.x.x…… but on my real LAN, its 10.1.3.50 (which then of course maps out to an external IP on the internet thru NAT for access outside the house).

So an ability to hard code the IP that the hass streaming source is on - not auto discovery of it - which in this case doesnt work.

go2rtc support hardcode IP list. Check docs.

I’m trying to decide which networks to ignore. Maybe all networks 172.xxx.xxx.xxx

Nice @AlexxIT ! I plan to look deeper at your new project on the weekend so will read the docs fully then. I suspect you will need to allow the user to configure what ranges they should ignore - as docker people may like to fiddle with non standard ranges. Did you want me to move this chat to a new github issue (how do you find the time mate?!!! Very appreciative of your dev. Ill buy you a coffee when im up and running).

Range of networks is very complicated for middle user. I don’t like having options like this.

Unfortunately, you can’t send me a coffee after february 2022…

New feature for go2rtc - support stream from local USB cameras to RTSP and WebRTC.
Tested cameras from Windows, macOS, HassIO installations.

1 Like

I am using 172.16.3.x as my local net …might not be the best option :slight_smile:

To close this tangent off here… ive just spun up your go2rtc project, and early signs are very promising (for anyone following the IP address problem of hass inside of docker running behind nginx - i believe it will be solved via this new project - by virtue of the fact that the webRTC server in the new project runs as its own container - which you can place on a more accessible part of your docker network, NOT behind nginx where your HASS probably lives - which gets around the random UDP port thing that webRTC uses).

I do have some early questions… so have spawned off a new thread so as to not bug these good people on this already mega-thread.

For those interested in @AlexxIT wonderful new go2rtc project, lets continue the chat over here —> Go2rtc project - help thread

I have been using WebRTC player on my frontend for some time now, it was working great up until recently. I’m now getting an error: “ERROR: WebRTC server not available”, after some time it tries to restart the stream and it get’s the same error again.

When I hit F12 in my browser I see the following:

image

When I try to open the RTSP stream on my system it works great (through VLC player) for both the bunny.mp4 and my camera.

I honestly don’t know what has changed, but something must have changed.

Where can I start to troubleshoot.

Can you try to reload the integration?

And by integration you mean “WebRTC camera”. When I choose to reload it tell’s me I need to restart Homeassistant in order to reload the integration. This I have done multiple times lately.

Have you seen this project? The guy is doing interesting things with Eufy’s P2P

Thanks for sharing, yes, we had discussed this briefly inside eufy security repository.

In the go2rtc project, are you planning on mirroring the webrtc.create_link service that is in this project? I’ve been slowly moving over to the new project (which is pretty great btw) and I’m trying to work out now how I can get https streams over to some of my android devices that require it per camera. I currently use the create_link from this project to do that.

Yes. Some custom functions like webrtc.create_link require a custom component. I can’t do them with only addon. But them will be later. When go2rtc will be released as stable version.

Btw. New unique function: go2rtc now can get stream from HomeKit Camera. It’s the first app in the World that can do that.

4 Likes

Great work, thanks for everything.

Can we add streams using rest api rather than defining them in yaml file? I want eufy_security integration to get benefit of this add-on, via publishing its stream information automatically, without user intervention.

My experience so far says the zero config will work just fine out of the box with the eufy_security camera. You won’t need to do anything as long as the rtsp2webrtc addon is installed by the user. This is routing even my google home hub camera over webrtc without doing anything. It’s pretty slick.

1 Like

All Hass streams can be added on the fly on first start. No need to setup them via go2rtc config.

1 Like