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

invalid SDP: media 4 is invalid: config is missing #479

Open
fjfeijoo opened this issue Dec 5, 2023 · 3 comments
Open

invalid SDP: media 4 is invalid: config is missing #479

fjfeijoo opened this issue Dec 5, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@fjfeijoo
Copy link

fjfeijoo commented Dec 5, 2023

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!

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

aler9 commented Dec 16, 2023

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.

@cedricve
Copy link
Contributor

cedricve commented Jan 11, 2024

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

@cedricve
Copy link
Contributor

cedricve commented Jan 11, 2024

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

aler9 added a commit that referenced this issue Jan 14, 2024
…501)

* fixing issue for SDP avigilon when activating onvif backchannel

* keep track of original issue

* prevent deletion of first c=

* add tests

---------

Co-authored-by: aler9 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants