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

Allow using odd Interleaved IDs #1762

Closed TeamKomet closed 1 year ago

TeamKomet commented 1 year ago

Which version are you using?

v0.22.2

Which operating system are you using?

Describe the issue

Streaming a MJPG Stream from a USB Camera with gestreamer to medimtx after conversion to h264. RTSP Client is Qognify VMS formerly CAYUGA VMS. Connection is made with TCP. Error code ist ERR : invalid interleaved IDs

Describe how to replicate the issue

Happens after every connection attempt with the above VMS. Connection is opened and closed every second with the described error message.

Works without problems with VLC, Tinycam etc.

Did you attach the server logs?

yes

2023/05/04 08:55:26 INF [RTSP] [conn 10.4.149.26:58480] opened 2023/05/04 08:55:26 DEB [RTSP] [conn 10.4.149.26:58480] [c->s] OPTIONS rtsp://10.1.100.51:8554/mystream RTSP/1.0 Authorization: Basic Og== CSeq: 1 User-Agent: Java / Seetec

2023/05/04 08:55:26 DEB [RTSP] [conn 10.4.149.26:58480] [s->c] RTSP/1.0 200 OK CSeq: 1 Public: DESCRIBE, ANNOUNCE, SETUP, PLAY, RECORD, PAUSE, GET_PARAMETER, TEARDOWN Server: gortsplib

2023/05/04 08:55:26 DEB [RTSP] [conn 10.4.149.26:58480] [c->s] DESCRIBE rtsp://10.1.100.51:8554/mystream RTSP/1.0 Accept: application/sdp CSeq: 2 User-Agent: Java / Seetec

2023/05/04 08:55:26 DEB [RTSP] [conn 10.4.149.26:58480] [s->c] RTSP/1.0 200 OK CSeq: 2 Content-Base: rtsp://10.1.100.51:8554/mystream/ Content-Length: 271 Content-Type: application/sdp Server: gortsplib

v=0 o=- 0 0 IN IP4 127.0.0.1 s=Stream c=IN IP4 0.0.0.0 t=0 0 m=video 0 RTP/AVP 96 a=control:rtsp://10.1.100.51:8554/mystream/trackID=0 a=rtpmap:96 H264/90000 a=fmtp:96 packetization-mode=1; profile-level-id=424028; sprop-parameter-sets=Z0JAKKaAeAIn5UA=,aM44gA==

2023/05/04 08:55:26 DEB [RTSP] [conn 10.4.149.26:58480] [c->s] SETUP rtsp://10.1.100.51:8554/mystream/trackID=0 RTSP/1.0 CSeq: 3 Transport: RTP/AVP/TCP;unicast;interleaved=1-2 User-Agent: Java / Seetec

2023/05/04 08:55:26 INF [RTSP] [session 4d5a501a] created by 10.4.149.26:58480 2023/05/04 08:55:26 DEB [RTSP] [conn 10.4.149.26:58480] [s->c] RTSP/1.0 400 Bad Request CSeq: 3 Server: gortsplib

2023/05/04 08:55:26 INF [RTSP] [conn 10.4.149.26:58480] closed (invalid interleaved IDs) 2023/05/04 08:55:26 INF [RTSP] [session 4d5a501a] destroyed (not in use)

Did you attach a network dump?

no

Gerbaum commented 1 year ago

I seems my vms is requesting interleaved IDs 1-2, which is not the ususal way, since vlc and other vms are requesting 0-1 IDs. This results in a bad request. Any change to redirtect client requests to 1-2 to valid IDs 0-1 on mediamtx side?

aler9 commented 1 year ago

I seems my vms is requesting interleaved IDs 1-2, which is not the ususal way, since vlc and other vms are requesting 0-1 IDs

Exactly. I'll edit the library in order to redirect to the right IDs, but it may not be enough, since these clients may want to use their intended IDs.

brothercorvo commented 1 year ago

I have a similar problem using WinTAK video player Describe how to replicate the issue Connect to a RTSP stream using WinTAK (any version)

LOGS Wireshark request 62 4.126893 192.168.1.150 204.48.30.216 RTSP 220 PLAY rtsp://204.48.30.216:8554/live/Corvo/trackID=0 RTSP/1.0 response 70 4.457005 204.48.30.216 192.168.1.150 RTSP 110 Reply: RTSP/1.0 400 Bad Request in the server logs 2023/05/11 14:06:57 INF [RTSP] [conn 129.222.188.14:59163] opened 2023/05/11 14:06:57 INF [RTSP] [session 2852d870] created by 129.222.188.14:59163 2023/05/11 14:06:57 INF [RTSP] [conn 129.222.188.14:59163] closed (path has changed, was '/live/Corvo', now is '/live/Corvo/trackID=0')

I was able to connect with a prev. version of mediamtx (Dec 2021)

brothercorvo commented 1 year ago

@aler9 I can confirm that this is a bug that has been introduced in the last year. using version v0.18.0, I can connect successfully with the same sequence:

51  1.519738    192.168.1.150   198.199.70.185  RTSP    148 OPTIONS rtsp://198.199.70.185:8554/live/Corvo RTSP/1.0
494 7.721091    198.199.70.185  192.168.1.150   RTSP    182 Reply: RTSP/1.0 200 OK
495 7.721445    192.168.1.150   198.199.70.185  RTSP    174 DESCRIBE rtsp://198.199.70.185:8554/live/Corvo RTSP/1.0
496 7.773402    198.199.70.185  192.168.1.150   RTSP/SDP    316 Reply: RTSP/1.0 200 OK
497 7.774521    192.168.1.150   198.199.70.185  RTSP    203 SETUP rtsp://198.199.70.185:8554/live/Corvo/ RTSP/1.0
498 7.813529    198.199.70.185  192.168.1.150   RTSP    141 Reply: RTSP/1.0 461 Unsupported Transport

Transport: RTP/AVP/UDP;unicast;client_port=16076-16077 // trying to use UDP that is disabled 499 7.813985 192.168.1.150 198.199.70.185 RTSP 216 SETUP rtsp://198.199.70.185:8554/live/Corvo/ RTSP/1.0 Transport: RTP/AVP/TCP;unicast;interleaved=0-1 500 7.858533 198.199.70.185 192.168.1.150 RTSP 184 Reply: RTSP/1.0 200 OK // switch to TCP

501 7.859540    192.168.1.150   198.199.70.185  RTSP    186 PLAY rtsp://198.199.70.185:8554/live/Corvo/ RTSP/1.0
502 7.904105    198.199.70.185  192.168.1.150   RTSP    122 Reply: RTSP/1.0 200 OK

stream starts

aler9 commented 1 year ago

@brothercorvo your problem that is unrelated from this, please open another issue.

brothercorvo commented 1 year ago

issue https://github.com/aler9/mediamtx/issues/1790 has been created

aler9 commented 1 year ago

This is fixed and the fix will be available in the next release.

github-actions[bot] commented 10 months 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.