WebRTC icon indicating copy to clipboard operation
WebRTC copied to clipboard

Black screen - no other logs

Open stepir opened this issue 1 year ago • 10 comments

Hello!

I'm running HA Supervisor 2023.03.2 Frontend 20230309.1 - latest and WebRTC Camera add-on v3.1.0

with the following card:

type: custom:webrtc-camera
url: rtsp://192.168.1.169:554/live

but it will only display a black image image

either in MSE or WEBRTC

type: custom:webrtc-camera
url: rtsp://192.168.1.169:554/live
mode: webrtc

image

I have error log level set to

logger:
  default: warning
  logs:
    custom_components.webrtc: debug

But logs only show this:

2023-03-25 12:17:14.822 DEBUG (webrtc) [custom_components.webrtc.utils] [90m12:17:14.821[0m [32mINF[0m go2rtc version 1.2.0 linux/arm
2023-03-25 12:17:14.827 DEBUG (webrtc) [custom_components.webrtc.utils] [90m12:17:14.823[0m [32mINF[0m [api] listen [36maddr=[0m:1984
2023-03-25 12:17:14.830 DEBUG (webrtc) [custom_components.webrtc.utils] [90m12:17:14.824[0m [32mINF[0m [rtsp] listen [36maddr=[0m:8554
2023-03-25 12:17:14.832 DEBUG (webrtc) [custom_components.webrtc.utils] [90m12:17:14.829[0m [32mINF[0m [hass] load stream [36murl=[0mhass:192_168_1_169
2023-03-25 12:17:14.836 DEBUG (webrtc) [custom_components.webrtc.utils] [90m12:17:14.831[0m [32mINF[0m [srtp] listen [36maddr=[0m:8443
2023-03-25 12:17:14.837 DEBUG (webrtc) [custom_components.webrtc.utils] [90m12:17:14.834[0m [32mINF[0m [webrtc] listen [36maddr=[0m:8555
....
2023-03-25 12:30:51.461 DEBUG (MainThread) [custom_components.webrtc] New client: {'authSig': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIzMDBiODMzZjk5NjI0MTBkOTUyMmM2MDA3NjdiMTUwZCIsInBhdGgiOiIvYXBpL3dlYnJ0Yy93cyIsInBhcmFtcyI6W10sImlhdCI6MTY3OTc0Mzg1MSwiZXhwIjoxNjc5NzQzODgxfQ.XSSR_9B11YJVO5tMGt5aDZBwakNPf40BOZPGAow9nhE', 'url': 'rtsp://192.168.1.169:554/live'}
2023-03-25 12:30:51.578 DEBUG (webrtc) [custom_components.webrtc.utils] [90m12:30:51.578[0m [32mINF[0m [streams] create new stream [36murl=[0mrtsp://192.168.1.169:554/live
2023-03-25 12:32:42.060 DEBUG (MainThread) [custom_components.webrtc] New client: {'authSig': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIzMDBiODMzZjk5NjI0MTBkOTUyMmM2MDA3NjdiMTUwZCIsInBhdGgiOiIvYXBpL3dlYnJ0Yy93cyIsInBhcmFtcyI6W10sImlhdCI6MTY3OTc0Mzk2MSwiZXhwIjoxNjc5NzQzOTkxfQ.6SUT1qSrrI6l8VxvgdIFkCVuchj-SFmAfpaNUpWRmPY', 'url': 'rtsp://192.168.1.169:554/live'}
2023-03-25 12:33:05.384 DEBUG (MainThread) [custom_components.webrtc] New client: {'authSig': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIzMDBiODMzZjk5NjI0MTBkOTUyMmM2MDA3NjdiMTUwZCIsInBhdGgiOiIvYXBpL3dlYnJ0Yy93cyIsInBhcmFtcyI6W10sImlhdCI6MTY3OTc0Mzk4NSwiZXhwIjoxNjc5NzQ0MDE1fQ.0Jgve-VZGnvNxHvGZ9MvT1neI2wtrQukSqGa5nleeUo', 'url': 'rtsp://192.168.1.169:554/live'}

info on the webui would show:

{
  "producers": [
    {
      "type": "RTSP source",
      "url": "rtsp://192.168.1.169:554/live",
      "remote_addr": "192.168.1.169:554",
      "user_agent": "go2rtc/1.2.0",
      "medias": [
        "video, sendonly, 96 H264/90000"
      ],
      "tracks": [
        "96 H264/90000, sinks=3"
      ],
      "recv": 4434439
    }
  ],
  "consumers": [
    {
      "type": "WebRTC client",
      "remote_addr": "udp4 prflx 192.168.2.172:54457 related :0",
      "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15",
      "send": 4439517
    },
    {
      "type": "WebRTC client",
      "remote_addr": "udp4 prflx 192.168.2.172:54879 related :0",
      "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15",
      "send": 2030928
    },
    {
      "type": "MP4 client",
      "remote_addr": "[::1]:52336",
      "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15"
    }
  ]
}

I'm a bit lost... what I could look at to understand what's happening?

Thanks

PS:

the above is the one configured just using a picture entity card:

show_state: false
show_name: false
camera_view: live
type: picture-entity
camera_image: camera.192_168_1_169
entity: camera.192_168_1_169

image

stepir avatar Mar 25 '23 11:03 stepir

nothing I'm clueless, I've tried installing just go2rtc on my Mac and increase log level to debug but there is nothing justifying the black streak...

stepir@stepir-mini-M1 1 % ./go2rtc
20:04:21.098 INF go2rtc version 1.3.0 darwin/arm64
20:04:21.098 INF [api] listen addr=:1984
20:04:21.098 INF [rtsp] listen addr=:8554
20:04:21.099 INF [srtp] listen addr=:8443
20:04:21.099 INF [webrtc] listen addr=:8555/tcp
20:04:24.606 DBG [webrtc] new consumer src=camera1
20:04:24.726 DBG [streams] start producer url=rtsp://192.168.1.169/live

stepir avatar Mar 26 '23 18:03 stepir

I have a similar issue - the stream will work for approx an hour then stop with the blackscreen. If I open the configuration page for the go2rtc add-in and press save/restart the streams start again for another hour

vk2him avatar Mar 26 '23 21:03 vk2him

My browsers (Chrome and Edge) shows "loading2" in RTC mode. However, I'm able to see my cameras on my iPhone in RTC mode. I'm wondering if it has some issue with webrtc for browsers?

dbaron92 avatar Mar 27 '23 17:03 dbaron92

in my case it won't work either in browser or HA app for iOS and android - it would only work if I access the rtsp stream of webrtc of the same camera...

stepir avatar Mar 27 '23 17:03 stepir

had a doubt this could be related to the fact my viewer was behind a vpn. Not the case as the issue is still present even when all the actors are local (tsp camera, ha+webrtc+viewer)

{
  "producers": [
    {
      "type": "RTSP source",
      "url": "rtsp://192.168.1.169:554/live",
      "remote_addr": "192.168.1.169:554",
      "user_agent": "go2rtc/1.2.0",
      "medias": [
        "video, sendonly, 96 H264/90000"
      ],
      "tracks": [
        "96 H264/90000, sinks=1"
      ],
      "recv": 27461833
    }
  ],
  "consumers": [
    {
      "type": "WebRTC client",
      "remote_addr": "udp4 prflx 192.168.1.7:59684 related :0",
      "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15",
      "send": 13005480
    }
  ]
}

stepir avatar Mar 31 '23 09:03 stepir

so I discovered that if I looks for available links and use this:

http://192.168.1.241:1984/api/stream.m3u8?src=rtsp://192.168.1.169:554/live

It actually work and latency is at least half of a generic camera pointing to my rtsp stream...

The problem is that if a create a generic camera pointing to that http address it will only work for few seconds, then black screen again.

stepir avatar Mar 31 '23 13:03 stepir

and

type: custom:webrtc-camera
url: 'http://192.168.1.241:1984/api/stream.m3u8?src=rtsp://192.168.1.169:554/live'

produce:

image

stepir avatar Mar 31 '23 17:03 stepir

I have a similar issue

Roei639 avatar Jun 16 '23 09:06 Roei639

@stepir well. You using iPhone that doesn't support MSE technology. And you can't use WebRTC technology because VPN. m3u8 works for you because it made by Apple (HLS technology). But WebRTC card doesn't support this format.

AlexxIT avatar Jun 16 '23 14:06 AlexxIT

Thanks for clarifying

stepir avatar Jun 16 '23 15:06 stepir