bluenviron / mediamtx

Ready-to-use SRT / WebRTC / RTSP / RTMP / LL-HLS media server and media proxy that allows to read, publish, proxy, record and playback video and audio streams.
MIT License
12.09k stars 1.52k forks source link

Regression in v0.20.3 for proxying ondemand rtsp stream on wyze cams with wz_mini_hacks #1292

Closed clee604 closed 1 year ago

clee604 commented 1 year ago

Which version are you using?

v0.20.3

Which operating system are you using?

Linux

Describe the issue

I use rtsp-simple-server to proxy some wyze rtsp feeds (using wz_mini_hacks). This works fine with v.0.20.2 but in 0.20.3 I get the following error:

v0.20.3 2022/12/10 18:36:39 INF [path wyzetwo] [rtsp source] started 2022/12/10 18:36:39 INF [path wyzetwo] [rtsp source] ERR: unable to parse track 2: invalid clock (16000) 2022/12/10 18:36:44 INF [path wyzetwo] [rtsp source] ERR: unable to parse track 2: invalid clock (16000) 2022/12/10 18:36:49 INF [path wyzetwo] [rtsp source] stopped 2022/12/10 18:36:49 INF [RTSP] [conn 192.168.0.xxx:xxxxx] closed (source of path 'wyzetwo' has timed out)

In 0.20.2 the log shows 2022/12/10 18:37:19 INF [path wyzetwo] [rtsp source] started 2022/12/10 18:37:20 INF [path wyzetwo] [rtsp source] ready: 2 tracks (H264, Generic) 2022/12/10 18:37:20 INF [RTSP] [session 735049277] created by 192.168.x.x:xxxxx 2022/12/10 18:37:20 INF [RTSP] [session 735049277] is reading from path 'wyzetwo', with TCP, 1 track (H264)

Describe how to replicate the issue

The docker repository doesn't seem to be updated with the latest version yet so this was tested using the amd64 linux binary directly.

My configuration yaml has the following entry:

wyzetwo: source: rtsp://xxx:xxx@192.168.x.xxx:8554/unicast sourceOnDemand: yes

This is a simple ondemand proxy feed, I am using TinyCam on android as a client.

I noticed in the release notes some changes to the clock rate detection, I'm not sure what this means or I need to update my YAML configuration to reflect this update. Rolling back to 20.2 has fixed it for the time being.

This issue seems to only impact the rtsp feeds from wyze cameras using wz_mini_hacks. I tested the rtsp feed using a Eufy camera and a Xiaomi camera using fang-hacks and both are fine. There might be something non-standard about the feed coming from the wyze (wz_mini_hacks) cameras. I do not have currently have a wyze camera with the old rtsp firmware installed to test that unfortunately.

Did you attach the server logs?

yes, see above

Did you attach a network dump?

no

aler9 commented 1 year ago

Hello, please post server logs with logLevel: debug as explicitly stated in the issue template, otherwise it's not possible to replicate the bug.

clee604 commented 1 year ago

Sorry about that, here you go. Thanks!

2022/12/12 15:21:54 INF rtsp-simple-server v0.20.3
2022/12/12 15:21:54 DEB [path balcony] created
2022/12/12 15:21:54 DEB path manager created
2022/12/12 15:21:54 INF [RTSP] listener opened on :8554 (TCP), :8000 (UDP/RTP), :8001 (UDP/RTCP)
2022/12/12 15:21:54 INF [RTMP] listener opened on :1935
2022/12/12 15:21:54 INF [HLS] listener opened on :8888
2022/12/12 15:22:02 INF [RTSP] [conn 192.168.0.xxx:54872] opened
2022/12/12 15:22:02 DEB [RTSP] [conn 192.168.0.xxx:54872] [c->s] OPTIONS rtsp://192.168.0.x:8554/balcony RTSP/1.0
CSeq: 2
User-Agent: LibVLC/3.0.16 (LIVE555 Streaming Media v2016.11.28)

