Realtime camera streaming without any delay - WebRTC

I use the jsmpeg stream for my live preview. It is enough in my case.
When motion is detected it opens a substream in a separate window. Mainstream lags to much.

With recordings I learned to live without it.

So not a real solution, but fine for me. So never dipped deeper.

I also used jsmpeg for now. What do you mean by the substream opening in a separate window. Is that using jsmpeg too? It’s baffling that there are not more mentions about this being an issue on the web. I mean the tablet is from 2020, it’s insane webrtc isn’t better supported. I mean it works in Firefox so must be Chrome just blocking it. Some people mention modding webview with libwebrtc.aar, but nobody is going into details. :frowning:

I’m really disappointed by this piece of junk. I have two of them and both of them had their batteries expand twice too. Seems the whole thing was build out of the cheapest components available. The last posts around support for it in Chrome are all from 2018, so I guess there’s no hope then :frowning:

I have a dashboard on a wall mounted tablet. If there is motion, eg. some is at the door, there is a popup opened on the dashboard. It shows the substream with jsmpeg.
This was the only way to get short loading times and a “fluent” stream. I learned that most of live streams are substreams. Main stream is only used for recording, not only in my setup but also on other setups.

  action:
    - service: browser_mod.popup
      data:
        size: wide
        style:
          .: |
            :host .content {
              width: 1150px;
            }
        content:
          type: custom:frigate-card
          cameras:
            - go2rtc:
                stream: gartentuere_sub
                modes:
                  - mse
              live_provider: jsmpeg
              frigate: {}
              camera_entity: camera.gartentuere
          performance:
            profile: low
          menu:
            style: none
1 Like

I have reolink csmera. I would try jsmpeg for live preview to, but i don’t know how to set it up.
Can you post your lovelace card code?

I use an iPad with a full screen browser. I have a button to start a camera full screen with WebRTC, but I can’t find a way to navigate back to the main page. I can add overlay buttons (shortcuts) to open the door, lights, etc., is there a way to add a button to navigate to a url (Home Assistant main page)?

      - type: custom:frigate-card
        view_layout:
            grid-area: camera
        cameras:
          - camera_entity: camera.hof
            live_provider: jsmpeg
            icon: mdi:garage
            go2rtc:
              stream: hof_sub
          - camera_entity: camera.gartentuere
            live_provider: jsmpeg
            triggers:
              entities: []
              motion: true
            go2rtc:
              stream: gartentuere_sub
            icon: mdi:door
        view:
          default: live
          update_seconds: 300
          timeout_seconds: 300
          update_force: false
          scan:
            enabled: true
            untrigger_seconds: 240
        menu:
          style: none
        live:
          preload: true
          draggable: true
          actions:
            tap_action:
              action: fire-dom-event
              browser_mod:
                service: browser_mod.popup
                data:
                  card_mod:
                    style:
                      ha-dialog$: |
                        div.mdc-dialog__scrim {
                          backdrop-filter: blur(15px) !important;
                          -webkit-backdrop-filter: blur(50px) !important;
                          background-color: rgba(0,0,0,0.2) !important;
                        }
                  style: >
                    --popup-max-width: 1150px;
                  content:
                    type: custom:frigate-card
                    cameras:
                      - camera_entity: camera.hof
                        live_provider: go2rtc
                        icon: mdi:garage
                        go2rtc:
                          stream: hof
                          modes:
                            - webrtc
                      - camera_entity: camera.gartentuere
                        live_provider: go2rtc
                        triggers:
                          entities: []
                          motion: true
                        go2rtc:
                          stream: gartentuere
                          modes:
                            - webrtc
                        icon: mdi:door
                    view:
                      default: live
                      update_seconds: 300
                      timeout_seconds: 300
                      update_force: false
                      scan:
                        enabled: false
                        untrigger_seconds: 240
                        show_trigger_status: false
                        untrigger_reset: false
                    menu:
                      style: overlay
                      buttons:
                        frigate:
                          enabled: true
                        cameras:
                          enabled: true
                        timeline:
                          enabled: true
                        expand:
                          enabled: false
                        fullscreen:
                          enabled: false
                        live:
                          enabled: false
                        snapshots:
                          enabled: false
                    live:
                      preload: true
                      draggable: true
                      actions:
                        tap_action:
                          action: fire-dom-event
                          browser_mod:
                            service: browser_mod.popup
                            data:
                              content:
                                type: custom:frigate-card
                                cameras:
                                  - camera_entity: camera.gartentuere
                      controls:
                        next_previous:
                          style: none
                      auto_play: all
                    image:
                      mode: camera
                    performance:
                      profile: low
                    media_viewer:
                      auto_play: all
                      draggable: true
                      layout: {}
                      controls:
                        timeline:
                          mode: below
                          style: stack
                          media: clips
                        title: {}
                        thumbnails: {}
                      transition_effect: slide
                    timeline:
                      style: ribbon
                      media: clips
                      show_recordings: true
                      controls:
                        thumbnails:
                          mode: below
                          show_details: false
                    media_gallery:
                      controls:
                        thumbnails:
                          size: 175
                          show_details: false
                          show_timeline_control: false
                    view_layout:
                      grid-area: camera

All cameras show in HomeAssistant addon RTSPtoWeb - WebRTC (ver: 1.4.0), but not in Homeassistant. No devices or entities shows in Home Assistant integration. I have deleted and reinstalled both addon and integration and restart HomeAssistant, No success.

Home Assistant 2023.8.1
Supervisor 2023.08.1
Operating System 10.4
Frontend 20230802.0 - latest
2023-08-10 15:07:52.692 DEBUG (MainThread) [rtsp_to_webrtc.web_client] Not updating stream url since already set
2023-08-10 15:07:52.692 DEBUG (MainThread) [rtsp_to_webrtc.web_client] request[post] http://homeassistant.local:8083/stream/camera.garage/channel/0/webrtc
2023-08-10 15:07:52.697 DEBUG (MainThread) [rtsp_to_webrtc.web_client] response <ClientResponse(http://homeassistant.local:8083/streams) [200 OK]>
<CIMultiDictProxy('Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With', 'Access-Control-Allow-Methods': 'POST, OPTIONS, GET, PUT, DELETE', 'Access-Control-Allow-Origin': '*', 'Content-Type': 'application/json; charset=utf-8', 'Date': 'Thu, 10 Aug 2023 13:07:52 GMT', 'Content-Length': '1559')>

2023-08-10 15:07:52.698 DEBUG (MainThread) [rtsp_to_webrtc.web_client] Not updating stream url since already set
2023-08-10 15:07:52.698 DEBUG (MainThread) [rtsp_to_webrtc.web_client] request[post] http://homeassistant.local:8083/stream/camera.zoom/channel/0/webrtc
2023-08-10 15:07:52.708 DEBUG (MainThread) [rtsp_to_webrtc.web_client] response <ClientResponse(http://homeassistant.local:8083/streams) [200 OK]>
<CIMultiDictProxy('Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With', 'Access-Control-Allow-Methods': 'POST, OPTIONS, GET, PUT, DELETE', 'Access-Control-Allow-Origin': '*', 'Content-Type': 'application/json; charset=utf-8', 'Date': 'Thu, 10 Aug 2023 13:07:52 GMT', 'Content-Length': '1559')>

2023-08-10 15:07:52.708 DEBUG (MainThread) [rtsp_to_webrtc.web_client] Not updating stream url since already set
2023-08-10 15:07:52.709 DEBUG (MainThread) [rtsp_to_webrtc.web_client] request[post] http://homeassistant.local:8083/stream/camera.porch_door/channel/0/webrtc
2023-08-10 15:07:52.802 DEBUG (MainThread) [rtsp_to_webrtc.web_client] response <ClientResponse(http://homeassistant.local:8083/stream/camera.garage/channel/0/webrtc) [200 OK]>
<CIMultiDictProxy('Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With', 'Access-Control-Allow-Methods': 'POST, OPTIONS, GET, PUT, DELETE', 'Access-Control-Allow-Origin': '*', 'Date': 'Thu, 10 Aug 2023 13:07:52 GMT', 'Content-Type': 'text/plain; charset=utf-8', 'Transfer-Encoding': 'chunked')>

2023-08-10 15:07:52.838 DEBUG (MainThread) [rtsp_to_webrtc.web_client] response <ClientResponse(http://homeassistant.local:8083/stream/camera.zoom/channel/0/webrtc) [200 OK]>
<CIMultiDictProxy('Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With', 'Access-Control-Allow-Methods': 'POST, OPTIONS, GET, PUT, DELETE', 'Access-Control-Allow-Origin': '*', 'Date': 'Thu, 10 Aug 2023 13:07:52 GMT', 'Content-Type': 'text/plain; charset=utf-8', 'Transfer-Encoding': 'chunked')>

2023-08-10 15:07:52.849 DEBUG (MainThread) [rtsp_to_webrtc.web_client] response <ClientResponse(http://homeassistant.local:8083/stream/camera.porch_door/channel/0/webrtc) [200 OK]>
<CIMultiDictProxy('Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With', 'Access-Control-Allow-Methods': 'POST, OPTIONS, GET, PUT, DELETE', 'Access-Control-Allow-Origin': '*', 'Date': 'Thu, 10 Aug 2023 13:07:52 GMT', 'Content-Type': 'text/plain; charset=utf-8', 'Transfer-Encoding': 'chunked')>

2023-08-10 15:07:55.284 DEBUG (MainThread) [rtsp_to_webrtc.web_client] request[get] http://homeassistant.local:8083/streams
2023-08-10 15:07:55.304 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139938016557760] Error handling message: Camera not found (unknown_error) sony from 192.168.1.1 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36)
2023-08-10 15:07:55.323 DEBUG (MainThread) [rtsp_to_webrtc.web_client] request[get] http://homeassistant.local:8083/streams
2023-08-10 15:07:55.345 DEBUG (MainThread) [rtsp_to_webrtc.web_client] request[get] http://homeassistant.local:8083/streams
2023-08-10 15:07:55.346 DEBUG (MainThread) [rtsp_to_webrtc.web_client] response <ClientResponse(http://homeassistant.local:8083/streams) [200 OK]>
<CIMultiDictProxy('Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With', 'Access-Control-Allow-Methods': 'POST, OPTIONS, GET, PUT, DELETE', 'Access-Control-Allow-Origin': '*', 'Content-Type': 'application/json; charset=utf-8', 'Date': 'Thu, 10 Aug 2023 13:07:55 GMT', 'Content-Length': '1559')>

2023-08-10 15:07:55.347 DEBUG (MainThread) [rtsp_to_webrtc.web_client] Not updating stream url since already set
2023-08-10 15:07:55.347 DEBUG (MainThread) [rtsp_to_webrtc.web_client] request[post] http://homeassistant.local:8083/stream/camera.garage/channel/0/webrtc
2023-08-10 15:07:55.370 DEBUG (MainThread) [rtsp_to_webrtc.web_client] response <ClientResponse(http://homeassistant.local:8083/streams) [200 OK]>
<CIMultiDictProxy('Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With', 'Access-Control-Allow-Methods': 'POST, OPTIONS, GET, PUT, DELETE', 'Access-Control-Allow-Origin': '*', 'Content-Type': 'application/json; charset=utf-8', 'Date': 'Thu, 10 Aug 2023 13:07:55 GMT', 'Content-Length': '1559')>

2023-08-10 15:07:55.370 DEBUG (MainThread) [rtsp_to_webrtc.web_client] Not updating stream url since already set
2023-08-10 15:07:55.371 DEBUG (MainThread) [rtsp_to_webrtc.web_client] request[post] http://homeassistant.local:8083/stream/camera.zoom/channel/0/webrtc
2023-08-10 15:07:55.403 DEBUG (MainThread) [rtsp_to_webrtc.web_client] response <ClientResponse(http://homeassistant.local:8083/streams) [200 OK]>
<CIMultiDictProxy('Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With', 'Access-Control-Allow-Methods': 'POST, OPTIONS, GET, PUT, DELETE', 'Access-Control-Allow-Origin': '*', 'Content-Type': 'application/json; charset=utf-8', 'Date': 'Thu, 10 Aug 2023 13:07:55 GMT', 'Content-Length': '1559')>

2023-08-10 15:07:55.403 DEBUG (MainThread) [rtsp_to_webrtc.web_client] Not updating stream url since already set
2023-08-10 15:07:55.404 DEBUG (MainThread) [rtsp_to_webrtc.web_client] request[post] http://homeassistant.local:8083/stream/camera.porch_door/channel/0/webrtc
2023-08-10 15:07:55.587 DEBUG (MainThread) [rtsp_to_webrtc.web_client] response <ClientResponse(http://homeassistant.local:8083/stream/camera.zoom/channel/0/webrtc) [200 OK]>
<CIMultiDictProxy('Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With', 'Access-Control-Allow-Methods': 'POST, OPTIONS, GET, PUT, DELETE', 'Access-Control-Allow-Origin': '*', 'Date': 'Thu, 10 Aug 2023 13:07:55 GMT', 'Content-Type': 'text/plain; charset=utf-8', 'Transfer-Encoding': 'chunked')>

2023-08-10 15:07:55.598 DEBUG (MainThread) [rtsp_to_webrtc.web_client] response <ClientResponse(http://homeassistant.local:8083/stream/camera.garage/channel/0/webrtc) [200 OK]>
<CIMultiDictProxy('Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With', 'Access-Control-Allow-Methods': 'POST, OPTIONS, GET, PUT, DELETE', 'Access-Control-Allow-Origin': '*', 'Date': 'Thu, 10 Aug 2023 13:07:55 GMT', 'Content-Type': 'text/plain; charset=utf-8', 'Transfer-Encoding': 'chunked')>

2023-08-10 15:07:55.647 DEBUG (MainThread) [rtsp_to_webrtc.web_client] response <ClientResponse(http://homeassistant.local:8083/stream/camera.porch_door/channel/0/webrtc) [200 OK]>
<CIMultiDictProxy('Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With', 'Access-Control-Allow-Methods': 'POST, OPTIONS, GET, PUT, DELETE', 'Access-Control-Allow-Origin': '*', 'Date': 'Thu, 10 Aug 2023 13:07:55 GMT', 'Content-Type': 'text/plain; charset=utf-8', 'Transfer-Encoding': 'chunked')>




You shouldn’t be expecting cameras there.

Hi,

I’m trying to find a way to get my Reolink stream on my mounted iPad. With the standard way, it shows an MSE stream which lags a lot. Is this something that would change when using another codec in go2rtc (looking at the codecs madness part)? And how can I reach the included go2rtc settings if I have WebRTC installed? Do I need to install go2rtc separately or not?

Just remove MSE from modes list as described in readme.

MSE selected because Reolink cameras has AAC audio, which supported only in MSE.

Thanks, you mean by using mse: false? Because then the stream keeps loading2 and nothing happens.

Hello, boys ,
I have a problem and I don’t know what to do.
I have 3 cameras, 1 Hikvision and 2 cameras from China.
Hikvision works on phone and in browser but lags.
Cameras from China (Boavision and Zysecurity, work, but only in the second stream. In the main stream it does not work
I mention that in the second stream both cameras only work on the phone in the browser, nothing. Both camera work with H265.
Thank you in advance

binary_sensor:
  - platform: hikvision
    host:[u] ip of your cam[/u]
    port: 80
    ssl: false
    username: admin # or your username
    password: !secret hikvision # or your password
    customize:
      motion:
        delay: 30
      line_crossing:
        ignored: true

binary_sensor 2:
  - platform: hikvision
    host: [u] ip of your second cam[/u]
    port: 80
    ssl: false
    username: admin # or your username
    password: !secret hikvision  # or your password
    customize:
      motion:
        delay: 30
      line_crossing:
        ignored: true

In your case put binary_sensor (not binary_sensor 2) in your config.yaml.
This is my solution and it works with hikvision.
After that you can integrate the cam in generic cam.
For the chinese cams i have no solution.

Best regards Peer

Hello. Would someone be able to tell me if there is a way to go full screen on my iPhone? I want the option like it automatically gives you on the web browser. I’m not seeing it on my phone. The button disappears.

Hi all. just did this in my Google Hub + Reolink doorbell, and it works very well, but I have one problem: if i’m not at home, the google hub will keep trasmitting the feed “forever”. anyway to send a command to stop it and get back to homescreen?

Just

                  - service: media_player.turn_off
                    target:
                      entity_id: media_player.kitchen_display
                    data: {}

Does anyone know how you can hide the mode label when using webrtc.create_link in a script?

I tried adding this in but it didnt working:

service: webrtc.create_link
data:
  link_id: "{{ link_id }}"
  entity: camera.doorbell_webrtc
  style: '.mode {display: none}'
  open_limit: 1
  time_to_live: 20

Please tell me what characteristics of the camera should be in order for WebRTC to work?

It requires RTSP, that’s it