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

Support SRTP for UniFi RTSPS cameras #81

Open
saxopwn opened this issue Oct 19, 2022 · 12 comments
Open

Support SRTP for UniFi RTSPS cameras #81

saxopwn opened this issue Oct 19, 2022 · 12 comments
Labels
enhancement New feature or request

Comments

@saxopwn
Copy link

saxopwn commented Oct 19, 2022

Added a number of UniFi cameras via yaml as below:

streams:
 front: rtspx://192.168.1.1:7441/E1oZmxXGX4dAzBsz?enableSrtp

When I open go2rtc to view the stream, I either get:
07:42:38.656 WRN [streams] start error="rtcp: invalid packet version" url=rtspx://192.168.1.1:7441/E1oZmxXGX4dAzBsz?enableSrtp
or
07:43:30.654 WRN [streams] start error="rtcp: packet too short" url=rtspx://192.168.1.1:7441/E1oZmxXGX4dAzBsz?enableSrtp

Doesn't matter if I use rtsps or rtspx

@AlexxIT AlexxIT added the question Further information is requested label Oct 20, 2022
@AlexxIT
Copy link
Owner

AlexxIT commented Oct 20, 2022

You need to increase logs level. Maybe there will be something useful there.

@saxopwn
Copy link
Author

saxopwn commented Oct 21, 2022

09:52:14.746 TRC [rtsp] client request:
PLAY rtsps://192.168.1.1:7441/E1oZmxXGX4dAzBsz?enableSrtp/ RTSP/1.0
Session: vBTZ55qE
CSeq: 4

09:52:14.747 TRC [rtsp] client response:
RTSP/1.0 200 OK
Range: npt=now-
Session: vBTZ55qE
Cache-Control: no-store
Date: Fri, 21 Oct 2022 09:52:14 UTC
Pragma: no-cache
Rtp-Info: url=rtsps://192.168.1.1:7441/E1oZmxXGX4dAzBsz?enableSrtp/trackID=1;seq=51883;rtptime=0,url=rtsps://192.168.1.1:7441/E1oZmxXGX4dAzBsz?enableSrtp/trackID=2;seq=34745;rtptime=0
Server: EvoStream Media Server (www.evostream.com)
Cseq: 4
Expires: Fri, 21 Oct 2022 09:52:14 UTC

09:52:14.747 TRC [webrtc] local candidate="candidate:3928457368 1 udp 2130706431 192.168.1.160 60312 typ host"
09:52:14.802 TRC [webrtc] local candidate="candidate:2838228210 1 udp 1694498815 76.249.129.230 48395 typ srflx raddr 0.0.0.0 rport 48395"
09:52:14.802 TRC [webrtc] answer
v=0
o=- 5397660643515131343 1666345934 IN IP4 0.0.0.0
s=-
t=0 0
a=fingerprint:sha-256 F2:8D:99:17:B0:4A:D2:FE:A9:DE:A5:61:F3:F5:90:25:E2:E9:3C:0C:D5:43:E7:FC:D2:80:A7:25:33:22:ED:FF
a=extmap-allow-mixed
a=group:BUNDLE 0 1
m=video 9 UDP/TLS/RTP/SAVPF 102 125 123
c=IN IP4 0.0.0.0
a=setup:active
a=mid:0
a=ice-ufrag:XSJWPEMlYJRajKih
a=ice-pwd:XZlmpIbxKHdcGumhEfugsuxcbYeINUcm
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:102 H264/90000
a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
a=rtcp-fb:102 goog-remb 
a=rtcp-fb:102 transport-cc 
a=rtcp-fb:102 ccm fir
a=rtcp-fb:102 nack 
a=rtcp-fb:102 nack pli
a=rtpmap:125 H264/90000
a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
a=rtcp-fb:125 goog-remb 
a=rtcp-fb:125 transport-cc 
a=rtcp-fb:125 ccm fir
a=rtcp-fb:125 nack 
a=rtcp-fb:125 nack pli
a=rtpmap:123 H264/90000
a=fmtp:123 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001f
a=rtcp-fb:123 goog-remb 
a=rtcp-fb:123 transport-cc 
a=rtcp-fb:123 ccm fir
a=rtcp-fb:123 nack 
a=rtcp-fb:123 nack pli
a=extmap:4 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=ssrc:3662871118 cname:go2rtc
a=ssrc:3662871118 msid:go2rtc video
a=ssrc:3662871118 mslabel:go2rtc
a=ssrc:3662871118 label:video
a=msid:go2rtc video
a=sendonly
a=candidate:3928457368 1 udp 2130706431 192.168.1.160 60312 typ host
a=candidate:3928457368 2 udp 2130706431 192.168.1.160 60312 typ host
a=candidate:2838228210 1 udp 1694498815 76.249.129.230 48395 typ srflx raddr 0.0.0.0 rport 48395
a=candidate:2838228210 2 udp 1694498815 76.249.129.230 48395 typ srflx raddr 0.0.0.0 rport 48395
a=end-of-candidates
m=audio 9 UDP/TLS/RTP/SAVPF 111 0 8
c=IN IP4 0.0.0.0
a=setup:active
a=mid:1
a=ice-ufrag:XSJWPEMlYJRajKih
a=ice-pwd:XZlmpIbxKHdcGumhEfugsuxcbYeINUcm
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10;useinbandfec=1
a=rtcp-fb:111 transport-cc 
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=extmap:4 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=ssrc:3363078967 cname:go2rtc
a=ssrc:3363078967 msid:go2rtc audio
a=ssrc:3363078967 mslabel:go2rtc
a=ssrc:3363078967 label:audio
a=msid:go2rtc audio
a=sendonly
09:52:14.802 TRC [webrtc] remote candidate="candidate:215036887 1 udp 2113937151 814ff855-a712-48c0-9dbd-140d70865e30.local 62774 typ host generation 0 ufrag gHjR network-cost 999"
09:52:14.802 TRC [webrtc] remote candidate="candidate:215036887 1 udp 2113937151 814ff855-a712-48c0-9dbd-140d70865e30.local 62776 typ host generation 0 ufrag gHjR network-cost 999"
09:52:14.802 TRC [webrtc] remote candidate="candidate:842163049 1 udp 1677729535 76.249.129.230 62774 typ srflx raddr 0.0.0.0 rport 0 generation 0 ufrag gHjR network-cost 999"
09:52:14.802 TRC [webrtc] remote candidate="candidate:842163049 1 udp 1677729535 76.249.129.230 62776 typ srflx raddr 0.0.0.0 rport 0 generation 0 ufrag gHjR network-cost 999"
09:52:15.772 WRN [streams] start error="rtcp: invalid packet version" url=rtspx://192.168.1.1:7441/E1oZmxXGX4dAzBsz?enableSrtp```