2022/12/12 15:22:02 DEB [RTSP] [conn 192.168.0.xxx:54872] [s->c] RTSP/1.0 200 OK
CSeq: 2
Public: DESCRIBE, ANNOUNCE, SETUP, PLAY, RECORD, PAUSE, GET_PARAMETER, TEARDOWN
Server: gortsplib

2022/12/12 15:22:02 DEB [RTSP] [conn 192.168.0.xxx:54872] [c->s] DESCRIBE rtsp://192.168.0.x:8554/balcony RTSP/1.0
Accept: application/sdp
CSeq: 3
User-Agent: LibVLC/3.0.16 (LIVE555 Streaming Media v2016.11.28)

2022/12/12 15:22:02 INF [path balcony] [rtsp source] started
2022/12/12 15:22:02 DEB [path balcony] [rtsp source] connecting
2022/12/12 15:22:02 DEB [path balcony] [rtsp source] c->s OPTIONS rtsp://192.168.0.xx:8554/unicast RTSP/1.0
CSeq: 1
User-Agent: gortsplib

2022/12/12 15:22:02 DEB [path balcony] [rtsp source] s->c RTSP/1.0 200 OK
CSeq: 1
Date: Mon, Dec 12 2022 15:22:07 GMT
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER

2022/12/12 15:22:02 DEB [path balcony] [rtsp source] c->s DESCRIBE rtsp://192.168.0.xx:8554/unicast RTSP/1.0
Accept: application/sdp
CSeq: 2
User-Agent: gortsplib

2022/12/12 15:22:02 DEB [path balcony] [rtsp source] s->c RTSP/1.0 401 Unauthorized
CSeq: 2
Date: Mon, Dec 12 2022 15:22:07 GMT
WWW-Authenticate: Digest realm="LIVE555 Streaming Media", nonce="aa7633f744cd0811e059524b4a1d8ffc"

2022/12/12 15:22:02 DEB [path balcony] [rtsp source] c->s DESCRIBE rtsp://192.168.0.xx:8554/unicast RTSP/1.0
Accept: application/sdp
Authorization: Digest username="xxx", realm="LIVE555 Streaming Media", nonce="aa7633f744cd0811e059524b4a1d8ffc", uri="rtsp://192.168.0.xx:8554/unicast", response="714623543bd9832b7f655688e562c889"
CSeq: 3
User-Agent: gortsplib

2022/12/12 15:22:02 DEB [path balcony] [rtsp source] s->c RTSP/1.0 200 OK
CSeq: 3
Content-Base: rtsp://192.168.0.xx:8554/unicast/
Content-Length: 668
Content-Type: application/sdp
Date: Mon, Dec 12 2022 15:22:07 GMT

v=0
o=- 1668550550548001 1 IN IP4 192.168.0.xx
s=LIVE555 Streaming Media v2022.04.26
i=LIVE555 Streaming Media v2022.04.26
t=0 0
a=tool:LIVE555 Streaming Media v2022.04.26
a=type:broadcast
a=control:*
a=range:npt=now-
a=x-qt-text-nam:LIVE555 Streaming Media v2022.04.26
a=x-qt-text-inf:LIVE555 Streaming Media v2022.04.26
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:500
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=4d0029;sprop-parameter-sets=J00AKedAPAET8s1AQEB8AAADAAQAAAMAoNGADqYAFfl//wKA,KO48gA==
a=x-dimensions:1920,1080
a=control:track1
m=audio 0 RTP/AVP 97
c=IN IP4 0.0.0.0
b=AS:500
a=rtpmap:97 L16/16000
a=fmtp:97 
a=control:track2

2022/12/12 15:22:02 INF [path balcony] [rtsp source] ERR: unable to parse track 2: invalid clock (16000)
2022/12/12 15:22:07 INF [RTSP] [conn 192.168.0.xxx:54874] opened
2022/12/12 15:22:07 DEB [RTSP] [conn 192.168.0.xxx:54874] [c->s] SETUP rtsp://192.168.0.x:8554/balcony RTSP/1.0
CSeq: 0
Transport: RTP/AVP;unicast;client_port=9362-9363

