Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtsp from Camera-Hub-G2H not work #793

Closed
bebaton14 opened this issue Dec 2, 2023 · 11 comments
Closed

rtsp from Camera-Hub-G2H not work #793

bebaton14 opened this issue Dec 2, 2023 · 11 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@bebaton14
Copy link

bebaton14 commented Dec 2, 2023

Hi! Please help me.
rtsp from Camera-Hub-G2H not work.

streams:
  Camera-Hub-G2H-030D: 
  - homekit:https://192.168.0.28:45668?device_id=58:3D:62:DF:31:EC&device_public=&client_private=

Proxy HomeKit camera work perfect!

@AlexxIT AlexxIT added the question Further information is requested label Dec 7, 2023
@AlexxIT
Copy link
Owner

AlexxIT commented Dec 7, 2023

You have provided not enough information to diagnose the problem

@bebaton14
Copy link
Author

bebaton14 commented Dec 8, 2023

streams:
  Camera-Hub-G2H-030D: 
  - homekit:https://192.168.0.28:45668?device_id=58:3D:62:DF:31:EC&device_public=243c08789377eda10821424abb00b6164c8309654a9ad4a452045cbc056bf193&client_id=3145c257-da2b-2098-03d3-94eb9b721c06&client_private=625be436240b1aa4ff2608e8dedf6718765d587bd2c25d47d624b578d7c40e0d4fcd204e87e22e5f50ec8dcebe519d761ca1dcd683fec554494842f25e6d24d9
  - ffmpeg:aqara_g3#audio=aac#audio=opus
19:01:48.074 DBG [exec] run url="exec:ffmpeg -hide_banner -v error -re -i aqara_g3 -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -vn -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
[in#0 @ 0000028760ce5280] Error opening input: No such file or directory
Error opening input file aqara_g3.
Error opening input files: No such file or directory
19:02:01.704 DBG [exec] run url="exec:ffmpeg -hide_banner -v error -re -i aqara_g3 -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -vn -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
[in#0 @ 0000012afae7fa40] Error opening input: No such file or directory
Error opening input file aqara_g3.
Error opening input files: No such file or directory

@AlexxIT
Copy link
Owner

AlexxIT commented Dec 9, 2023

Your config wrong. You don't have aqara_g3 stream

@bebaton14
Copy link
Author

bebaton14 commented Dec 17, 2023

streams:
  Camera-Hub-G2H-030D: 
  - homekit:https://192.168.0.28:45668?device_id=58:3D:62:DF:31:EC&device_public=243c08789772eda10821424abb00b6164c8309654a9ad4a452045cbc056bf193&client_id=3145c257-da2b-2098-03d3-94eb9b721c06&client_private=625be436240b1aa4ff2604e9dedf6718765d587bd2c25d47d624b570d7c40e0d4fcd204e87e22e5f50ec8dcebe549d761ca1dcd683fec554494862f25e6d24d0
  - ffmpeg:Camera-Hub-G2H-030D#audio=aac#audio=opus
  

  

homekit:
  Camera-Hub-G2H-030D:                   # same stream ID from streams list
    pin: 12345678           # custom PIN, default: 19550224
    name: Camera-Hub-G2H-030D     # custom camera name, default: generated from stream ID
    device_id: Camera-Hub-G2H-030D1       # custom ID, default: generated from stream ID
    device_private: Camera-Hub-G2H-030D
    pairings:
      - client_id=523685AC-4DF8-46F9-A08E-7FDD6937739A&client_public=e4cdab259eae67e679962c4b4d7a5205254d32e31acbaec832b9ad820c79652f&permissions=1
      - client_id=5BA26AB6-D844-45AF-B907-2FA53D2E3646&client_public=84f7c9975d6da988f05c240ddc87a79539df18e4b9a20f8fb0d6f033317f786f&permissions=0

@bebaton14
Copy link
Author

Apple home work good. But rtsp not work. VLC not work by link: rtsp:https://localhost:8554/Camera-Hub-G2H-030D

@bebaton14
Copy link
Author

bebaton14 commented Dec 17, 2023

20:16:14.352 INF go2rtc version 1.8.4 linux/amd64
20:16:14.353 INF [rtsp] listen addr=:8554
20:16:14.353 INF [webrtc] listen addr=:8555
20:16:14.353 DBG [hass] can't import config: open .storage/core.config_entries: no such file or directory
20:16:14.353 INF [api] listen addr=:1984
20:16:20.886 DBG [rtsp] new consumer stream=Camera-Hub-G2H-030D
20:16:20.949 DBG [exec] run url="exec:ffmpeg -hide_banner -v error -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp:https://127.0.0.1:8554/Camera-Hub-G2H-030D?audio -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -vn -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
[rtsp @ 0x563651aa3c40] Unable to open RTSP for listening
rtsp:https://127.0.0.1:8554/Camera-Hub-G2H-030D?audio: Address already in use
20:16:21.035 DBG [streams] can't stop none producer
20:16:21.035 DBG [streams] start producer url=homekit:https://192.168.0.28:45668?device_id=58:3D:62:DF:31:EC&device_public=243c08789372eda10821424abb00b6164c8309654a9ad4a452045cbc056bf193&client_id=3145c257-da2b-2098-03d3-94eb9b721c06&client_private=626be436240b1aa4ff2604e8dedf6718765d587bd2c25d47d624b578d7c40e0d4fcd204e87e22e5f50ec8dcebe519d761ca1dcd683fec574494842f25e6d24d0
20:16:26.175 DBG [streams] retry=0 to url=homekit:https://192.168.0.28:45668?device_id=58:3D:62:DF:31:EC&device_public=243c08789372eda10821424abb00b6164c8309654a9ad4a452045cbc056bf193&client_id=3145c257-da2b-2098-03d3-94eb9b721c06&client_private=626be436240b1aa4ff2604e8dedf6718765d587bd2c25d47d624b578d7c40e0d4fcd204e87e22e5f50ec8dcebe519d761ca1dcd683fec574494842f25e6d24d0
20:16:31.423 DBG [streams] retry=0 to url=homekit:https://192.168.0.28:45668?device_id=58:3D:62:DF:31:EC&device_public=243c08789372eda10821424abb00b6164c8309654a9ad4a452045cbc056bf193&client_id=3145c257-da2b-2098-03d3-94eb9b721c06&client_private=626be436240b1aa4ff2604e8dedf6718765d587bd2c25d47d624b578d7c40e0d4fcd204e87e22e5f50ec8dcebe519d761ca1dcd683fec574494842f25e6d24d0
20:16:31.555 DBG [rtsp] handle=EOF
20:16:31.795 DBG [streams] stop producer url=homekit:https://192.168.0.28:45668?device_id=58:3D:62:DF:31:EC&device_public=243c08789372eda10821424abb00b6164c8309654a9ad4a452045cbc056bf193&client_id=3145c257-da2b-2098-03d3-94eb9b721c06&client_private=626be436240b1aa4ff2604e8dedf6718765d587bd2c25d47d624b578d7c40e0d4fcd204e87e22e5f50ec8dcebe519d761ca1dcd683fec574494842f25e6d24d0
20:16:31.795 DBG [streams] can't stop none producer
20:16:31.795 DBG [rtsp] disconnect stream=Camera-Hub-G2H-030D

@duncanleo
Copy link

Hi, I have the same camera and I'm facing this issue as well, but I've somewhat narrowed down the cause after some debugging.

In the videoToMedia() helper function, two CodecParams are reported for this camera, which are equivalent to H.264 Main Profile Level 3.1 and H.264 Main Profile Level 4.0 respectively (see print below).

core.Codec{Name:"H264", ClockRate:0x15f90, Channels:0x0, FmtpLine:"profile-level-id=4D001F", PayloadType:0x0}
core.Codec{Name:"H264", ClockRate:0x15f90, Channels:0x0, FmtpLine:"profile-level-id=4D0028", PayloadType:0x0}

The trackToVideo() helper subsequently uses the first available level, which is Level 3.1. However, that doesn't actually appear to work, and instead it is Level 4.0 that results in a successful stream.

One way to test this with the hardware is to temporarily change this line to hardcode camera.VideoCodecLevel40 instead:

Level: []byte{level},

Let me know if more details are required - at this point I'm not sure if the camera is wrongly reporting its support for Level 3.1.

@AlexxIT AlexxIT added bug Something isn't working and removed question Further information is requested labels Dec 20, 2023
@AlexxIT AlexxIT self-assigned this Dec 20, 2023
@AlexxIT
Copy link
Owner

AlexxIT commented Dec 30, 2023

@bebaton14 you have VERY old FFmpeg

@AlexxIT
Copy link
Owner

AlexxIT commented Dec 30, 2023

@duncanleo I have tested G2H Pro. And haven't problem with default go2rtc behaviour. All works fine.
Model CH-C01, firmware 4.0.7_0006.

AlexxIT added a commit that referenced this issue Jan 1, 2024
@AlexxIT AlexxIT added this to the v1.8.5 milestone Jan 1, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Jan 1, 2024

Thanks @duncanleo. You was right. Some bug in G2H firmware. Can't play stream with low level.

https://github.com/AlexxIT/go2rtc/releases/tag/v1.8.5

PS. No problem with G2H Pro

@AlexxIT AlexxIT closed this as completed Jan 1, 2024
@duncanleo
Copy link

@AlexxIT thank you for fixing the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants