SDP 协议分析

一、SDP协议介绍

SDP 完全是一种会话描述格式 ― 它不属于传输协议 ― 它只使用不同的适当的传输协议,包括会话通知协议(SAP)、会话初始协议(SIP)、实时流协议(RTSP)、MIME 扩展协议的电子邮件以及超文本传输协议(HTTP)。SDP协议是也是基于文本的协议,这样就能保证协议的可扩展性比较强,这样就使其具有广泛的应用范围。SDP 不支持会话内容或媒体编码的协商,所以在流媒体中只用来描述媒体信息。媒体协商这一块要用RTSP来实现.

二、SDP协议格式

SDP描述由许多文本行组成,文本行的格式为<类型>=<值>,<类型>是一个字母,<值>是结构化的文本串,其格式依<类型>而定。

<type>=<value>[CRLF]

常见的fields有:

SDP 协议分析_资料

SDP 协议分析_产品_02

SDP 协议分析_产品_03

三、SDP协议例子:

下面是一个helix 流媒体服务器的RTSP协议中的SDP协议:

v=0 //SDP version

// o field定义的源的一些信息。其格式为:o=<username> <sess-id> <sess-version> <nettype> <addrtype> <unicast-address>

o=- 1271659412 1271659412 IN IP4 10.56.136.37 s=<No title>

i=<No author> <No copyright> //session的信息

c=IN IP4 0.0.0.0 //connect 的信息,分别描述了:网络协议,地址的类型,连接地址。

c=IN IP4 0.0.0.0

t=0 0 //时间信息,分别表示开始的时间和结束的时间,一般在流媒体的直播的时移中见的比较多。

a=SdpplinVersion:1610641560 //描述性的信息

a=StreamCount:integer;2 //用来描述媒体流的信息,表示有两个媒体流。integer表示信息的格式为整数。

a=control:*

a=DefaultLicenseValue:integer;0 //License信息

a=FileType:string;"MPEG4" ////用来描述媒体流的信息说明当前协商的文件是mpeg4格式的文件

a=LicenseKey:string;"license.Summary.Datatypes.RealMPEG4.Enabled"

a=range:npt=0-72.080000 //用来表示媒体流的长度

m=audio 0 RTP/AVP 96 //做为媒体描述信息的重要组成部分描述了媒体信息的详细内容:表示session的audio是通过RTP来格式传送的,其payload值为96传送的端口还没有定。

b=as:24 //audio 的bitrate

b=RR:1800

b=RS:600

a=control:streamid=1 //通过媒体流1来发送音频

a=range:npt=0-72.080000 //说明媒体流的长度。

a=length:npt=72.080000

a=rtpmap:96 MPEG4-GENERIC/32000/2 //rtpmap的信息,表示音频为AAC的其sample为32000

a=fmtp:96 profile-level-id=15;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1210 //config为AAC的详细格式信息

a=mimetype:string;"audio/MPEG4-GENERIC"

a=Helix-Adaptation-Support:1

a=AvgBitRate:integer;48000

a=HasOutOfOrderTS:integer;1

a=MaxBitRate:integer;48000

a=Preroll:integer;1000

a=OpaqueData:buffer;"A4CAgCIAAAAEgICAFEAVABgAAAC7gAAAu4AFgICAAhKIBoCAgAEC"

a=StreamName:string;"Audio Track"

下面是video的信息基本和audio的信息相对称,这里就不再说了。

m=video 0 RTP/AVP 97

b=as:150

b=RR:11250

b=RS:3750

a=control:streamid=2

a=range:npt=0-72.080000

a=length:npt=72.080000

a=rtpmap:97 MP4V-ES/2500

a=fmtp:97 profile-level-id=1;

a=mimetype:string;"video/MP4V-ES"

a=Helix-Adaptation-Support:1

a=AvgBitRate:integer;300000

a=HasOutOfOrderTS:integer;1

a=Height:integer;240 //影片的长度

a=MaxBitRate:integer;300000

a=MaxPacketSize:integer;1400

a=Preroll:integer;1000

a=Width:integer;320 //影片的宽度

a=OpaqueData:buffer;"AzcAAB8ELyARAbd0AAST4AAEk+AFIAAAAbDzAAABtQ7gQMDPAAABAAAAASAAhED6KFAg8KIfBgEC"

a=StreamName:string;"Video Track"

 

 

 

 

RTP/AVP audio and video payload types

2270人阅读评论(0)收藏举报

audiovideotypesh.264encodingcodec

Payload type (PT)NameTypeNo. of channelsClock rate (Hz)DescriptionReferences
0PCMUaudio18000ITU-T G.711 PCM-Law Audio 64 kbit/sRFC 3551
1reserved (previously 1016)audio18000reserved, previously CELP Audio 4.8 kbit/sRFC 3551, previouslyRFC 1890
2reserved (previously G721)audio18000reserved, previously ITU-T G.721 ADPCM Audio 32 kbit/sRFC 3551, previouslyRFC 1890
3GSMaudio18000European GSM Full Rate Audio 13 kbit/s (GSM 06.10)RFC 3551
4G723audio18000ITU-T G.723.1RFC 3551
5DVI4audio18000IMAADPCM Audio 32 kbit/sRFC 3551
6DVI4audio116000IMAADPCM 64 kbit/sRFC 3551
7LPCaudio18000Experimental Linear Predictive Coding AudioRFC 3551
8PCMAaudio18000ITU-T G.711 PCM A-Law Audio 64 kbit/sRFC 3551
9G722audio18000ITU-T G.722 AudioRFC 3551 - Page 14
10L16audio244100Linear PCM 16-bit Stereo Audio 1411.2 kbit/s,[2][3][4] uncompressedRFC 3551, Page 27
11L16audio144100Linear PCM 16-bit Audio 705.6 kbit/s, uncompressedRFC 3551, Page 27
12QCELPaudio18000Qualcomm Code Excited Linear PredictionRFC 2658,RFC 3551
13CNaudio18000Comfort noiseRFC 3389
14MPAaudio190000MPEG-1 or MPEG-2 Audio OnlyRFC 3551,RFC 2250
15G728audio18000ITU-T G.728 Audio 16 kbit/sRFC 3551
16DVI4audio111025IMAADPCMRFC 3551
17DVI4audio122050IMA ADPCMRFC 3551
18G729audio18000ITU-T G.729 and G.729aRFC 3551, Page 20
25CELBvideo190000Sun's CellB Video Encoding[5]RFC 2029
26JPEGvideo190000JPEG VideoRFC 2435
28NVvideo190000Xerox PARC's Network Video (nv)[6]RFC 3551, Page 32
31H261video190000ITU-T H.261 VideoRFC 4587
32MPVvideo190000MPEG-1 and MPEG-2 VideoRFC 2250
33MP2Taudio/video190000MPEG-2 transport stream VideoRFC 2250
34H263video90000H.263 video, first version (1996)RFC 3551,RFC 2190
dynamicH263-1998video90000H.263 video, second version (1998)RFC 3551,RFC 4629,RFC 2190
dynamicH263-2000video90000H.263 video, third version (2000)RFC 4629
dynamic (or profile)H264video90000H.264 video (MPEG-4 Part 10)RFC 3984
dynamic (or profile)theoravideo90000Theora videodraft-barbato-avt-rtp-theora-01
dynamiciLBCaudio1Internet low Bitrate Codec 13.33 or 15.2 kbit/sRFC 3951
dynamicPCMA-WBaudio16000ITU-T G.711.1, A-lawRFC 5391
dynamicPCMU-WBaudio16000ITU-T G.711.1, -lawRFC 5391
dynamicG718audio32000ITU-T G.718draft-ietf-avt-rtp-g718-03
dynamicG719audio(various)48000ITU-T G.719RFC 5404
dynamicG7221audio16 or 32 kHzITU-T G.722.1RFC 5577
dynamicG726-16audio18000ITU-T G.726 audio with 16 kbit/sRFC 3551
dynamicG726-24audio18000ITU-T G.726 audio with 24 kbit/sRFC 3551
dynamicG726-32audio18000ITU-T G.726 audio with 32 kbit/sRFC 3551
dynamicG726-40audio18000ITU-T G.726 audio with 40 kbit/sRFC 3551
dynamicG729Daudio18000ITU-T G.729 Annex DRFC 3551
dynamicG729Eaudio18000ITU-T G.729 Annex ERFC 3551
dynamicG7291audio(various)ITU-T G.729.1RFC 4749
dynamicGSM-EFRaudio18000ITU-T GSM-EFR (GSM 06.60)RFC 3551
dynamicGSM-HR-08audio18000ITU-T GSM-HR (GSM 06.20)RFC 5993
dynamic (or profile)AMRaudio(various)8000Adaptive Multi-Rate audioRFC 4867
dynamic (or profile)AMR-WBaudio(various)16000Adaptive Multi-Rate Wideband audio (ITU-T G.722.2)RFC 4867
dynamic (or profile)AMR-WB+audio1, 2 or omit72000Extended Adaptive Multi Rate – WideBand audioRFC 4352
dynamic (or profile)vorbisaudio(various)from 8 kHz to 192 kHzRTP Payload Format for Vorbis Encoded AudioRFC 5215
dynamic (or profile)speexaudio18000, 16000 or 32000RTP Payload Format for the Speex CodecRFC 5574
dynamic (96-127)mpa-robustaudio90000A More Loss-Tolerant RTP Payload Format for MP3 AudioRFC 5219
dynamic (or profile)MP4A-LATMaudio90000 or othersRTP Payload Format for MPEG-4 AudioRFC 3016
dynamic (or profile)MP4V-ESvideo90000 or othersRTP Payload Format for MPEG-4 VisualRFC 3016
dynamic (or profile)mpeg4-genericaudio/video90000 or otherRTP Payload Format for Transport of MPEG-4 Elementary StreamsRFC 3640
dynamicL8audio(various)(various)Linear PCM 8-bit audio with 128 offsetRFC 3551 Section 4.5.10 and Table 5
dynamicDAT12audio(various)8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000 or othersIEC 61119 12-bit nonlinear audioRFC 3190 Section 3
dynamicL16audio(various)8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000 or othersLinear PCM 16-bit audioRFC 3551 Section 4.5.11,RFC 2586
dynamicL20audio(various)8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000 or othersLinear PCM 20-bit audioRFC 3190 Section 4
dynamicL24audio(various)8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000 or othersLinear PCM 24-bit audioRFC 3190 Section 4