2022/12/12 15:22:07 INF [RTSP] [session 7ec09b48] created by 192.168.0.xxx:54874
2022/12/12 15:22:07 DEB [RTSP] [conn 192.168.0.xxx:54874] [s->c] RTSP/1.0 400 Bad Request
CSeq: 0
Server: gortsplib

2022/12/12 15:22:07 INF [RTSP] [conn 192.168.0.xxx:54874] closed (path of a SETUP request must end with a slash. This typically happens when VLC fails a request, and then switches to an unsupported RTSP dialect)
2022/12/12 15:22:07 INF [RTSP] [session 7ec09b48] destroyed (not in use)
2022/12/12 15:22:07 INF [RTSP] [conn 192.168.0.xxx:54875] opened
2022/12/12 15:22:07 DEB [RTSP] [conn 192.168.0.xxx:54875] [c->s] OPTIONS rtsp://192.168.0.x:8554 RTSP/1.0
CSeq: 1
Clientchallenge: 9e26d33f2984236010ef6253fb1887f7
Clientid: Linux_2.4_6.0.9.1235_play32_RN01_EN_586
Companyid: KnKV4M4I/B2FjJ1TToLycw==
Guid: 00000000-0000-0000-0000-000000000000
Playerstarttime: [28/03/2003:22:50:23 00:00]
Regiondata: 0
User-Agent: RealMedia Player Version 6.0.9.1235 (linux-2.0-libc6-i386-gcc2.95)

2022/12/12 15:22:07 DEB [RTSP] [conn 192.168.0.xxx:54875] [s->c] RTSP/1.0 200 OK
CSeq: 1
Public: DESCRIBE, ANNOUNCE, SETUP, PLAY, RECORD, PAUSE, GET_PARAMETER, TEARDOWN
Server: gortsplib

2022/12/12 15:22:07 INF [RTSP] [conn 192.168.0.xxx:54875] closed (EOF)
2022/12/12 15:22:07 DEB [path balcony] [rtsp source] connecting
2022/12/12 15:22:07 DEB [path balcony] [rtsp source] c->s OPTIONS rtsp://192.168.0.xx:8554/unicast RTSP/1.0
CSeq: 1
User-Agent: gortsplib

2022/12/12 15:22:07 DEB [path balcony] [rtsp source] s->c RTSP/1.0 200 OK
CSeq: 1
Date: Mon, Dec 12 2022 15:22:12 GMT
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER

2022/12/12 15:22:07 DEB [path balcony] [rtsp source] c->s DESCRIBE rtsp://192.168.0.xx:8554/unicast RTSP/1.0
Accept: application/sdp
CSeq: 2
User-Agent: gortsplib

2022/12/12 15:22:07 DEB [path balcony] [rtsp source] s->c RTSP/1.0 401 Unauthorized
CSeq: 2
Date: Mon, Dec 12 2022 15:22:12 GMT
WWW-Authenticate: Digest realm="LIVE555 Streaming Media", nonce="9f865e31a6715c2cbe171b8c5b98e41e"

2022/12/12 15:22:07 DEB [path balcony] [rtsp source] c->s DESCRIBE rtsp://192.168.0.xx:8554/unicast RTSP/1.0
Accept: application/sdp
Authorization: Digest username="xxx", realm="LIVE555 Streaming Media", nonce="9f865e31a6715c2cbe171b8c5b98e41e", uri="rtsp://192.168.0.xx:8554/unicast", response="d3dc568f1562e15030882d3c70ea95fe"
CSeq: 3
User-Agent: gortsplib

2022/12/12 15:22:07 DEB [path balcony] [rtsp source] s->c RTSP/1.0 200 OK
CSeq: 3
Content-Base: rtsp://192.168.0.xx:8554/unicast/
Content-Length: 668
Content-Type: application/sdp
Date: Mon, Dec 12 2022 15:22:12 GMT

