go2rtc icon indicating copy to clipboard operation
go2rtc copied to clipboard

Homekit camera in HA with error="hap: no free streams" url=hass

Open aureli169 opened this issue 2 years ago • 12 comments

I have the error : "WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="hap: no free streams" url=hass:CameraNameInGo2rtc" It's a homekit camera in home assistant The strange thing is that I had two identical cameras that worked very well with my current configuration. One of them broke down, so I replaced it with an identical model that has this error now.

Home assistant is the only device accessing this camera via homekit (go2rtc has its configuration file in the HA configuration folder to use HA's homekit link)

I've tried several factory resets and re-pairings with HA and each time I end up with the same problem. Some camera features (light) require the use of HA rather than pairing the camera directly to go2rtc... :(

aureli169 avatar Nov 26 '23 14:11 aureli169

Have you read? #677 And you sure that no other devices requested stream from your camera?

AlexxIT avatar Nov 26 '23 15:11 AlexxIT

I've read it. My message was originally posted as a reply in topic #677 . In the absence of a reply, and thinking that my problem was different, I then deleted my message and opened my own issue.

And you sure that no other devices requested stream from your camera?

It's a new camera that I've only linked to Home Assistant via homekit. In home assistant, I also have access to the video. But I get the error message in go2rtc (after several attempts, I was able to get the video in go2rtc for a while before getting the error in a loop again)

At the same time, I have an older camera of identical model (Outdoor Netatmo camera) which is linked to Home assistant via homekit, and which is accessible in Go2rtc (I put the go2rtc config file in the same HA config folder).

aureli169 avatar Nov 26 '23 16:11 aureli169

When I open HA with the preview of the 2 cameras ( - type: custom:webrtc-camera url: rtsp://ha:8554/Cam_110 ....)

Working camera info in go2rtc :

{
  "producers": [
    {
      "type": "HomeKit active producer",
      "url": "homekit://10.1.0.110:5001?device_id=__________\u0026device_public=__________\u0026client_id=__________\u0026client_private=__________",
      "sdp": "{Codecs:[{CodecType:0 CodecParams:[{ProfileID:[1] Level:[0 2] PacketizationMode:0 CVOEnabled:[0] CVOID:[]}] VideoAttrs:[{Width:1920 Height:1080 Framerate:24} {Width:1280 Height:720 Framerate:24} {Width:640 Height:360 Framerate:24} {Width:320 Height:240 Framerate:24}] RTPParams:[]}]}\n{Codecs:[{CodecType:3 CodecParams:[{Channels:1 Bitrate:0 SampleRate:[1] RTPTime:[]}] RTPParams:[] ComfortNoise:[]}] ComfortNoise:0}",
      "medias": [
        "video, recvonly, H264",
        "audio, recvonly, OPUS/16000/1",
        "video, recvonly, JPEG"
      ],
      "receivers": [
        "0 H264, bytes=31423407, senders=1",
        "0 OPUS/16000/1, bytes=545267, senders=0"
      ],
      "recv": 31968674
    }
  ],
  "consumers": [
    {
      "type": "WebRTC/WebSocket async passive consumer",
      "remote_addr": "udp4 prflx 10.1.0.50:59422 related :0",
      "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0",
      "medias": [
        "video, sendonly, VP8, RTX, VP9, H264, AV1, RED, ULPFEC, FLEXFEC-03",
        "audio, sendonly, OPUS/48000/2, RED/48000/2, G722/8000, PCMU/8000, PCMA/8000, CN/8000, TELEPHONE-EVENT/48000, TELEPHONE-EVENT/8000, L16, PCML"
      ],
      "senders": [
        "102 H264, bytes=30473306, receivers=1"
      ],
      "send": 30798438
    }
  ]
}

Not working camera info in go2rtc :

{
  "producers": [
    {
      "type": "HomeKit active producer",
      "url": "homekit://10.1.0.111:5001?device_id=__________\u0026device_public=__________\u0026client_id=__________\u0026client_private=__________",
      "sdp": "{Codecs:[{CodecType:0 CodecParams:[{ProfileID:[1] Level:[0 2] PacketizationMode:0 CVOEnabled:[0] CVOID:[]}] VideoAttrs:[{Width:1920 Height:1080 Framerate:24} {Width:1280 Height:720 Framerate:24} {Width:640 Height:360 Framerate:24} {Width:320 Height:240 Framerate:24}] RTPParams:[]}]}\n{Codecs:[{CodecType:3 CodecParams:[{Channels:1 Bitrate:0 SampleRate:[1] RTPTime:[]}] RTPParams:[] ComfortNoise:[]}] ComfortNoise:0}",
      "medias": [
        "video, recvonly, H264",
        "audio, recvonly, OPUS/16000/1",
        "video, recvonly, JPEG"
      ],
      "receivers": [
        "0 H264, bytes=0, senders=2",
        "0 OPUS/16000/1, bytes=0, senders=1"
      ]
    }
  ],
  "consumers": [
    {
      "type": "MSE/WebSocket active consumer",
      "remote_addr": "10.1.0.50, 10.1.0.1:51786",
      "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0",
      "medias": [
        "video, sendonly, H264",
        "audio, sendonly, MPEG4-GENERIC, PCMA, PCMU, L16, PCML, OPUS"
      ],
      "senders": [
        "0 H264, bytes=0, receivers=1",
        "0 OPUS/16000/1, bytes=0, receivers=1"
      ]
    },
    {
      "type": "WebRTC/WebSocket async passive consumer",
      "remote_addr": "udp4 prflx 10.1.0.50:63285 related :0",
      "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0",
      "medias": [
        "video, sendonly, VP8, RTX, VP9, H264, AV1, RED, ULPFEC, FLEXFEC-03",
        "audio, sendonly, OPUS/48000/2, RED/48000/2, G722/8000, PCMU/8000, PCMA/8000, CN/8000, TELEPHONE-EVENT/48000, TELEPHONE-EVENT/8000, L16, PCML"
      ],
      "senders": [
        "102 H264, bytes=0, receivers=1"
      ]
    }
  ]
}

aureli169 avatar Nov 26 '23 17:11 aureli169

@aureli169 aqara g3 camera has firmware 4.0.7_0006.0008 ?

I receive the same messages. I connected the camera to aqua home (android) and home assistant (apple homekit integration). I tried to remove the camera from aqara home, but it did not solve the problem.

WeslyG avatar Dec 20 '23 14:12 WeslyG

@WeslyG on my side it's not an aqara camera. Out of the box, I've only connected it to Home Assistant via homekit, so I don't understand how it could be connected to another homekit system...

aureli169 avatar Dec 26 '23 09:12 aureli169

I'm afraid I see this also with a Starling Hub which streaming 1 Nest camera to Go2RTC. @AlexxIT would it be possible for us to request you investigate and if so are there any particular logs we can provide to assist?

Thank you so much.

andyscaife avatar Dec 30 '23 00:12 andyscaife

Of course you can provide some logs. Because I haven't seen nothing useful yet for detecting the problem.

AlexxIT avatar Dec 30 '23 04:12 AlexxIT

Hi the same problem, but I have an Aqara FP2 via Homekit:

2024-05-06 09:57:34.245061654 [INFO] Starting go2rtc... 2024-05-06 09:57:34.458458992 12:57:34.458 INF go2rtc version 1.8.4 linux/arm64 2024-05-06 09:57:34.460514467 12:57:34.460 INF [api] listen addr=:1984 2024-05-06 09:57:34.461278662 12:57:34.460 INF [rtsp] listen addr=:8554 2024-05-06 09:57:34.462726552 12:57:34.462 INF [webrtc] listen addr=:8555 2024-05-06 09:57:34.467099333 12:57:34.466 DBG [hass] load config url=hass:Presence-Sensor-FP2-1462 2024-05-06 09:57:38.686086073 [2024-05-06 12:57:38] frigate.app INFO : Starting Frigate (0.13.2-6476f8a) 2024-05-06 09:57:38.688216510 [2024-05-06 12:57:38] frigate.app INFO : Creating directory: /tmp/cache

LsdGit avatar May 06 '24 10:05 LsdGit

are there any updates on this problem? i have the same

Dreamoffice avatar May 06 '24 15:05 Dreamoffice

There can be no solution. HomeKit cameras only support 2 streams at a time. It's a stupid limitation by Apple engineers.

AlexxIT avatar May 13 '24 04:05 AlexxIT

Hi, I have a Netatmo Presence which is connected via Homekit to my HomeAssistant. I've noticed that when I reached 2 streams then I start having this error message two. But even when I restart everything and there is 0 stream active, I keep having this error, it's like connection doesn't really close on camera side. Is there any tip to avoid factory reset the camera ? Would it be possible to "force" close other streams to not reach the limit ? Also using home assistant config vs manually declare the config, what are the differences ? It is still using another "session" on the device itself right ?

answer35 avatar Aug 28 '24 12:08 answer35

I think camera should auto close unused connections after some time.

AlexxIT avatar Aug 28 '24 13:08 AlexxIT