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

Make checking SPS/PPS of RTSP SDPs optional #402

Closed
KanyonKris opened this issue Sep 5, 2023 · 9 comments · Fixed by #404
Closed

Make checking SPS/PPS of RTSP SDPs optional #402

KanyonKris opened this issue Sep 5, 2023 · 9 comments · Fixed by #404
Labels
bug Something isn't working

Comments

@KanyonKris
Copy link

KanyonKris commented Sep 5, 2023

MediaMTX version 1.0.3 added a check for valid SPS/PPS of RTSP SDPs (#394). This broke a webcam RTSP stream that had been working in version 1.0.1 and earlier. Yes it's a cheap webcam and my guess is it's outputting a RTSP stream that is not standard compliant, but should MediaMTX refuse to use the stream just because the SPS/PPS is invalid? Perhaps add a config option to disable SPS/PPS checking.

Log:
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: 2023/09/05 14:53:54 DEB [path eveast] [RTSP source] c->s OPTIONS rtsp://10.65.0.127:8554/profile1 RTSP/1.0
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: CSeq: 1
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: User-Agent: gortsplib
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]:
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: 2023/09/05 14:53:54 DEB [path eveast] [RTSP source] s->c RTSP/1.0 200 OK
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: CSeq: 1
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: Date: Tue Sep 5 20:53:54 2023
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: Public: DESCRIBE, SETUP, PLAY, PAUSE, OPTIONS, TEARDOWN,GET_PARAMETER,SET_PARAMETER
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: Server: YGTek RTSP Server 2.0
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]:
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: 2023/09/05 14:53:54 DEB [path eveast] [RTSP source] c->s DESCRIBE rtsp://10.65.0.127:8554/profile1 RTSP/1.0
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: Accept: application/sdp
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: CSeq: 2
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: User-Agent: gortsplib
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]:
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: 2023/09/05 14:53:54 DEB [path eveast] [RTSP source] s->c RTSP/1.0 401 Unauthorized
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: CSeq: 2
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: Date: Tue Sep 5 20:53:54 2023
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: Server: YGTek RTSP Server 2.0
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: WWW-Authenticate: Basic realm="ygtechnologyshanghai"
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]:
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: 2023/09/05 14:53:54 DEB [path eveast] [RTSP source] c->s DESCRIBE rtsp://10.65.0.127:8554/profile1 RTSP/1.0
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: Accept: application/sdp
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: Authorization: Basic ZXY6ZXYx
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: CSeq: 3
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: User-Agent: gortsplib
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]:
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: 2023/09/05 14:53:54 DEB [path eveast] [RTSP source] s->c RTSP/1.0 200 OK
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: CSeq: 3
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: Content-Base: rtsp://10.65.0.127:8554/profile1/
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: Content-Length: 530
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: Content-Type: application/sdp
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: Date: Tue Sep 5 20:53:54 2023
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: Server: YGTek RTSP Server 2.0
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: Session: 2111224323
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]:
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: v=0
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: o=- 0 0 IN IP4 10.65.0.127
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: s=session
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: c=IN IP4 10.65.0.127
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: t=0 0
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: a=control:*
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: a=range:npt=0-
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: m=video 0 RTP/AVP 96
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: a=rtpmap:96 H265/90000
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: a=fmtp:96 profile-space=0;profile-id=0;tier-flag=0;level-id=0;interop-constraints=000000000000;sprop-vps=AAAAAUABDAH//wFgAAADAAADAAADAAADAJasCQ==;sprop-sps=AAAAAUIBAQFgAAADAAADAAADAAADAJag>
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: a=control:rtsp://10.65.0.127:8554/profile1/track=v
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: m=audio 0 RTP/AVP 0
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: a=rtpmap:0 PCMU/8000/1
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: a=control:rtsp://10.65.0.127:8554/profile1/track=a
Sep 05 14:53:54 leh-ev-charging mediamtx[39497]: 2023/09/05 14:53:54 ERR [path eveast] [RTSP source] media 1 is invalid: invalid PPS: not a PPS

@aler9 aler9 added the bug Something isn't working label Sep 6, 2023
@aler9
Copy link
Member

aler9 commented Sep 6, 2023

Hello, i'm going to remove the check, but unfortunately i need another server log from you, since the one you included has the line starting with a=fmtp that is truncated, and it is exactly the line that i need to insert into automatic tests in order to ensure compatibility with your camera forever.