v=0
o=- 1668550550548001 1 IN IP4 192.168.0.xx
s=LIVE555 Streaming Media v2022.04.26
i=LIVE555 Streaming Media v2022.04.26
t=0 0
a=tool:LIVE555 Streaming Media v2022.04.26
a=type:broadcast
a=control:*
a=range:npt=now-
a=x-qt-text-nam:LIVE555 Streaming Media v2022.04.26
a=x-qt-text-inf:LIVE555 Streaming Media v2022.04.26
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:500
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=4d0029;sprop-parameter-sets=J00AKedAPAET8s1AQEB8AAADAAQAAAMAoNGADqYAFfl//wKA,KO48gA==
a=x-dimensions:1920,1080
a=control:track1
m=audio 0 RTP/AVP 97
c=IN IP4 0.0.0.0
b=AS:500
a=rtpmap:97 L16/16000
a=fmtp:97 
a=control:track2

2022/12/12 15:22:07 INF [path balcony] [rtsp source] ERR: unable to parse track 2: invalid clock (16000)
2022/12/12 15:22:12 INF [path balcony] [rtsp source] stopped
2022/12/12 15:22:12 DEB [RTSP] [conn 192.168.0.xxx:54872] [s->c] RTSP/1.0 400 Bad Request
CSeq: 3
Server: gortsplib

2022/12/12 15:22:12 INF [RTSP] [conn 192.168.0.xxx:54872] closed (source of path 'balcony' has timed out)
clee604 commented 1 year ago

Noticed there is v0.20.4 out, I tested that and issue remains:

xxx@rtsp:~/.rtsp$ sudo ./rtsp-simple-server
2022/12/12 15:32:58 INF rtsp-simple-server v0.20.4
2022/12/12 15:32:58 DEB [path balcony] created
2022/12/12 15:32:58 DEB path manager created
2022/12/12 15:32:58 INF [RTSP] listener opened on :8554 (TCP), :8000 (UDP/RTP), :8001 (UDP/RTCP)
2022/12/12 15:32:58 INF [RTMP] listener opened on :1935
2022/12/12 15:32:58 INF [HLS] listener opened on :8888
2022/12/12 15:33:07 INF [RTSP] [conn 192.168.0.xxx:54955] opened
2022/12/12 15:33:07 DEB [RTSP] [conn 192.168.0.xxx:54955] [c->s] OPTIONS rtsp://192.168.0.x:8554/balcony RTSP/1.0
CSeq: 2
User-Agent: LibVLC/3.0.16 (LIVE555 Streaming Media v2016.11.28)

2022/12/12 15:33:07 DEB [RTSP] [conn 192.168.0.xxx:54955] [s->c] RTSP/1.0 200 OK
CSeq: 2
Public: DESCRIBE, ANNOUNCE, SETUP, PLAY, RECORD, PAUSE, GET_PARAMETER, TEARDOWN
Server: gortsplib

2022/12/12 15:33:07 DEB [RTSP] [conn 192.168.0.xxx:54955] [c->s] DESCRIBE rtsp://192.168.0.x:8554/balcony RTSP/1.0
Accept: application/sdp
CSeq: 3
User-Agent: LibVLC/3.0.16 (LIVE555 Streaming Media v2016.11.28)

2022/12/12 15:33:07 INF [path balcony] [rtsp source] started
2022/12/12 15:33:07 DEB [path balcony] [rtsp source] connecting
2022/12/12 15:33:07 DEB [path balcony] [rtsp source] c->s OPTIONS rtsp://192.168.0.xx:8554/unicast RTSP/1.0
CSeq: 1
User-Agent: gortsplib

2022/12/12 15:33:07 DEB [path balcony] [rtsp source] s->c RTSP/1.0 200 OK
CSeq: 1
Date: Mon, Dec 12 2022 15:33:13 GMT
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER

2022/12/12 15:33:07 DEB [path balcony] [rtsp source] c->s DESCRIBE rtsp://192.168.0.xx:8554/unicast RTSP/1.0
Accept: application/sdp
CSeq: 2
User-Agent: gortsplib

2022/12/12 15:33:07 DEB [path balcony] [rtsp source] s->c RTSP/1.0 401 Unauthorized
CSeq: 2
Date: Mon, Dec 12 2022 15:33:13 GMT
WWW-Authenticate: Digest realm="LIVE555 Streaming Media", nonce="a3c7ac74d7dba89c1987c0dc58838564"

