AlexxIT / go2rtc

Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
https://github.com/AlexxIT/Blog
MIT License
4.21k stars 344 forks source link

Error opening stream (INVALIDDATA) from HomeKit source (Aqara G2H) #1079

Open x-iLex-x opened 4 months ago

x-iLex-x commented 4 months ago

I have an Aqara G2H camera added to my HA via HomeKit Controller. When I try to receive rtsp stream from go2rtc, I add "?video&audio=aac" to rtsp link and get an error, stream goes to be in “unavailable” state. Without adding this to link I can get stream, but, as expected, it doesn’t run how it should.

Same time I have an Aqara G3 cam, running on another server. The same rtsp link format with same go2rtc config works fine with it.

I see that “stream” integration causes an error, but can’t guess the reason. Am I doing smth wrong? How do I get working rtsp stream for G2H cam?

Регистратор: homeassistant.components.stream.stream.camera.camera
Источник: components/stream/__init__.py:448
интеграция: Stream ([документация](https://www.home-assistant.io/integrations/stream), [проблемы](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+stream%22))
Первое сообщение: 18:36:53 (1 сообщений)
Последнее сообщение: 18:36:53

Error from stream worker: Error opening stream (INVALIDDATA, Invalid data found when processing input) rtsp://****:****@192.168.0.116:8554/camera.aqara?video=&audio=aac
AlexxIT commented 4 months ago

All communication should be in English in this repo

x-iLex-x commented 4 months ago

All communication should be in English in this repo

My bad, updated in English.

AlexxIT commented 4 months ago

Show your go2rtc config

x-iLex-x commented 4 months ago

Show your go2rtc config

IMG_9309

AlexxIT commented 4 months ago

Are you sure this stream works fine inside go2rtc WebUI? Can you hear audio?

x-iLex-x commented 4 months ago

Are you sure this stream works fine inside go2rtc WebUI? Can you hear audio?

Yes, video and audio works without any issues inside go2rtc WebUI.

x-iLex-x commented 4 months ago

Are you sure this stream works fine inside go2rtc WebUI? Can you hear audio?

Sometimes I can add rtsp stream into HA an it stays in idle state, like it’s normal, before first opening. When I try to open and watch stream - it goes to “unavailable” and starts changing its state between unavailable and idle every several minutes, causing errors on log.

AlexxIT commented 4 months ago

Why you want this camera as entity? You don't needs it for watching stream.

x-iLex-x commented 4 months ago

Why you want this camera as entity? You don't needs it for watching stream.

First case is to transfer camera entity to yandex smart home. Second case is to use camera.record and camera.snapshot services for telegram notifications.

AlexxIT commented 4 months ago

Ok. This make sense. I needs to test this case myself.

x-iLex-x commented 4 months ago

Ok. This make sense. I needs to test this case myself.

Waiting for news, thx. I’ll try to test on my another server.

AlexxIT commented 4 months ago

Well. I have same issue on my Raspberry 3. And don't have issue on Intel Nuc. I think this is related to ffmpeg arm library. What you using as a server?

x-iLex-x commented 4 months ago

Well. I have same issue on my Raspberry 3. And don't have issue on Intel Nuc. I think this is related to ffmpeg arm library. What you using as a server?

Thanks for news. I’m using JetHub H1 (based on amlogic) as server with Aqara G2H cam. As you did, I’ve done tests and had no issues on my another servers based on intel.

So, is there any way or chance to get it working on my JetHub?

AlexxIT commented 4 months ago

JetHub also ARM based. You can try to use ffmpeg camera instead of generic. But important to select copy codec to avoid transcoding.

x-iLex-x commented 4 months ago

JetHub also ARM based. You can try to use ffmpeg camera instead of generic. But important to select copy codec to avoid transcoding.

Could you pls show how do link for ffmpeg should looks like? 🙏🏼 I’m stuck with “copy codec” 😅

AlexxIT commented 4 months ago

Don't know. Never used ffmpeg camera

x-iLex-x commented 4 months ago

Don't know. Never used ffmpeg camera

Seems like I've guessed how to, but, unfortunately I have same error as mentioned in issue.

AlexxIT commented 4 months ago

It's hard for me to fix the bug because I have to reproduce the arm dev environment