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 media description 'metadata'

svk23 opened this issue · comments

We are trying to record a RTSP stream using Media-MTX, but an error is thrown due to an invalid media description field with the value: 'metadata':

2023/12/01 13:23:42 ERR [path test] [RTSP source] invalid SDP: sdp: invalid value `metadata`

The SDP response contains the following section:

m=metadata 0 RTP/AVP 98
c=IN IP4 0.0.0.0
b=AS:1000
a=rtpmap:98 METADATA/90000
a=control:track2
a=x-onvif-track:track2
a=x-bufferdelay:1.000000

The sdp.go only the values described in RFC 4566 are allowed and therefore the error is thrown and the stream is not valid. If we add the value metadata to sdp.go the stream is recorded as intended. Would it be possible to add this value, or if not: could you let us know if it is save to add the value even though its not specified in the RFC? Our change looks something like this:

// <media>
// Set according to currently registered with IANA
// https://tools.ietf.org/html/rfc4566#section-5.14
if fields[0] != "video" &&
	fields[0] != "audio" &&
	fields[0] != "application" &&
	fields[0] != "metadata" &&
	!strings.HasPrefix(fields[0], "application/") {
	return fmt.Errorf("%w `%v`", errSDPInvalidValue, fields[0])
}

Hello, the SDP parser can be adjusted to support the text you provided, but can you write the manufacturer and the model of the device (camera or NVR) that is generating it?

I believe this example came from an (older) UDP Technology dome camera, but I am unsure about the exact model.

Fixed with #478

Adapted Media-MTX to use gortsplib v4.6.1 and tested with the UDP technology cameras. The streams are accepted and recorded as expected. Thanks for the quick fix!