2022/12/12 15:33:07 DEB [path balcony] [rtsp source] c->s DESCRIBE rtsp://192.168.0.xx:8554/unicast RTSP/1.0
Accept: application/sdp
Authorization: Digest username="xxx", realm="LIVE555 Streaming Media", nonce="a3c7ac74d7dba89c1987c0dc58838564", uri="rtsp://192.168.0.xx:8554/unicast", response="4bd50348910bd680beb7a6bc9b5e4daa"
CSeq: 3
User-Agent: gortsplib

2022/12/12 15:33:07 DEB [path balcony] [rtsp source] s->c RTSP/1.0 200 OK
CSeq: 3
Content-Base: rtsp://192.168.0.xx:8554/unicast/
Content-Length: 668
Content-Type: application/sdp
Date: Mon, Dec 12 2022 15:33:13 GMT

v=0
o=- 1668550550548001 1 IN IP4 192.168.0.xx
s=LIVE555 Streaming Media v2022.04.26
i=LIVE555 Streaming Media v2022.04.26
t=0 0
a=tool:LIVE555 Streaming Media v2022.04.26
a=type:broadcast
a=control:*
a=range:npt=now-
a=x-qt-text-nam:LIVE555 Streaming Media v2022.04.26
a=x-qt-text-inf:LIVE555 Streaming Media v2022.04.26
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:500
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=4d0029;sprop-parameter-sets=J00AKedAPAET8s1AQEB8AAADAAQAAAMAoNGADqYAFfl//wKA,KO48gA==
a=x-dimensions:1920,1080
a=control:track1
m=audio 0 RTP/AVP 97
c=IN IP4 0.0.0.0
b=AS:500
a=rtpmap:97 L16/16000
a=fmtp:97 
a=control:track2

2022/12/12 15:33:07 INF [path balcony] [rtsp source] ERR: unable to parse track 2: invalid clock (16000)
2022/12/12 15:33:12 INF [RTSP] [conn 192.168.0.xxx:54956] opened
2022/12/12 15:33:12 DEB [RTSP] [conn 192.168.0.xxx:54956] [c->s] SETUP rtsp://192.168.0.x:8554/balcony RTSP/1.0
CSeq: 0
Transport: RTP/AVP;unicast;client_port=9052-9053

2022/12/12 15:33:12 INF [RTSP] [session 13ccd562] created by 192.168.0.xxx:54956
2022/12/12 15:33:12 DEB [RTSP] [conn 192.168.0.xxx:54956] [s->c] RTSP/1.0 400 Bad Request
CSeq: 0
Server: gortsplib

2022/12/12 15:33:12 INF [RTSP] [session 13ccd562] destroyed (not in use)
2022/12/12 15:33:12 INF [RTSP] [conn 192.168.0.xxx:54956] closed (path of a SETUP request must end with a slash. This typically happens when VLC fails a request, and then switches to an unsupported RTSP dialect)
2022/12/12 15:33:12 INF [RTSP] [conn 192.168.0.xxx:54957] opened
2022/12/12 15:33:12 DEB [RTSP] [conn 192.168.0.xxx:54957] [c->s] OPTIONS rtsp://192.168.0.x:8554 RTSP/1.0
CSeq: 1
Clientchallenge: 9e26d33f2984236010ef6253fb1887f7
Clientid: Linux_2.4_6.0.9.1235_play32_RN01_EN_586
Companyid: KnKV4M4I/B2FjJ1TToLycw==
Guid: 00000000-0000-0000-0000-000000000000
Playerstarttime: [28/03/2003:22:50:23 00:00]
Regiondata: 0
User-Agent: RealMedia Player Version 6.0.9.1235 (linux-2.0-libc6-i386-gcc2.95)

2022/12/12 15:33:12 DEB [RTSP] [conn 192.168.0.xxx:54957] [s->c] RTSP/1.0 200 OK
CSeq: 1
Public: DESCRIBE, ANNOUNCE, SETUP, PLAY, RECORD, PAUSE, GET_PARAMETER, TEARDOWN
Server: gortsplib

