Go2rtc project - help thread

Sorry, you are right, it was an over simplification. On the other hand, many users out there are focused on faster streaming with their existing rtsp based cameras, or, this is my misinterpretation:-)

@AlexxIT , one thing is not clear to me for existing cameras inside home assistant, can they work without any configuration with go2rtc? What should an end user do to get benefits of go2rtc for a very basic rtsp camera setup?

  1. Install addon go2rtc
  2. Install built-in integration RTSPtoWebRTC

That’s all. You already get WebRTC when open almost any camera window in frontend.

You can enable “camera view: live” setting and get WebRTC on dashboard without opening camera window.

Also you may need to setup WebRTC TCP port (in go2rtc.yaml), so your cameras will always work externally without problems.

2 Likes

Clear now, i missed the integration part, let me try it out locally and i can inform eufy security users to migrate over this, currently i am advising everyone to stick with webrtc integration

WebRTC Camera custom integration will be updated when go2rtc will be released. I think users will have options in the future:

  • only WebRTC Camera custom integration (with go2rtc inside)
  • go2rtc addon + RTSPtoWebRTC built-in integration
  • go2rtc addon + WebRTC Camera custom integration

RTSPtoWebRTC integration replaces HLS API for many Hass cameras to WebRTC API.

HLS API can be provided with Hass bulit-in stream integration and built-in ffmpeg libraries.

WebRTC API can be provided with some external addon. RTSPtoWeb addon or RTSPtoWebRTC addon or go2rtc addon.

You know, add-ons might be limiting the user base, as it requires either supervisor or self managed docker but custom integrations looks more accessible, in my personal view.

The addon is literally just a running of the go2rtc binary. Anyone who can’t install an addon can run the binary and get the same thing at the moment. It’s really that simple. But yes an integration will help quite a bit. I’m looking forward to the integration to regain the ability to create webrtc temporary links again.

Is anyone here using the android companion app to view the stream locally? My stream freezes after a few seconds and I can’t get it to unfreeze without navigating away on the app. Sometimes it’ll freeze, then jump forward a bunch of seconds and freeze again. It works perfectly in my browser.

It only happens with WebRTC. RTMP, RTSP, and JSMpeg play without any issues.

I’m using 4k amcrest cameras. I don’t see any system resource issues.

Works okay in my companion app. Except if I try to view many live streams at once. But that’s simply a resource issue

How have you configured things? What card are you using? Entries in go2rtc.yaml? etc.

Here’s my current config:

Camera → RTSP → Frigate → RTMP → Home Assistant. I have RTSPtoWebRTC pointing to go2rtc. My go2rtc.yaml is empty. I see the RTMP stream added automatically in the go2rtc UI when I start a stream.

I see the freezing issue with the Frigate Lovelace Card as well as the Picture Glace card.

Troubleshooting I’ve done:
If I remove go2rtc and RTSPtoWebRTC and add a generic camera with a direct RTSP from the camera it does not freeze.
If I add the RTMP stream from Frigate the stream does no freeze.
I tried using AlexxIT’s older WebRTC plugin only and I get the same issue, stream freezes when it flips to WebRTC (I know it’s webrtc because I’ve verified in developer tools and the icon flipped to webrtc in the corner)

The stream freezes in both the iOS and Android companion apps (only webrtc) but not in any browser.

I wonder if it’s related to the stream being 4k resolution. I’m using Amcrest cameras and H264. I have 1 1080p camera and while it still freezes, it’s not nearly as bad as the 4k ones. The cameras are hardwired, and HA is running in a VM with plenty of CPU and RAM allocated to it).

and to confirm, you’ve disabled the old ‘webrtc camera’? Because they will interfere with each other.

Yup. I currently only have go2rtc and RTSPtoWebRTC installed. I’ve rebooted between reinstall to be safe.

For anyone using ffmpeg transcoding, you may want to adjust your audio bitrates. most people on these forums will use this for cameras. The default audio bitrate for opus, for example, is 128k (ffmpeg default for opus). That’s ridiculously high for such an application. May want to set your defaults depending on what you’re using. IF you’re transcoding that is…

ffmpeg:
  opus: "-c:a libopus -b:a 16K -vbr constrained"

^ for example

@CrashnBrn is problem same with go2rtc beta.4? I think you need to share your camera stream with me, so I can check it with debugger. You can do it using Ngrok tunnel as example.

@calisro How did you get a webrtc stream from go2rtc in ‘pipup’? Is there a “gui-less” URL somewhere available in go2rtc/ha?

I believe when this is officially released there will be a “create weblink” service which l will use again. Till then Im using the “webrtc” link in the go2rtc gui to send to pipup.

One thing I learned though… Sending audio to pipup stops what’s running on the android tv. I created a audioless filtered rtsp feed that I use to send there.

http(s)://ha.local:1984/webrtc.html?src=garage_noaudio

You can use go2rtc filter for that…

  garage_main:
    - rtsp://xxx:[email protected]:554/videoMain
  garage_noaudio: 
    - rtsp://127.0.0.1:8554/garage_main?video
2 Likes

Two questions:

  • when I use the RTSPtoWebRTC integration, it automatically creates the stream in go2rtc. However, the “name” of the stream is the URL or the rstp stream. Like “rtsp://user:[email protected]/axis-media/media.amp?videocodec=h264&streamprofile=HASS&camera=1” instead of the “friendly” name it has in home-assistant. Is it because of the “Axis” integration instead of the Generic camera? Is there a way to give the camera a friendly name in go2rtc?

  • I tried to remove the RTSPtoWebRTC integration, to avoid the automatic creation of streams in go2rtc. I added the camera’s manually in the go2rtc.yml (with a friendly name…) and the webrtc stream from the go2rtc GUI works as expected. But how can I now have this webrtc stream back in Home Assistant without RTSPtoWebRTC? I tried to create a generic camera using the go2rtc rtsp:// but that does not seam to use the latency free webrtc.

That is how I have mine setup. I don’t have the RTSPtoWebRTC integration installed at all. I use a iframe to access my cameras like this:

      camera_view: auto
      type: picture-glance
      title: null
      entities: '[]
      camera_image: camera.garage
      aspect_ratio: 432x324
      tap_action:
        action: fire-dom-event
        browser_mod:
          service: browser_mod.popup
          data:
            title: 'garage_main Live'
            size: wide
            content:
              type: iframe
              url: URLTOAPI/webrtc.html?src=garage_main
              aspect_ratio: 75%

I believe that in order to use the picture glance cards and such, you’d need to use an integration that incorporates the javascript code to do the webrtc.

If you want to use the glance card or other inbuilt HASS cards that do not understand webrtc, you need the integration. The iframes work really well for me and allow 2 of my cameras to do 2-way communication. Maybe when a webrtc specific card matures, i’ll switch back to it.

3 Likes