流媒体相关内容总结.docx
- 文档编号:7323781
- 上传时间:2023-01-22
- 格式:DOCX
- 页数:19
- 大小:106.63KB
流媒体相关内容总结.docx
《流媒体相关内容总结.docx》由会员分享,可在线阅读,更多相关《流媒体相关内容总结.docx(19页珍藏版)》请在冰豆网上搜索。
流媒体相关内容总结
流媒体相关内容总结
1RTSP协议
RTSP(RealTimeStreamProtocol,实时流协议[RFC2326])是研究如何有效地在IP网络上传输流媒体数据的应用层协议。
RTSP的消息有两大类,一是请求消息(request),一是回应消息(response),两种消息的格式不同.
请求消息:
方法 URI RTSP版本 CRLF
消息头 CRLF CRLF
消息体 CRLF
回应消息:
RTSP版本状态码解释 CRLF
消息头 CRLF CRLF
消息体 CRLF
其中RTSP版本一般都是RTSP/,状态码是一个数值,200表示成功,解释是与状态码对应的文本解释。
流媒体服务器
WindowsMediaServer:
支持mms协议
HelixServer:
推送协议为私有协议,播放协议使用RTSP
DarvinStreamingServer:
支持RTSP推送和播放。
如果是点播播放,本地文件需要索引化。
SDP格式
sdp的格式
v=
o=
s=
i=
u=
e=
p=
c=
b=
t=
r=
z=
k=
k=
a=
a=
m=
v=(协议版本)
o=(所有者/创建者和会话标识符)
s=(会话名称)
i=* (会话信息)
u=*(URI描述)
e=*(Email地址)
p=*(电话号码)
c=*(连接信息)
b=*(带宽信息)
z=*(时间区域调整)
k=*(加密密钥)
a=*(0个或多个会话属性行)
时间描述:
t=(会话活动时间)
r=*(0或多次重复次数)
媒体描述:
m=(媒体名称和传输地址)
i=*(媒体标题)
c=*(连接信息—如果包含在会话层则该字段可选)
b=*(带宽信息)
k=*(加密密钥)
a=*(0个或多个媒体属性行)
例子
以AAC推送流为例。
具体代码:
DeviceHandler/AACHandler&&StreamSender
1.3.1推送过程
[2009-12-299:
58:
02:
234]
ANNOUNCErRTSP/
CSeq:
46
Content-Type:
application/sdp
Content-Length:
303
v=0
o=streamsender00INIP40.0.0.0
c=INIP4v2.4a6
m=audio0RTP/AVP96
a=control:
trackID=0
a=rtpmap:
96mpeg4-generic/44100/2
a=fmtp:
96streamtype=5;profile-level-id=15;mode=AAC-hbr;config=1210;SizeLength=13;IndexLength=3;IndexDeltaLength=3;
a=mpeg4-esid:
101
[2009-12-299:
58:
02:
265]
RTSP/200OK
Server:
DSS/5.5.5(Build/;Platform/Win32;Release/Darwin;state/beta;)
Cseq:
46
[2009-12-299:
58:
02:
265]
SETUPrRTSP/
CSeq:
47
Transport:
RTP/AVP/TCP;unicast;mode=record;interleaved=0-1
[2009-12-299:
58:
02:
265]
RTSP/200OK
Server:
DSS/5.5.5(Build/;Platform/Win32;Release/Darwin;state/beta;)
Cseq:
47
Cache-Control:
no-cache
Session:
14
Date:
Tue,29Dec200901:
58:
17GMT
Expires:
Tue,29Dec200901:
58:
17GMT
Transport:
RTP/AVP/TCP;unicast;mode=record;interleaved=0-1
[2009-12-299:
58:
02:
265]
RECORDrRTSP/
CSeq:
48
Session:
14
[2009-12-299:
58:
02:
281]
RTSP/200OK
Server:
DSS/5.5.5(Build/;Platform/Win32;Release/Darwin;state/beta;)
Cseq:
48
Session:
14
RTP-Info:
url=r1.3.2播放过程
[2009-12-299:
58:
47:
765]
OPTIONSrRTSP/
CSeq:
6
User-Agent:
VLCmediaplayer(LIVE555StreamingMedia9:
58:
47:
765]
RTSP/200OK
Server:
DSS/5.5.5(Build/;Platform/Win32;Release/Darwin;state/beta;)
Cseq:
6
Public:
DESCRIBE,SETUP,TEARDOWN,PLAY,PAUSE,OPTIONS,ANNOUNCE,RECORD
[2009-12-299:
58:
47:
765]
DESCRIBErRTSP/
CSeq:
7
Accept:
application/sdp
User-Agent:
VLCmediaplayer(LIVE555StreamingMedia9:
58:
47:
765]
RTSP/200OK
Server:
DSS/5.5.5(Build/;Platform/Win32;Release/Darwin;state/beta;)
Cseq:
7
Cache-Control:
no-cache
Content-length:
341
Date:
Tue,29Dec200901:
59:
02GMT
Expires:
Tue,29Dec200901:
59:
02GMT
Content-Type:
application/sdp
x-Accept-Retransmit:
our-retransmit
x-Accept-Dynamic-Rate:
1
Content-Base:
r00INIP40.0.0.0
s=\
c=INIP40.0.0.0
t=00
a=tool:
sdrv2.4a6
a=control:
*
m=audio0RTP/AVP96
a=control:
trackID=0
a=rtpmap:
96mpeg4-generic/44100/2
a=fmtp:
96streamtype=5;profile-level-id=15;mode=AAC-hbr;config=1210;SizeLength=13;IndexLength=3;IndexDeltaLength=3;
a=mpeg4-esid:
101
[2009-12-299:
58:
47:
781]
SETUPrRTSP/
CSeq:
8
Transport:
RTP/AVP/TCP;unicast;interleaved=0-1
User-Agent:
VLCmediaplayer(LIVE555StreamingMedia9:
58:
47:
781]
RTSP/200OK
Server:
DSS/5.5.5(Build/;Platform/Win32;Release/Darwin;state/beta;)
Cseq:
8
Cache-Control:
no-cache
Session:
9
Date:
Tue,29Dec200901:
58:
17GMT
Expires:
Tue,29Dec200901:
58:
17GMT
Transport:
RTP/AVP/TCP;unicast;interleaved=0-1
[2009-12-299:
58:
47:
781]
PLAYrRTSP/
CSeq:
9
Session:
9
Range:
npt=
User-Agent:
VLCmediaplayer(LIVE555StreamingMedia9:
58:
47:
796]
RTSP/200OK
Server:
DSS/5.5.5(Build/;Platform/Win32;Release/Darwin;state/beta;)
Cseq:
9
Session:
9
Range:
npt=now-
RTP-Info:
url=rRTP协议
RTP(Real-timeTransportProtocol,实时传输协议[RFC1889]、[RFC3550]、[RFC3551]),它是由IETF的多媒体传输工作小组1996年在RFC1889中公布的。
RTP本身并没有提供按时发送机制或其它服务质量(QoS)保证,它依赖于低层服务去实现这一过程。
RTP并不保证传送或防止无序传送,也不确定底层网络的可靠性。
RTP实行有序传送,RTP中的序列号允许接收方重组发送方的包序列。
参考StreamSender项目。
/*tcp通道中传输rtp数据。
size:
4*/
struct_rtpTcpHead
{
u_int8symbol;
0001”3.1.18F
3.1.20IN0.0.0
c=INIP4v2.4a6
m=video554RTP/AVP96
a=control:
trackID=0
a=rtpmap:
96H264/90000
a=fmtp:
96packetization-mode=1;profile-level-id=42e014;sprop-parameter-sets=Z0LgFNoFglE=,aM4wpA==
a=mpeg4-esid:
201
a=Width:
integer;352
a=Height:
integer;288
a=framerate:
5
[2009-12-3015:
09:
45:
843]
RTSP/200OK
Server:
DSS/5.5.5(Build/;Platform/Win32;Release/Darwin;state/beta;)
Cseq:
1
[2009-12-3015:
09:
45:
875]
SETUPrRTSP/
CSeq:
2
Transport:
RTP/AVP/TCP;unicast;mode=record;interleaved=0-1
[2009-12-3015:
09:
45:
890]
RTSP/200OK
Server:
DSS/5.5.5(Build/;Platform/Win32;Release/Darwin;state/beta;)
Cseq:
2
Cache-Control:
no-cache
Session:
268
Date:
Wed,30Dec200907:
10:
00GMT
Expires:
Wed,30Dec200907:
10:
00GMT
Transport:
RTP/AVP/TCP;unicast;mode=record;interleaved=0-1
[2009-12-3015:
09:
45:
906]
RECORDrRTSP/
CSeq:
3
Session:
268
[2009-12-3015:
09:
45:
906]
RTSP/200OK
Server:
DSS/5.5.5(Build/;Platform/Win32;Release/Darwin;state/beta;)
Cseq:
3
Session:
268
RTP-Info:
url=r3.1.3播放过程
[2009-12-3015:
10:
30:
859]
OPTIONSrRTSP/
CSeq:
1
User-Agent:
VLCmediaplayer(LIVE555StreamingMedia15:
10:
30:
859]
RTSP/200OK
Server:
DSS/5.5.5(Build/;Platform/Win32;Release/Darwin;state/beta;)
Cseq:
1
Public:
DESCRIBE,SETUP,TEARDOWN,PLAY,PAUSE,OPTIONS,ANNOUNCE,RECORD
[2009-12-3015:
10:
30:
859]
DESCRIBErRTSP/
CSeq:
2
Accept:
application/sdp
User-Agent:
VLCmediaplayer(LIVE555StreamingMedia15:
10:
30:
875]
RTSP/200OK
Server:
DSS/5.5.5(Build/;Platform/Win32;Release/Darwin;state/beta;)
Cseq:
2
Cache-Control:
no-cache
Content-length:
364
Date:
Wed,30Dec200907:
10:
00GMT
Expires:
Wed,30Dec200907:
10:
00GMT
Content-Type:
application/sdp
x-Accept-Retransmit:
our-retransmit
x-Accept-Dynamic-Rate:
1
Content-Base:
r00INIP40.0.0.0
s=\
c=INIP40.0.0.0
t=00
a=tool:
sdrv2.4a6
a=control:
*
m=video0RTP/AVP96
a=control:
trackID=0
a=rtpmap:
96H264/90000
a=fmtp:
96packetization-mode=1;profile-level-id=42e014;sprop-parameter-sets=Z0LgFNoFglE=,aM4wpA==
a=mpeg4-esid:
201
a=Width:
integer;352
a=Height:
integer;288
a=framerate:
5
[2009-12-3015:
10:
30:
906]
SETUPrRTSP/
CSeq:
3
Transport:
RTP/AVP;unicast;client_port=2770-2771
User-Agent:
VLCmediaplayer(LIVE555StreamingMedia15:
10:
30:
921]
RTSP/200OK
Server:
DSS/5.5.5(Build/;Platform/Win32;Release/Darwin;state/beta;)
Cseq:
3
Cache-Control:
no-cache
Session:
309628
Date:
Wed,30Dec200907:
10:
45GMT
Expires:
Wed,30Dec200907:
10:
45GMT
Transport:
RTP/AVP;unicast;source=15:
10:
30:
921]
PLAYrRTSP/
CSeq:
4
Session:
309628
Range:
npt=
User-Agent:
VLCmediaplayer(LIVE555StreamingMedia15:
10:
30:
921]
RTSP/200OK
Server:
DSS/5.5.5(Build/;Platform/Win32;Release/Darwin;state/beta;)
Cseq:
4
Session:
309628
Range:
npt=now-
RTP-Info:
url=rMPEG4
MPEG4传输参考[RFC3016]、[RFC3640]两篇文档,其中,[RFC3016]支持“mp4V-ES”视频传输方式,还支持“mp4A-LATM”AAC音频传输方式,但是,据说它没有使用MPEG4的同步技术和流管理技术;[RFC3640]支持“mpeg4-generic”方式传输音视频,还支持传输其它的ES流,如系统流等。
MPEG4视频一般采用mp4V-ES方式,AAC一般采用mpeg4-generic方式。
图3-2MPEG4的RTP负载结构
图3-2是MPEG4的RTP负载结构,其中,AUHeaderLength是2字节长度,表示AUHeader的总位数,并且是网络字节序。
AUHeader包含一些可选的字段,长度不固定,包含字段具体在SDP头中指定。
如果AUHeader的总位数不是8的倍数,那么AUHeader最后要添加填充位,位值为0,这时AUHeaderLength长度不包括填充位的长度。
另外,[RFC3640]上面还指出“TheAuxiliarySection”段,因为这个段一般不用,所以没有考虑。
[RFC3640]“3.2.1.1TheAU-header”一节中详细的介绍了AUHeader的字段。
3.2.1AAC
参考[RFC3640]。
[RFC3640]介绍了负载AAC的两种模式,LowBit-rateAAC和HighBit-rateAAC,我使用的是HighBit-rateAAC。
HighBit-rateAAC模式支持AAC帧大小可变,帧最大长度是8191字节。
HighBit-rateAAC模式需要在SDP中指定mode=AAC-hbr,AUHeader只包含了两个字段AU-size(13位)和AU-Index(3位),这样AUHeader的长度正好为2字节,AU-Index填充为0,AU-size是网络字节序。
传输AAC帧不需要包含ADTS头,RTP单帧、分片、组包传输除了RTP头字段中的RTP_MARK没有特别需要注意的地方。
AAC网络流使用ADTS格式保存,ADTS指AudioDataTransportStream,它依次包含固定头(28位)和可变头(28位)两部分,它们的具体结构如下:
adts_fixed_header()
{
syncword;12位
ID;1位
layer;2位
protection_absent;1位
profile;2位
sampling_frequency_index;4位
private_bit;1位
channel_configuration;3位
original/copy;1位
home;1位
}
adts_variable_header()
{
copyright_identification_bit;1位
copyright_identification_start;1位
frame_length;13位
adts_buffer_fullness;11位
number_of_raw_data_blocks_in_frame;2位
}
详细说明下ADTS头的重要数据部分:
syncword同步字Thebitstring‘111111111111’,说明一个ADTS帧的开始。
IDMPEG标示符,设置为1.
layerIndicateswhichlayerisused.Setto‘00’
protection_absent表示是否误码校验
profile表示使用哪个级别的AAC,如01LowComplexity(LC)---AACLC
0 Mainprofile
1 LowComplexityprofile(LC)
2 ScalableSamplingRateprofile(SSR)
3 (reserved)
sampling_frequency_index表示使用的采样率下标
sampling_frequency_indexsamplingfrequeny[Hz]
0x096000
0x188200
0x264000
0x348000
0x444100
0x532000
0x624000
0x722050
0x816000
0x92000
0xa11025
0xb8000
0xcreserved
0xdreserved
0xereserved
0xfreserved
channel_configuration表示声道数
frame_length一个ADTS帧的长度包括ADTS头和rawdatablock.
adts_buffer_fullness0x7FF说明是码率可变的码流
number_of_raw_data_blocks_in_frame
表示ADTS帧中有 number_of_raw_data_blocks_in_frame+1个AAC原始帧.
所以说number_of_raw_data_blocks_in_frame==0表示说ADTS帧中有一个AAC数据块并不是说没有。
(一个AAC原始帧包含一段时间内1024个采样及相关数据)
AAC的RTP推送过程、播放过程及SDP的例子参见节,RTP数据传输参考DeviceHandler/StreamSender/和DeviceHandl
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 流媒体 相关内容 总结