@AlexxIT
Copy link
Owner

AlexxIT commented Oct 21, 2022

Oh. SRTP not supported. You shouldn't enable it.

There is no need to enable SRTP if you have an RTSPS with a TCP stream. It is already encrypted.

@AlexxIT AlexxIT changed the title UniFi RTSPS cameras added via yaml result in packet error Support SRTP for UniFi RTSPS cameras Oct 21, 2022
@AlexxIT AlexxIT added enhancement New feature or request and removed question Further information is requested labels Oct 21, 2022
@saxopwn
Copy link
Author

saxopwn commented Oct 21, 2022

Easy fix, thanks! FYI- the latest build of UniFi Protect automatically includes the "?enableSrtp" when you copy the RTSP address but seems to work fine after deleting it.

@AlexxIT
Copy link
Owner

AlexxIT commented Oct 21, 2022

SRTP is useful for RTSPS+UDP. But go2rtc support only TCP for now.

@dw0rak
Copy link

dw0rak commented Nov 9, 2022

@saxopwn Did your fix involve only removing from url "?enableSrtp"? I tried changing URL using generic camera integration configuration, but with no luck. Could you please share your config? Thank you

@AlexxIT
Copy link
Owner

AlexxIT commented Nov 9, 2022

Use rtspx for disable certificate check.

@rcjkierkels
Copy link

Use rtspx for disable certificate check.

How do I use rtspx and where should I disable the certificate check? I only have rtsps and rtsp as far as I can see?

@NickM-27
Copy link
Contributor

@rcjkierkels see #15 (comment)

@ViViDboarder
Copy link

I managed to get my UniFi cameras to show stream removing the parameter and using rtspx and manually configuring a stream, however this seems impossible to resolve using the Home Assistant Integration. It appears that whenever I start a stream it overrides my configured value and adds ?enableSrtp back in.

Am I missing a way to get my configuration to persist or maybe a way to tell go2rtc to remove this?

@AlexxIT
Copy link
Owner

AlexxIT commented Dec 11, 2023

@ViViDboarder I don't understand what you talking about

@ViViDboarder
Copy link

Hmm. Sorry. I think I left off some important context while in a debugging rabbit hole.

I tried using go2rtc and configuring it with the Home Assistant RTSP2WebRTC integration. In this integration it seems to pull the RTSP URLs from the entities in Home Assistant. Those URLs look like the ones shown here, with RSTPS and this parameter.

I tried to override it by storing the updated URL in the configuration file using the same entity id, but that didn’t seem to work.

ViViDboarder added a commit to ViViDboarder/go2rtc that referenced this issue Jan 9, 2024
This automatically applies the recommended configuration for UniFi cameras.

Closes AlexxIT#81
ViViDboarder added a commit to ViViDboarder/go2rtc that referenced this issue Nov 5, 2024
This automatically applies the recommended configuration for UniFi cameras.

Closes AlexxIT#81
ViViDboarder added a commit to ViViDboarder/go2rtc that referenced this issue Nov 6, 2024
This automatically applies the recommended configuration for UniFi cameras.

Closes AlexxIT#81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants