Go2rtc project - help thread

Thank you Conor, Rob, and nprez83! The iframe card is working excellently at the moment!

1 Like

good afternoon, I managed to install add-on, when I go to the web from the sidebar, I get 502: Bad Gateway, in yaml I replaced the local host with the server address. but it didn’t help,

tell me is this the correct yaml or did I write it wrong?
api:
listen: “192.168.0.108:1984”

rtsp:
listen: “192.168.0.108:8554”

webrtc:
listen: “:8555” # external TCP port - forward this in your router
candidates:

  • stun:8555 # if you have dynamic public IP-address

streams:
1_camera: rtsp://admin:pass@[email protected]/Streaming/Channels/102/

where 192.168.0.108 is the server address with HA
where 192.168.0.8 is the registrar’s address

UPD:
with this configuration , I got go2rtc running .
log file:
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
08:07:25.097 INF [api] listen addr=192.168.0.108:1984
08:07:25.099 INF [rtsp] listen addr=192.168.0.108:8554
08:07:25.101 INF [hass] load stream url=“hass:Участок 10”
08:07:25.101 INF [hass] load stream url=“hass:Камера тыл”
08:07:25.102 INF [hass] load stream url=“hass:Беседка”
08:07:25.102 INF [hass] load stream url=“hass:Участок 7”
08:07:25.103 INF [hass] load stream url=“hass:Калитка”
08:07:25.103 INF [hass] load stream url=“hass:Парковка”
08:07:25.104 INF [hass] load stream url=“hass:Вызывная панель”
08:07:25.104 INF [hass] load stream url=“hass:Камера сауна”
08:07:25.105 INF [webrtc] listen addr=:8555
08:07:25.109 INF [srtp] listen addr=:8443
however, according to the manual, it does not work to add integration Integration > Generic Camera > rtsp://192.168.0.108:8554/camera1
, writes that the waiting period expires

I guess that maybe when adding to generic camera, the problem is in the camera name “camera1”, if I have go2rtc identified them with Russian names

There is no camera1 in your config. Only 1_camera

I’m sorry that I ask a lot of questions, I’m just not a programmer, I study myself as best I can.
In general, how I set it up:
I registered the cameras in the hass configuration, cameras are registered in generic camera, installed add-on go2rtc, the cameras were loaded into go2rtc from hass.
Снимок5
установил RTSPtoWebRTC прописал сервер http://192.168.0.108:1984 / и сервер адрес сервера оглушения 192.168.0.108
Снимок7
in yaml, go2rtc prescribed camera streams from hass
Снимок6
put the cameras on the map
Снимок8
now my cameras only show a static picture both on the map and when switching to the camera
go2rtc apparently does not work as there is no download
Снимок9
I tried to add a camera to generic camera now from go2rtc with the address rtsp://192y168y0y108:8554/camera1
It was added, but the picture is still static, even if you switch to a new entity that appeared in the integration
When working, I get data acquisition errors
Снимок11
Снимок10
and still no access to the web API menu ON, 502: Bad Gateway
and yes, I have forwarded port 8555 on the router to the server (192.168.0.108)

UPD:
Ugh, I set up a level 3 domain on the server’s port 1984 and got into the API admin panel, there are dual cameras from both HSS and streams. Deleted in yaml streams, the cameras disappeared from the web all at once. Restored the repeated 2 times appeared again


Now it’s clear why it doesn’t work, the cameras don’t show either webrtc or rtsp in the web api. So the root of the problem should be found here.

This should probably be http://127.0.0.1:1984/

You do not need to list all those cameras. They are automatically converted with that plugin to webrtc. You can add them there but really there is no reason to since you’re not transcoding at all. So remove them, Also your ‘listen’ should really just be “:PORT”. That way it should listen on all IPs.

After you restart go2rtc after making those changes, you should literally be able to add your existing cameras in hass like normal to a live picture-glance card.

I removed the extra links
rtsp just listening to the port
Снимок13
cameras pulled up in add-on
Снимок14
but my streams are still stationary
by changing the address to a local one, I lost the ability to access the web:1984

go2rtc logs?

Then it if you need that, you should use “:1984” instead.

This should be http://127.0.0.1:1984/

Снимок16
now the web opens, but it is empty, although the go2rtc log shows that links to cameras from hass have been loaded.
Снимок18

Снимок17

for information, I tried to set up the transmission on the camera and with h265 and H264 the reaction is the same. The camera still has the possibility of h265+ and H264+, as well as MJPEG, but I’m not trying it. since the first two there is no guarantee that they will work, and the last one is that most likely 8 cameras can put the network up to RP4.
and also for information, we wrote earlier in the topic that in HA cameras should be specified in the properties frontend_stream_type: web_rtc

UPD: in the meantime, I have disabled go2rtc and deactivated RTSPtoWebRTC, my cameras are showing, but as before they have buffering and a delay of one minute
If there are any more suggestions on settings, I am always ready to experiment

Well. I figured it out. It helps when you don’t expose your google nest max through home assistant to google as the same device name as what google knows your nest max as. :sweat_smile: :crazy_face:

I was looking for how to implement a video stream via popup and for myself I found this option pipup + motion eye. I implemented the stream through the motion eye addon, the same webrtc and no headache. C go2rtc is sad for me. For example, after creating a go2rtc.yaml file, I get this error “Package go2rtc setup failed. Component streams Integration ‘stream’ not found”, and if I upload this file to the /config folder, nothing happens and entities do not appear. I still didn’t understand where the file should be located. Installed the go2rtc addon, installed the RTSPtoWebRTC integration, opened the go2rtc web interface at http://192.168.1.86:1984 and copied the links

http://192.168.1.86:1984/webrtc.html?src=rtsp… - does not open in pipup
http://192.168.1.86:1984/api/frame.mp4?src=rtsp… - opens in pipup, but the picture does not change

In the go2rtc.yaml file itself, I entered it and threw it into packages. See the screenshots below

streams:
  camera1: rtsp://user:[email protected]/live0
I place the go2rtc.yaml file in these folders and it does not work

image
image

This is what it looks like when I open links via go2rtc

This is what it looks like when I open links via motion eye. The video stream is fast, with minimal delays of 1-2 seconds


Settings in the motion eye addon


Automation that launches Popup and broadcasts a video stream with motion eye
alias: PipUP
description: ""
trigger:
  - platform: state
    entity_id:
      - input_button.pipup
condition: []
action:
  - service: androidtv.adb_command
    data:
      command: >-
        ps -ef | grep -v grep | grep pipup || am start
        nl.rogro82.pipup/.MainActivity
    target:
      entity_id: media_player.android_tv_192_168_1_129
  - service: androidtv.adb_command
    data:
      command: input keyevent KEYCODE_WAKEUP
    target:
      entity_id: media_player.android_tv_192_168_1_129
  - service: rest_command.pipup
    data:
      title: Front Door
      message: Live Stream of Doorbell
      width: 480
      height: 340
      url: http://192.168.1.86:8081
mode: single


Текст на русском (Text in Russian)

Я был в поисках как реализовать видеострим через pipup и для себя нашел вот такой вариант pipup + motion eye. Я реализовал стрим через аддон motion eye, тот же webrtc и никакой головной боли. C go2rtc у меня печально. К примеру создав файлик go2rtc.yaml, то получаю вот такую ошибку “Package go2rtc setup failed. Component streams Integration ‘streams’ not found”, а если я закину этот файлик в папку /config, то ничего не происходит и сущности не появляются. Я так и не понял где должен находиться файлик. Установил аддон go2rtc, установил интеграцию RTSPtoWebRTC, открыл веб-интерфейс go2rtc по адресу http://192.168.1.86:1984 и скопировал ссылки
http://192.168.1.86:1984/webrtc.html?src=rtsp… - не открывается в pipup
http://192.168.1.86:1984/api/frame.mp4?src=rtsp… - открывается в pipup, но картинка не меняется

в самом файлике go2rtc.yaml вписал и закинул в packages. Смотрите ниже скриншоты

streams:
  camera1: rtsp://user:[email protected]/live0
Размещаю файлик go2rtc.yaml в этих папках и не работает

image
image

Вот так выглядит, когда я открываю ссылки через go2rtc

Вот так выглядит, когда я открываю ссылки через motion eye. Видеопоток шустрый, с минимальными задержками в 1-2 сек


Настройки в аддоне motion eye


Автоматизация которая запускает PiPup и транслирует видеопоток с motion eye
alias: PipUP
description: ""
trigger:
  - platform: state
    entity_id:
      - input_button.pipup
condition: []
action:
  - service: androidtv.adb_command
    data:
      command: >-
        ps -ef | grep -v grep | grep pipup || am start
        nl.rogro82.pipup/.MainActivity
    target:
      entity_id: media_player.android_tv_192_168_1_129
  - service: androidtv.adb_command
    data:
      command: input keyevent KEYCODE_WAKEUP
    target:
      entity_id: media_player.android_tv_192_168_1_129
  - service: rest_command.pipup
    data:
      title: Front Door
      message: Live Stream of Doorbell
      width: 480
      height: 340
      url: http://192.168.1.86:8081
mode: single

1 Like

Do you have default_config: in your home assistant configuration.yaml file? If not, then you’ll need to add the ‘stream:’ component to the configuration.yaml.

Also, I think pipup needs a https address. Unless you use a version (There supposedly is one that was modified) that has that https requirement disabled. This may be your problem.

Modified one but I have NOT tested this…

1 Like

I found the reason why go2rtc didn’t work for me. It turns out that it was only necessary to specify port 8555 in the integration settings of RTSPtoWebRTC, and then throw the go2rtc.yaml file itself into the /config folder


image
image

But its supposed to be the api port. Not 8555 at all. I believe you’re effectively disabling RTSPtoWebrtc as it can’t connect to anything.

You don’t really need that integration unless you plan on viewing steams in homeassistant lovelace cards. You seem to just be sending go2rtc directly to pipup which doesn’t require RTSPtoWebrtc at all. :slight_smile:

Guess I will also throw my troubleshooting issues into this thread. I also cannot get go2rtc to work.

It looks like the webrtc stream simply does not load but the rtsp stream behind it is working just fine

My Configuration is as follows:

  1. go2rtc.yaml
log:
  level: info  # default level
  api: debug
  rtsp: debug
  streams: debug
  webrtc: debug
  1. go2rtc running as docker using a docker network, not host mode
  go2rtc:
    container_name: go2rtc
    image: alexxit/go2rtc
    restart: unless-stopped
    networks:
      - nextcloud_network
    ports:
      - 1984:1984 # API
      - 8443:8443 # srtp
      - 8555:8554 # rtsp
    volumes:
      - "/opt/go2rtc/go2rtc.yaml:/config/go2rtc.yaml"

I also had to make the rtsp host port something other than 8554 but that doesnt matter since I configure home assistant with the docker hostname and not IP

  1. Installed RTPStoWebRTC and pointed at go2rtc container
    chrome_vfPpTsCLZ5

  2. Used generic camera for a single camera stream

  3. go2rtc portal shows the camera loaded
    chrome_iVAtxe64Hh

  4. No useful logs reported

02:14:47.405 INF [api] listen addr=:1984
02:14:47.406 INF [srtp] listen addr=:8443
02:14:47.406 INF [rtsp] listen addr=:8554
02:15:04.878 DBG [streams] probe producer url=rtsp://user:[email protected]:554/cam/realmonitor?channel=1&subtype=0&authbasic=64
02:15:04.998 DBG [streams] start producer url=rtsp://user:[email protected]:554/cam/realmonitor?channel=1&subtype=0&authbasic=64
02:15:26.535 DBG [webrtc] new consumer url=camera.192_168_1_58
02:15:56.651 DBG [streams] stop producer url=rtsp://user:[email protected]:554/cam/realmonitor?channel=1&subtype=0&authbasic=64

And of course the problem is webrtc link in both the go2rtc portal and in a picture glance card do not load. MSE seems to work however, but I dont know how to get thet into Home Assistant and I’d rather have webrtc anyways
chrome_gmvHCYb7hb

- type: picture-glance
          title: Doorbell Cam Glance
          camera_view: live
          entities: []
          camera_image: camera.192_168_1_58

EDIT: adding the camera streams to the config and then making a Generic Camera out of it works fine but its an hls stream which is sad

A quick note on how I configured Go2RTC and RTSPtoWebRTC together to have WebRTC.

  1. Add your streams to go2rtc config.
  2. Add the go2rtc streams to HA. HA > Settings > Integrations > Add Integration > Generic Camera > rtsp://<<go2rtc_IP>>:8554/camera_name. Repeat for all your streams defined in go2rtc config.
  3. Install the RTSPtoWebRTC add-on. HA > Settings > Integrations > Add Integration > RTSPtoWebRTC > http://<<go2rtc_IP>>:1984/

With that, the go2rtc generic cameras from HA will be then automatically added back to go2RTC: you should see it on the web ui of go2rtc.

On HA dashboard, use Frigate or WebRTC card.

Don’t forget to config everything for external access as well to benefit from WebRTC outside your LAN.

1 Like

Has anyone got Go2RTC working with the google stun server as to avoid opening ports when viewing cameras externally from my home network?

My issue was the fact that network_mode: host is mandatory. I believe this is because of the two random UDP ports that are opened. I am requesting a feature to set those udp ports, but my hunch is there might be more that the container is relying on from this mode than just udp ports

Don’t forget to config everything for external access as well to benefit from WebRTC outside your LAN.

Don’t quite agree with this. My Home Assistant is externally accessible so my camera feeds can stay behind HA without worry some unknown service/intruder can see the cameras

Ha is not a proxy but more a presentation layer. So for remote access to work, one would need to set up the remote access settings.

Then you won’t get remote webrtc. That’s pretty much the point of this thread. haha. I’d suggest though that you look into how webrtc works. Its not insecure. Just don’t expose the api and let that remain behind HA.