Posted in: RTP, SDP

SDP 描述文件解析

SDP File

本文细致解析媒体中使用的RTP视频传输的SDP描述文件,解读SDP文件中各个字段的意思和示例,希望能够帮助大家理解SDP描述文件。所有的解析基于RFC和SMPTE标准。

1. SDP header SDP头文件

Example

v=0 ..............................→  v=  (protocol version),书写格式v=<version>
o=- 123456 11 IN IP4 192.168.100.2..............................→ o=  (originator and session identifier),书写格式o=<username> <session id> <version> <network type> <address type> <address>,这里表示session ID = 123456, session version of 11,IN表Internet,IP4表IPv4
s=Example of a SMPTE ST2110-20 signal.....................→ s=  (session name),书写格式s=<session name>, 这里表示session name
i=this example is for 720p video at 59.94........................→ i=* (session information),这里表示additional session information
t=0 0..........................→ t=  (time the session is active),书写格式t=<start time> <stop time>, 0表示没有边界, 这里表示session is permanent

2. Stream info

  • SDP file has all stream information: Address, UDP port and iGMP source for primary and secondary streams as well as the payload type

Example

v=0
o=- 123456 11 IN IP4 192.168.100.2
s=Example of a SMPTE ST2110-20 signal
i=this example is for 720p video at 59.94
t=0 0

a=recvonly .......................... → a=* (zero or more session attribute lines), 这里是定义Session属性
a=group:DUP primary secondary..............................→ 这里表示主备流
m=video 50000 RTP/AVP 112.................................→ m=  (media name and transport address),书写格式m=<media> <port> <transport> <fmt list>,其中<media>=video|audio (ANC is video);<port>=IP port;<transport>=Transport protocol;<fmt list>=Payload Type format list.这里表示视频流的UDP端口为50000,通过RTP/AVP协议传输且Payload类型是112
c=IN IP4 239.100.9.10/32.............................. → c=* (connection information - optional if included at session-level),书写格式c=<network type> <address type> <connection address>其中<network type>=IN(ternet);<address type>=IP4 | IP6;<connection address>=<IP address>/TTL.这里表示Stream address is 239.100.9.10,TTL为32
a=source-filter:incl IN IP4 239.100.9.10 192.168.100.2..................... → filter-source attribute,书写格式a=source-filter: <filter-mode> <filter-spec>其中
<filter-mode>=excl | incl;<filter-spec>=<nettype> <address-types> <dest-address> <src-list>再其中<address-types> = IP4 | IP6 | *.这里表示流来自组播组239.100.9.10且组播源192.168.100.2
a=rtpmap:112 raw/90000 ..................... → payload type attribute,书写格式a=rtpmap:<payload type> <encoding name>/<clock rate>[/<encoding parameters>],这里表示payload类型112,编码方式raw,时钟速率90000
a=fmtp:112 sampling=YCbCr-4:2:2; width=1280; height=720; exactframerate=60000/1001; depth=10; TCS=SDR; colorimetry=BT709; PM=2110GPM; SSN=ST2110-20:2017; TP=2110TPN ..................... → payload format attribute,书写格式a=fmtp:<format> <format specific parameters>其中<format>=Payload Type format;<format specific parameters>=*.这里表示payload类型112,且格式参数为。。。
a=ts-refclk:ptp=IEEE1588-2008:39-A7-94-FF-FE-07-CB-D0:37 ....................................→ clock reference source attribute书写格式a=ts-refclk:<clksrc>
包括类型session level: a=ts-refclk:<clksrc>或者source level : a=ssrc:<ssrc-id> 或者media Level:ts-refclk:<clksrc>这里表示Stream is locked on PTP, grand master ID = 39-A7-94-FF-FE-07-CB-D0, Domain = 37
a=mediaclk:direct=0................................... → media clock attribute,书写格式a=mediaclk:sender | a=mediaclk:direct[=<offset>] [rate=<rate numerator>/<rate denominator>],这里表示No media clock offset value
a=mid:primary....................................→ 这里表示This was primary stream description
m=video 50020 RTP/AVP 112.........................................................................................→ Stream UDP port is 50020 and Payload type is 112
c=IN IP4 239.101.9.10/32................................................................................................→ Stream address is 239.101.9.10
a=source-filter:incl IN IP4 239.101.9.10 192.168.101.2................................................. → Stream is coming from port 192.168.101.2
a=rtpmap:112 raw/90000
a=fmtp:112 sampling=YCbCr-4:2:2; width=1280; height=720; exactframerate=60000/1001; depth=10; TCS=SDR; colorimetry=BT709; PM=2110GPM; SSN=ST2110-20:2017; TP=2110TPN
a=ts-refclk:ptp=IEEE1588-2008:39-A7-94-FF-FE-07-CB-D0:37.....................................→ Stream is locked on PTP (Standard revision and Master ID) ???
a=mediaclk:direct=0 .......................................................................................................→ media clock attribute,书写格式a=mediaclk:sender | a=mediaclk:direct[=<offset>] [rate=<rate numerator>/<rate denominator>],这里表示No media clock offset value
a=mid:secondary.............................................................................................................→ This was secondary stream description