2022/12/12 15:33:12 INF [RTSP] [conn 192.168.0.xxx:54957] closed (EOF)
2022/12/12 15:33:12 DEB [path balcony] [rtsp source] connecting
2022/12/12 15:33:12 DEB [path balcony] [rtsp source] c->s OPTIONS rtsp://192.168.0.xx:8554/unicast RTSP/1.0
CSeq: 1
User-Agent: gortsplib

2022/12/12 15:33:12 DEB [path balcony] [rtsp source] s->c RTSP/1.0 200 OK
CSeq: 1
Date: Mon, Dec 12 2022 15:33:18 GMT
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER

2022/12/12 15:33:12 DEB [path balcony] [rtsp source] c->s DESCRIBE rtsp://192.168.0.xx:8554/unicast RTSP/1.0
Accept: application/sdp
CSeq: 2
User-Agent: gortsplib

2022/12/12 15:33:12 DEB [path balcony] [rtsp source] s->c RTSP/1.0 401 Unauthorized
CSeq: 2
Date: Mon, Dec 12 2022 15:33:18 GMT
WWW-Authenticate: Digest realm="LIVE555 Streaming Media", nonce="cfcc3aca29ce6a694c0ae92fd7f4943c"

2022/12/12 15:33:12 DEB [path balcony] [rtsp source] c->s DESCRIBE rtsp://192.168.0.xx:8554/unicast RTSP/1.0
Accept: application/sdp
Authorization: Digest username="xxx", realm="LIVE555 Streaming Media", nonce="cfcc3aca29ce6a694c0ae92fd7f4943c", uri="rtsp://192.168.0.xx:8554/unicast", response="0cac5f0985538398fe2e7dfa7088e368"
CSeq: 3
User-Agent: gortsplib

2022/12/12 15:33:12 DEB [path balcony] [rtsp source] s->c RTSP/1.0 200 OK
CSeq: 3
Content-Base: rtsp://192.168.0.xx:8554/unicast/
Content-Length: 668
Content-Type: application/sdp
Date: Mon, Dec 12 2022 15:33:18 GMT

v=0
o=- 1668550550548001 1 IN IP4 192.168.0.xx
s=LIVE555 Streaming Media v2022.04.26
i=LIVE555 Streaming Media v2022.04.26
t=0 0
a=tool:LIVE555 Streaming Media v2022.04.26
a=type:broadcast
a=control:*
a=range:npt=now-
a=x-qt-text-nam:LIVE555 Streaming Media v2022.04.26
a=x-qt-text-inf:LIVE555 Streaming Media v2022.04.26
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:500
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=4d0029;sprop-parameter-sets=J00AKedAPAET8s1AQEB8AAADAAQAAAMAoNGADqYAFfl//wKA,KO48gA==
a=x-dimensions:1920,1080
a=control:track1
m=audio 0 RTP/AVP 97
c=IN IP4 0.0.0.0
b=AS:500
a=rtpmap:97 L16/16000
a=fmtp:97 
a=control:track2

2022/12/12 15:33:12 INF [path balcony] [rtsp source] ERR: unable to parse track 2: invalid clock (16000)
2022/12/12 15:33:17 INF [path balcony] [rtsp source] stopped
2022/12/12 15:33:17 DEB [RTSP] [conn 192.168.0.xxx:54955] [s->c] RTSP/1.0 400 Bad Request
CSeq: 3
Server: gortsplib

2022/12/12 15:33:17 INF [RTSP] [conn 192.168.0.xxx:54955] closed (source of path 'balcony' has timed out)
aler9 commented 1 year ago

Thanks for posting the log, the issue has been fixed and the fix will be included in the next release. In the meanwhile, you can test the fix by using this nightly release:

(link removed)

clee604 commented 1 year ago

Thanks, I can confirm the nightly release fixes the issue!

aler9 commented 1 year ago

fixed in v0.21.0.

github-actions[bot] commented 1 year ago

This issue is being locked automatically because it has been closed for more than 6 months. Please open a new issue in case you encounter a similar problem.