Closed getroot closed 6 months ago
@AdamDudley I fixed this issue and pushed it to the master branch. Thank you for reporting this issue. Please check if your issue has been resolved.
I was excited to see this was resolved yesterday as I also wanted to use RTSP pull from 2 separate NVR systems. One uses basic authentication (Swann NVR) and the second does not (Unifi Protect). Unfortunately when I pulled it down after your fix, built and installed it last night, I'm getting an RTSP error stating connection cannot be opened for both RTSP. I can confirm both RTSP urls in the same subnet (no routing or firewalls in between OME and the RTSP source) as the camera and can be accessed from VLC on the same machine. Also tested using ffprobe and ffplay from the same OME install on Ubuntu 22.04 from the host OME server.
Here is my Server.xml config for origin's section:
Here are the logs for the first stream with basic auth, hostname and IP(s) redacted:
[2024-02-01 17:01:25.453] I [SPRtcSig-t3334:178873] HTTP.Server | http_server.cpp:149 | Client(<ClientSocket: 0xffffa899c210, #4, Connected, TCP, Nonblocking, [REDACTED_IP]:59108>) is connected on *:3334
[2024-02-01 17:01:25.489] I [SPRtcSig-t3334:178873] Publisher | publisher.cpp:187 | Try to pull stream from local origin map: [#default#app/camera1] [2024-02-01 17:01:25.489] I [SPRtcSig-t3334:178873] Orchestrator | orchestrator.cpp:818 | Trying to pull stream [#default#app/camera1] from provider using origin map: PullProvider [2024-02-01 17:01:25.496] I [SPRtcSig-t3334:178873] RtspcStream | rtspc_stream.cpp:243 | Request Describe : Request: DESCRIBE rtsp://[REDACTED_IP]:554/ch1/1 1.0 Accept: application/sdp CSeq: 0 User-Agent: OvenMediaEngine
[2024-02-01 17:01:25.505] E [SPRtcSig-t3334:178873] RtspcStream | rtspc_stream.cpp:866 | [#default#app/camera1] An error occurred while receiving packet: [Socket] Remote is disconnected
[2024-02-01 17:01:25.508] I [SPRtcSig-t3334:178873] RtspcStream | rtspc_stream.cpp:243 | Request Describe : Request: DESCRIBE rtsp://[REDACTED_IP]:554/ch1/1 1.0 Accept: application/sdp CSeq: 1 User-Agent: OvenMediaEngine
[2024-02-01 17:01:25.518] E [SPRtcSig-t3334:178873] RtspcStream | rtspc_stream.cpp:866 | [#default#app/camera1] An error occurred while receiving packet: [Socket] Remote is disconnected
[2024-02-01 17:01:25.529] I [SPRtcSig-t3334:178873] RtspcStream | rtspc_stream.cpp:243 | Request Describe : Request: DESCRIBE rtsp://[REDACTED_IP]:554/ch1/1 1.0 Accept: application/sdp CSeq: 2 User-Agent: OvenMediaEngine
Here are the logs from the second RTSP stream without basic authentication which seems to make it further than the first RTSP stream:
[2024-02-01 17:01:59.710] I [SPRtcSig-t3334:178873] HTTP.Server | http_server.cpp:149 | Client(<ClientSocket: 0xffffa3c01a10, #4, Connected, TCP, Nonblocking, [REDACTED_IP]:59115>) is connected on *:3334
[2024-02-01 17:01:59.736] I [SPRtcSig-t3334:178873] Publisher | publisher.cpp:187 | Try to pull stream from local origin map: [#default#app/camera2] [2024-02-01 17:01:59.736] I [SPRtcSig-t3334:178873] Orchestrator | orchestrator.cpp:818 | Trying to pull stream [#default#app/camera2] from provider using origin map: PullProvider [2024-02-01 17:01:59.740] I [SPRtcSig-t3334:178873] RtspcStream | rtspc_stream.cpp:243 | Request Describe : Request: DESCRIBE rtsp://[REDACTED_IP]:7447/[REDACTED_PATH] 1.0 Accept: application/sdp CSeq: 0 User-Agent: OvenMediaEngine
[2024-02-01 17:01:59.755] I [SPRtcSig-t3334:178873] RtspcStream | rtspc_stream.cpp:320 | Response Describe : Response: RTSP/1.0 200 OK Cache-Control: no-store Content-Base: rtsp://[REDACTED_IP]:7447/[REDACTED_PATH]/ Content-Length: 663 Content-Type: application/sdp CSeq: 0 Date: Fri, 02 Feb 2024 01:01:59 UTC Expires: Fri, 02 Feb 2024 01:01:59 UTC Pragma: no-cache Server: Unifi Protect ([REDACTED_URL])
[2024-02-01 17:01:59.756] W [SPRtcSig-t3334:178873] SDP | common_attr.cpp:200 | Unknown attribute type: a=recvonly [2024-02-01 17:01:59.756] W [SPRtcSig-t3334:178873] SDP | media_description.cpp:708 | Sdp parsing error : a=fmtp:96 [2024-02-01 17:01:59.756] I [SPRtcSig-t3334:178873] RtspcStream | rtspc_stream.cpp:364 | SDP : v=0 o=- 294 0 IN IP4 [REDACTED_IP] s=F4E2C60C36A9_1 u=[REDACTED_URL] e=[REDACTED_EMAIL] c=IN IP4 [REDACTED_IP] t=0 0 a=recvonly a=control:* a=range:npt=now- m=audio 0 RTP/AVP 96 a=recvonly a=rtpmap:96 mpeg4-generic/16000/1 a=control:trackID=0 a=fmtp:96 streamtype=5; profile-level-id=15; mode=AAC-hbr; config=1408; SizeLength=13; IndexLength=3; IndexDeltaLength=3; m=audio 0 RTP/AVP 96 a=recvonly a=rtpmap:96 opus/48000/2 a=control:trackID=1 a=fmtp:96 m=video 0 RTP/AVP 97 a=recvonly a=control:trackID=2 a=rtpmap:97 H264/90000 a=fmtp:97 profile-level-id=4d401f; packetization-mode=1; sprop-parameter-sets=Z01AH6aAUAW6bgICAoAAAfSAAHVOTtBEI1A=,aOqPIA==
[2024-02-01 17:01:59.757] I [SPRtcSig-t3334:178873] RtspcStream | rtspc_stream.cpp:438 | Request SETUP : Request: SETUP rtsp://[REDACTED_IP]:7447/[REDACTED_PATH]/trackID=0 1.0 CSeq: 1 Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=10DC1713 User-Agent: OvenMediaEngine
[2024-02-01 17:01:59.762] I [SPRtcSig-t3334:178873] RtspcStream | rtspc_stream.cpp:454 | Response SETUP : Response: RTSP/1.0 200 OK Cache-Control: no-store CSeq: 1 Date: Fri, 02 Feb 2024 01:01:59 UTC Expires: Fri, 02 Feb 2024 01:01:59 UTC Pragma: no-cache Server: Unifi Protect ([REDACTED_URL]) Session: lxlGOZB1;timeout=0 Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=0
[2024-02-01 17:01:59.762] I [SPRtcSig-t3334:178873] RtspcStream | rtspc_stream.cpp:438 | Request SETUP : Request: SETUP rtsp://[REDACTED_IP]:7447/[REDACTED_PATH]/trackID=1 1.0 CSeq: 2 Session: lxlGOZB1 Transport: RTP/AVP/TCP;unicast;interleaved=2-3;ssrc=7D49F2D3 User-Agent: OvenMediaEngine
[2024-02-01 17:01:59.766] I [SPRtcSig-t3334:178873] RtspcStream | rtspc_stream.cpp:454 | Response SETUP : Response: RTSP/1.0 200 OK Cache-Control: no-store CSeq: 2 Date: Fri, 02 Feb 2024 01:01:59 UTC Expires: Fri, 02 Feb 2024 01:01:59 UTC Pragma: no-cache Server: Unifi Protect ([REDACTED_URL]) Session: lxlGOZB1;timeout=0 Transport: RTP/AVP/TCP;unicast;interleaved=2-3;ssrc=0
[2024-02-01 17:01:59.766] I [SPRtcSig-t3334:178873] RtspcStream | rtspc_stream.cpp:438 | Request SETUP : Request: SETUP rtsp://[REDACTED_IP]:7447/[REDACTED_PATH]/trackID=2 1.0 CSeq: 3 Session: lxlGOZB1 Transport: RTP/AVP/TCP;unicast;interleaved=4-5;ssrc=393DF6FA User-Agent: OvenMediaEngine
[2024-02-01 17:01:59.770] I [SPRtcSig-t3334:178873] RtspcStream | rtspc_stream.cpp:454 | Response SETUP : Response: RTSP/1.0 200 OK Cache-Control: no-store CSeq: 3 Date: Fri, 02 Feb 2024 01:01:59 UTC Expires: Fri, 02 Feb 2024 01:01:59 UTC Pragma: no-cache Server: Unifi Protect ([REDACTED_URL]) Session: lxlGOZB1;timeout=0 Transport: RTP/AVP/TCP;unicast;interleaved=4-5;ssrc=0
[2024-02-01 17:01:59.770] I [SPRtcSig-t3334:178873] RtspcStream | rtspc_stream.cpp:640 | Request PLAY : Request: PLAY rtsp://[REDACTED_IP]:7447/[REDACTED_PATH] 1.0 CSeq: 4 Session: lxlGOZB1 User-Agent: OvenMediaEngine
[2024-02-01 17:01:59.774] I [SPRtcSig-t3334:178873] RtspcStream | rtspc_stream.cpp:657 | Response PLAY : Response: RTSP/1.0 200 OK Cache-Control: no-store CSeq: 4 Date: Fri, 02 Feb 2024 01:01:59 UTC Expires: Fri, 02 Feb 2024 01:01:59 UTC Pragma: no-cache Range: npt=now- RTP-Info: url=rtsp://[REDACTED_IP]:7447/[REDACTED_PATH]/trackID=1;seq=31757;rtptime=0,url=rtsp://[REDACTED_IP]:7447/[REDACTED_PATH]/trackID=2;seq=27250;rtptime=0 Server: Unifi Protect ([REDACTED_URL]) Session: lxlGOZB1;timeout=0
[2024-02-01 17:01:59.774] I [SPRtcSig-t3334:178873] Provider | stream.cpp:51 | #default#app/camera2(106) has been started stream [2024-02-01 17:01:59.774] I [SPRtcSig-t3334:178873] MediaRouter | mediarouter_application.cpp:340 | [#default#app/camera2(106)] Trying to create a stream [2024-02-01 17:01:59.774] I [SPRtcSig-t3334:178873] Monitor | application_metrics.cpp:58 | Create StreamMetrics(camera2/1702e2e2-850b-41a6-af95-f2c202250a99/default/#default#app/camera2/i) for monitoring [2024-02-01 17:01:59.774] I [SPRtcSig-t3334:178873] MediaRouter | mediarouter_application.cpp:440 | [#default#app/camera2(106)] Stream has been created [2024-02-01 17:01:59.775] I [SPRtcSig-t3334:178873] Transcoder | transcoder_stream.cpp:63 | [#default#app/camera2(106)] Transcoder stream has been started [2024-02-01 17:01:59.775] I [SPRtcSig-t3334:178873] Provider | application.cpp:198 | #default#app application has created 6 stream motor [2024-02-01 17:01:59.775] I [SPRtcSig-t3334:178873] Provider | stream_motor.cpp:137 | #default#app/camera2(106) stream has added to 6 StreamMotor [2024-02-01 17:01:59.775] E [SPRtcSig-t3334:178873] WebRTC Publisher | webrtc_publisher.cpp:333 | Cannot find stream (#default#app/camera2) [2024-02-01 17:01:59.775] E [SPRtcSig-t3334:178873] Signalling | rtc_signalling_server.cpp:407 | Cannot find stream [#default#app/camera2] [2024-02-01 17:01:59.783] I [SPRtcSig-t3334:178873] Signalling | rtc_signalling_server.cpp:450 | Client is disconnected: HttpConnection(0xffffa3c01410) : WebSocket <ClientSocket: 0xffffa3c01a10, #4, Connected, TCP, Nonblocking, [REDACTED_IP]:59115> TLS(Enabled) (#default#app / camera2, ufrag: local: (N
@df503 Is it correct that you pulled the master branch? If so, please send your rtsp url to support@airensoft.com.
Yes, I can confirm its the master branch I tested. Unfortunately for testing, my rtsp urls are private and double natted so I'd have to get creative, setup some acls and punch a few holes through 2 firewalls and setup a few things to allow you to test against my rtsp urls. I will have to try it later after-hours but I appreciate your prompt response. I am new to this project, but I'm loving everything that I've seen so far.
I have encountered the same issue using docker 0.16.4, and I can confirm that the master branch works fine for me.
@df503 If you are trying to build a docker image yourself, it would be better if you use Dockerfile.local
which guarentees that the sources are pulled from local git repo.
I made some progress just a short while ago. I am using a dedicated VM on my machine as a test for this project, so I installed Ubuntu 22.04, cloned the project from master (there were some commits to master earlier today that affected the rtsp related files), compiled and installed locally so I could also run gnome and verify with VLC and ffplay the RTSP streams were good from the exact same source that will be accessing the rtsp streams.
Here's what I found. I was able to get a working rtsp stream, but, I had to use another transcoder in the middle basically. Both direct connections to my Swann and Unifi Protect RTSP sources just don't want to play nice. I am currently using "scrypted" to take my RTSP streams from my Swann NVR and my Unifi Protect and transcoding them into HomeKit compatible format. Scrypted has this transcoding feature with custom ports and RTSP URLs it generates for each camera.
I revamped my network today and eliminated a temporary double nat so I can share my rtsp streams with support@airensoft.com because it would be really nice to eliminate the need for a second transcoder when I would think OME's transcoder should be able to handle it. Both scrypted and OME appear to be using ffmepg for transcoding (like nearly every other product out there that handles transcoding is what I'm finding).
@df503 Your RTSP Server transmits AAC, OPUS, and H264. And it sends RTCP SR for AAC and H264, but not for OPUS. RTCP SR is required for A/V sync. Your OME is unable to start the stream because it is waiting for OPUS's RTCP SR from your RTSP server.
The fundamental solution is for your RTSP server to send an RTCP SR for OPUS. Alternatively, you can tell OME to ignore RTCP SRs with the settings below: This option can be enabled in the latest master branch.
<Origins>
<Properties>
<NoInputFailoverTimeout>3000</NoInputFailoverTimeout>
<UnusedStreamDeletionTimeout>60000</UnusedStreamDeletionTimeout>
</Properties>
<Origin>
<Location>/app/stream</Location>
<Pass>
<Scheme>rtsp</Scheme>
<Urls>
<Url>xxx.xxx.xxx.xxx:0000/yyyyyyyy</Url>
</Urls>
</Pass>
<IgnoreRtcpSRTimestamp>true</IgnoreRtcpSRTimestamp>
</Origin>
</Origins>
@df503 Your RTSP Server transmits AAC, OPUS, and H264. And it sends RTCP SR for AAC and H264, but not for OPUS. RTCP SR is required for A/V sync. Your OME is unable to start the stream because it is waiting for OPUS's RTCP SR from your RTSP server.
The fundamental solution is for your RTSP server to send an RTCP SR for OPUS. Alternatively, you can tell OME to ignore RTCP SRs with the settings below: This option can be enabled in the latest master branch.
<Origins> <Properties> <NoInputFailoverTimeout>3000</NoInputFailoverTimeout> <UnusedStreamDeletionTimeout>60000</UnusedStreamDeletionTimeout> </Properties> <Origin> <Location>/app/stream</Location> <Pass> <Scheme>rtsp</Scheme> <Urls> <Url>xxx.xxx.xxx.xxx:0000/yyyyyyyy</Url> </Urls> </Pass> <IgnoreRtcpSRTimestamp>true</IgnoreRtcpSRTimestamp> </Origin> </Origins>
This works awesome for the Unifi Protect RTSP stream! Thank you for addressing it so quickly! You are awesome!
This patch made it into the 0.16.5 release. If the issue reproduces, please reopen the issue. Thank you.
Just got round to checking this out in 16.5, working great, thank you.
Discussed in https://github.com/AirenSoft/OvenMediaEngine/discussions/1498