2.1. Reference clock

  • SDP file has to specify ts-refclk attribute. Refer to IETF RFC 7273 section 4
  • We are always reference to PTP : ts-refclk:ptp=IEEE1588-2008:grand master clock identity:domain
PTP SDP Example
Locked PTP : ts-refclk:ptp=IEEE1588-2008:grand master clock identity:domain a=ts-refclk:ptp=IEEE1588-2008: 39-A7-94-FF-FE-07-CB-D0:37
Not Locked a=ts-refclk:localmac=card mac address a=ts-refclk:localmac=24-8A-07-11-4C-9C

2.2. media clock

  • SDP file has to specify media-level mediaclock attribute with the direct reference. Refer to IETF RFC 7273 section 5.2.
  • Media senders are always : mediaclk:direct=0

2.3. Redundancy

  • SDP file groups primary and secondary streams. Refer to [SMPTE 2110-10 8.3]
  • Here are redundancy requirement for [SMPTE 2110-10 8.3]

Redundant streams shall not use both identical source addresses and identical destination addresses at the same time. Note: SMPTE ST 2022-7 allows the above methods of specifying duplicate RTP streams, but also allows for RTP streams with duplicated source and destination addresses (on separate physical networks); such a mechanism cannot be represented with SDP, and therefore the use of duplicate source and destination addresses is not supported by this Standard.

3. Video

  • Here is how video is detailed on SDP file :

Example

v=0
o=- 123456 11 IN IP4 192.168.100.2..............................................→based on RFC4566 5.2 (look at privacy issue) we will report 0.0.0.0
s=Example of a SMPTE ST2110-20 signal
i=this example is for 720p video at 59.94
t=0 0

m=video 50000 RTP/AVP 112
c=IN IP4 239.100.9.10/32
a=source-filter:incl IN IP4 239.100.9.10 192.168.100.2
a=rtpmap:112 raw/90000..................................→ This stream is video
a=fmtp:112 sampling=YCbCr-4:2:2; width=1280; height=720; exactframerate=60000/1001; depth=10; TCS=SDR; colorimetry=BT709; PM=2110GPM; SSN=ST2110-20:2017; TP=2110TPN......................→ 4:2:2, 720p59Hz, 10-bit, SDR BT.709, General packing mode (PM), compliant to ST 2110-20:2017 (SSN) and the sender type is narrow (TP)
a=ts-refclk:ptp=IEEE1588-2008:39-A7-94-FF-FE-07-CB-D0:37
a=mediaclk:direct=0

3.1. Video format

  • SDP file has to specify sampling : YCbCr-4:2:2. Refer to [SMPTE ST 2110-20, 7.4.1]
  • SDP file has to specify video format : width, height and extractframerate. Refer to [SMPTE ST 2110-20, 7.2]
  • SDP file has to specify number of bit per sample : depth. Refer to [SMPTE ST 2110-20, 7.4.2]
  • Here is the SDP description for supported formats
Video Format SDP
3840x2160p 59Hz sampling=YCbCr-4:2:2; width=3840; height=2160; exactframerate=60000/1001; depth=10
3840x2160p 50Hz sampling=YCbCr-4:2:2; width=3840; height=2160; exactframerate=50; depth=10
1920x1080p 59Hz sampling=YCbCr-4:2:2; width=1920; height=1080; exactframerate=60000/1001; depth=10
1920x1080p 50Hz sampling=YCbCr-4:2:2; width=1920; height=1080; exactframerate=50; depth=10
1920x1080i 59Hz sampling=YCbCr-4:2:2; width=1920; height=1080; exactframerate=30000/1001; interlaced; depth=10
1920x1080i 50Hz sampling=YCbCr-4:2:2; width=1920; height=1080; exactframerate=25; interlaced; depth=10
1280x720p 59Hz sampling=YCbCr-4:2:2; width=1280; height=720; exactframerate=60000/1001; depth=10
1280x720p 50Hz sampling=YCbCr-4:2:2; width=1280; height=720; exactframerate=50; depth=10

3.2. HDR

  • SDP file has to specify Transfer Characteristic System TCS : SDR, HLG, PQ…Refer to [SMPTE ST 2110-20, 7.6]
  • SDP file has to specify encoding range RANGE : FULL, NARROW. if the parameter is absent we assume NARROW. Refer to [SMPTE ST 2110-20, 7.3]
  • SDP file has to specify Colorimetry: BT709, BT2020…Refer to [SMPTE ST 2110-20, 7.5]
  • Here is the SDP file behavior on HDR processing.
Enable Processing IS-05 Output Range SDP Sender Comments
TCS= RANGE= colorimetry=
ON BT.709 to BT.2020 Active Ignored Incoming SDP File Incoming SDP File BT2020;
Not active Ignored Unspecified; NARROW; Unspecified; LIMITATION : We don’t know incoming information!!!! HDR Phase 3 is required
BT.2020 to BT.709 Active Ignored Incoming SDP File Incoming SDP File BT709;
Not active Ignored Remove field Remove field BT709;
SDR to HLG BT.2100 Ignored Ignored HLG; NARROW; BT2020;
HLG BT.2100 to SDR Ignored Ignored SDR; NARROW; BT709;
SDR to PQ BT.2100 Ignored Narrow PQ; NARROW; BT2020;
Ignored Full PQ; FULL; BT2020;
PQ BT.2100 to SDR Ignored Ignored SDR; NARROW; BT709;
PQ BT.2100 to HLG BT.2100 Ignored Ignored HLG; NARROW; BT2020;
HLG BT.2100 to PQ BT.2100 Ignored Ignored PQ; NARROW; BT2020;
S-Log3 S-Gamut3 to BT.709 800% Ignored Ignored SDR; NARROW; BT2020;
S-Log3 S-Gamut3 to HLG BT.2100 Ignored Ignored HLG; NARROW; BT2020;
S-Log3 S-Gamut3 to PQ BT.2100 Ignored Ignored PQ; NARROW; BT2020;
OFF Ignored Active Ignored Incoming SDP File Incoming SDP File Incoming SDP File
Not Active Ignored Unspecified; NARROW; Unspecified; LIMITATION : We don’t know incoming information!!!! HDR Phase 3 is required

3.3. Packing Mode

  • Refer to [SMPTE ST 2110-20, 6.3.2 & 6.3.3]
  • We support general packet mode: PM=2110PGM or
  • We support block packing mode: PM=2110BPM ?

3.4. Sender Type

  • Refer to SMPTE ST 2110-21, 7.1
  • We support narrow sender: TP=2110TPN

4. Audio

  • Here is how audio is detailed on SDP file :

Example

v=0
o=-1443716955 1443716955 IN IP4 192.201.205.29
s=st2110 0-1-0
t 0 0

m=audio 10000 RTP/AVP 97................................................→ This media stream is audio
c=IN IP4 239.201.29.30/64
a= source-filter: inc1 IN IP4 239.201.29.30 192.168.0.1
a= rtpmap:97 L24/48000/2...................................................→ PCM at 48kHz, 2 ch
a=framecount:48..................................................................→ ??? related to packet time.
a=prime:1.............................................................................→ packet time is 1 msec
a=ts-refclk:ptp=IEEE1588-208:ec-46-70-ff-fe-00-7e-a4:127
a=mediaclk:direct=0

4.1. Channel number

  • SDP File has to specify audio channel number using a=rtpmap field : a= rtpmap:97 L24/48000/<nchan>

4.2. PCM/non-PCM

  • SDP file has to specify if the audio is PCM or non-PCM on a=rtpmap field
Audio type SDP Sender
SMPTE 2110-30 a= rtpmap: L24/48000/
SMPTE 2110-31 a= rtpmap: AM824/48000/

4.3. Packet time

  • SDP file has to specify packet time with ptime attribute
Packet Time SDP Sender
1 msec a=prime:1
125 usec a=prime:0.125

5. Metadata

  • Here is how metadata is detailed on SDP file :

Example

v=0
o=- 2846184233 0 IN IP4 192.99.99.98
s=server97 Output 1 (SMPTE ST 2110)
t=0 0
m=video 10000 RTP/AVP 100
c=IN IP4 239.97.1.40/64
a=source-filter:incl IN IP4 239.97.1.40 192.99.99.98
a=rtpmap:100 smpte291/90000................................................→ This media stream is metadata
a=fmtp:100 VPID_Code=133....................................................→ VPID_Code is not mandatory
a=ts-refclk:ptp=IEEE1588-208:ec-46-70-ff-fe-00-7e-a4:127
a=mediaclk:direct=0

6. JPEG-XS on ST 2110-22

Example

v=0
o=- 384827392 1 IN IP4 192.41.48.2
s=ipMultiChTx0_SNDR_PAIR_ST2110-22_6
i=session description
t=0 0
a=recvonly
a=group:DUP primary secondary
m=video 10000 RTP/AVP 112
c=IN IP4 238.41.48.3/32
b=AS:2068821 .................→ b=* (zero or more bandwidth information lines),这里表示bandwidth
a=source-filter: incl IN IP4 238.41.48.3 192.41.48.2
a=rtpmap:112 jxsv/90000...................→ This media stream is jpegxs
a=fmtp:112 RANGE=FULL;TCS=PQ;TP=2110TPNL;colorimetry=BT2100;exactframerate=60000/1001;height=2160;transmode=1;width=3840............→ transmode = 1 : This parameter specifies the configured transmission mode as defined by the Transmission mode (T) bit in the payload header of Section 4.3. This value SHALL be equal to the T bit value configured in the RTP stream (i.e. 0 for out-of-orderallowed or 1 for sequential).If T=1, packets SHALL be sent sequentially by the transmitter.
a=ts-refclk:ptp=IEEE1588-2008:08-00-11-FF-FE-22-04-00:127
a=mediaclk:direct=0
a=mid:primary
m=video 10000 RTP/AVP 112
c=IN IP4 238.41.22.3/32
b=AS:2068821
a=source-filter: incl IN IP4 238.41.22.3 192.41.22.2
a=rtpmap:112 jxsv/90000
a=fmtp:112 RANGE=FULL;TCS=PQ;TP=2110TPNL;colorimetry=BT2100;exactframerate=60000/1001;height=2160;transmode=1;width=3840
a=ts-refclk:ptp=IEEE1588-2008:08-00-11-FF-FE-22-04-00:127
a=mediaclk:direct=0
a=mid:secondary

参考:RFC-4566中的定义

    Session description
         v=  (protocol version)
         o=  (originator and session identifier)
         s=  (session name)
         i=* (session information)
         u=* (URI of description)
         e=* (email address)
         p=* (phone number)
         c=* (connection information -- not required if included in
              all media)
         b=* (zero or more bandwidth information lines)
         One or more time descriptions ("t=" and "r=" lines; see below)
         z=* (time zone adjustments)
         k=* (encryption key)
         a=* (zero or more session attribute lines)
         Zero or more media descriptions

      Time description
         t=  (time the session is active)
         r=* (zero or more repeat times)

      Media description, if present
         m=  (media name and transport address)
         i=* (media title)
         c=* (connection information -- optional if included at
              session level)
         b=* (zero or more bandwidth information lines)
         k=* (encryption key)
         a=* (zero or more media attribute lines)

Mellanox CX-5的SDP示例

参考:RFC-2327中的定义

参考:RFC-7273中的定义

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to Top