If you have problems with the text editor, attach the server log as a separate file.

@KanyonKris
Copy link
Author

KanyonKris commented Sep 6, 2023

Thanks for the quick reply. Sorry about the truncated line, the terminal did that. Here's the full line:

a=fmtp:96 profile-space=0;profile-id=0;tier-flag=0;level-id=0;interop-constraints=000000000000;sprop-vps=AAAAAUABDAH//wFgAAADAAADAAADAAADAJasCQ==;sprop-sps=AAAAAUIBAQFgAAADAAADAAADAAADAJagBaIB4WNrkkya5Zk=;sprop-pps=AAAAAUQB4HawJkA=

FYI, the webcam is a Revotech I706. It's a common design that is sold under other brands. I initially set it to output H264 but a change in MediaMTX v1.0.1 didn't like the H264 from this webcam so I switched to H265. Let me know if want me to change back to H264 and send you logs. More info on the webcam - https://www.amazon.com/dp/B096VK398F

I don't know much about RTSP. Is the SPS/PPS info a nice-to-have or is it useful/essential for gortsplib? If it's not essential it seems good if gortsplib could ignore invalid SPS/PPS data. Certainly I trust your expertise to decide what gortsplib should do.

@aler9
Copy link
Member

aler9 commented Sep 7, 2023

but a change in MediaMTX v1.0.1 didn't like the H264 from this webcam

which change?

@aler9
Copy link
Member

aler9 commented Sep 7, 2023

Fixed with #404. If you have issues with H264, feel free to open another issue.

@KanyonKris
Copy link
Author

Upgraded to MediaMTX 1.1.0 and I still get an SDP error:
Sep 18 11:47:30 leh-ev-charging mediamtx[19663]: 2023/09/18 11:47:30 ERR [path eveast] [RTSP source] invalid SDP: media 1 is invalid: invalid SPS: not a SPS

Here's the debug log:

Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: 2023/09/18 11:41:02 DEB [path eveast] [RTSP source] [c->s] DESCRIBE rtsp://10.65.0.127:8554/profile1 RTSP/1.0
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: Accept: application/sdp
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: Authorization: Basic ZXY6ZXYx
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: CSeq: 3
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: User-Agent: gortsplib
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]:
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: 2023/09/18 11:41:02 DEB [path eveast] [RTSP source] [s->c] RTSP/1.0 200 OK
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: CSeq: 3
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: Content-Base: rtsp://10.65.0.127:8554/profile1/
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: Content-Length: 420
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: Content-Type: application/sdp
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: Date: Mon Sep 18 17:41:01 2023
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: Server: YGTek RTSP Server 2.0
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: Session: 68754561
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]:
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: v=0
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: o=- 0 0 IN IP4 10.65.0.127
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: s=session
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: c=IN IP4 10.65.0.127
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: t=0 0
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: a=control:*
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: a=range:npt=0-
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: m=video 0 RTP/AVP 96
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: a=rtpmap:96 H264/90000
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: a=fmtp:96 profile-level-id=4DE028;packetization-mode=1;sprop-parameter-sets=AAAAAWdNAB6NjUBaHtCAAAOEAACvyAI=,AAAAAWjuOIA=
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: a=control:rtsp://10.65.0.127:8554/profile1/track=v
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: m=audio 0 RTP/AVP 0
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: a=rtpmap:0 PCMU/8000/1
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: a=control:rtsp://10.65.0.127:8554/profile1/track=a
Sep 18 11:41:02 leh-ev-charging mediamtx[19663]: 2023/09/18 11:41:02 ERR [path eveast] [RTSP source] invalid SDP: media 1 is invalid: invalid SPS: not a SPS

@aler9
Copy link
Member

aler9 commented Sep 18, 2023

@KanyonKris the new SDP you posted contains a H264 track, while this issue was related to a H265 track. Anyway, i'll try to add support for this one too.

@KanyonKris
Copy link
Author

@aler9 ah, that makes sense. That's on me, I should have done H264 back when I first opened this issue. I'm OK to wait for the next release, unless there's a nightly with the H264 fix.

@KanyonKris
Copy link
Author

MediaMTX v1.1.1 fixed it. All streams working now. Thank you.

Copy link

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.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants