bluenviron / gortsplib

RTSP 1.0 client and server library for the Go programming language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

invalid SDP: media 4 is invalid: config is missing

fjfeijoo opened this issue · comments

When trying to connect (for audio backchannel) to a Dahua camera through ONVIF I get an error parsing the SDP response:

The url of the RTSP is as follows:
rtsp://URL:PORT/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif


CSeq: 3
Cache-Control: must-revalidate
Content-Base: rtsp://URL:PORT/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif/
Content-Length: 1317
Content-Type: application/sdp
X-Accept-Dynamic-Rate: 1

v=0
o=- 2273421142 2273421142 IN IP4 0.0.0.0
s=Media Server
c=IN IP4 0.0.0.0
t=0 0
a=control:*
a=packetization-supported:DH
a=rtppayload-supported:DH
a=range:npt=now-
a=x-packetization-supported:IV
a=x-rtppayload-supported:IV
m=video 0 RTP/AVP 96
a=control:trackID=0
a=framerate:15.000000
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=64002A;sprop-parameter-sets=Z2QAKqwsaoHgCJ+WbgoCCoAAAAMAgAAAD0IA,aO4xshsA
a=recvonly
m=audio 0 RTP/AVP 8
a=control:trackID=1
a=rtpmap:8 PCMA/8000
a=recvonly
m=application 0 RTP/AVP 107
a=control:trackID=4
a=rtpmap:107 vnd.onvif.metadata/90000
a=recvonly
m=audio 0 RTP/AVP 116 115 114 113 112 111 110 109 108 97 107 106 105 104 0 103 102 101 100 8
a=control:trackID=5
a=rtpmap:116 MPEG4-GENERIC/64000
a=rtpmap:115 MPEG4-GENERIC/48000
a=rtpmap:114 MPEG4-GENERIC/32000
a=rtpmap:113 MPEG4-GENERIC/16000
a=rtpmap:112 MPEG4-GENERIC/8000
a=rtpmap:111 G726-40/64000
a=rtpmap:110 G726-40/48000
a=rtpmap:109 G726-40/32000
a=rtpmap:108 G726-40/16000
a=rtpmap:97 G726-40/8000
a=rtpmap:107 PCMU/64000
a=rtpmap:106 PCMU/48000
a=rtpmap:105 PCMU/32000
a=rtpmap:104 PCMU/16000
a=rtpmap:0 PCMU/8000
a=rtpmap:103 PCMA/16000
a=rtpmap:102 PCMA/32000
a=rtpmap:101 PCMA/48000
a=rtpmap:100 PCMA/64000
a=rtpmap:8 PCMA/8000
 =sendonly

When connecting to the "normal" URL the SDP changes to something compatible:
rtsp://URL:PORT/cam/realmonitor?channel=1&subtype=0

v=0
o=- 2273415430 2273415430 IN IP4 0.0.0.0
s=Media Server
c=IN IP4 0.0.0.0
t=0 0
a=control:*
a=packetization-supported:DH
a=rtppayload-supported:DH
a=range:npt=now-
a=x-packetization-supported:IV
a=x-rtppayload-supported:IV
m=video 0 RTP/AVP 96
a=control:trackID=0
a=framerate:15.000000
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=64002A;sprop-parameter-sets=Z2QAKqwsaoHgCJ+WbgoCCoAAAAMAgAAAD0IA,aO4xshsA
a=recvonly
m=audio 0 RTP/AVP 8
a=control:trackID=1
a=rtpmap:8 PCMA/8000
a=recvonly
m=audio 0 RTP/AVP 8
a=control:trackID=5
a=rtpmap:8 PCMA/8000
 =sendonly

Should gortsplib be compatible with the first SDP, or is this an issue on the camera itself?

Many thanks!

Hello, the issue here is that those audio codecs should also come with a config parameter that provides additional information:

a=rtpmap:116 MPEG4-GENERIC/64000
a=rtpmap:115 MPEG4-GENERIC/48000
a=rtpmap:114 MPEG4-GENERIC/32000
a=rtpmap:113 MPEG4-GENERIC/16000
a=rtpmap:112 MPEG4-GENERIC/8000

but they do not. I'll see what i can do about it.

I have another error for avigilon cameras. Streams do setup properly, however when establishing the backchannel. I have the following.

invalid SDP: sdp: invalid syntax c=SM SM spk0_trackID3

Wireshark:

Screenshot 2024-01-11 at 16 27 06

On an Hikvision wireshark would look like this. I guess the current SDP formatter doesn't like the order or SM attribute.

Screenshot 2024-01-11 at 16 44 50