软件官网:http://dss.macosforge.org/downloads/
本文使用Darwin Streaming Server工具进行测试
1、什么是Darwin Streaming Server
目前主流的流媒体服务器有微软的windows media server、RealNetworks的Helixserver和苹果公司的Darwin Streaming Server. 微软的windows media server只能在windows2000 server和windows 2003 server下使用,不在考虑之列。RealNetworks的Helixserver是一款跨平台的软件,功能也很强大,但并非免费软件。
Darwin Streaming Server简称DSS。DSS是Apple公司提供的开源实时流媒体播放服务器程序。整个程序使用C++编写,在设计上遵循高性能,简单,模块化等程序设计原则,务求做到程序高效,可扩充性好。并且DSS是一个开放源代码的,基于标准的流媒体服务器,可以运行在Windows NT和Windows 2000,以及几个UNIX实现上,包括Mac OS X,Linux,FreeBSD,和Solaris操作系统上的。
2、在Linux中编译安装Darwin Streaming Server
首先需要进行一些必要的准备工作:
apt-get install patch make gcc g++
准备好软件暂存的目录,并从官网下载软件的源码:
mkdir soft cd soft wget http://dss.macosforge.org/downloads/DarwinStreamingSrvr6.0.3-Source.tar
源码下载完成后,需要解压tar包,
tar xvf DarwinStreamingSrvr6.0.3-Source.tar
二,开始安装
tar -xvf DarwinStreamingSrvr6.0.3-Source.tar
mv DarwinStreamingSrvr6.0.3-Source DarwinStreamingSrvr6.0.3-Source.orig
https://weblion.psu.edu/svn/weblion/users/dcn113/dss-6.0.3.patch
patch -p0 < dss-6.0.3.patch
mv DarwinStreamingSrvr6.0.3-Source.orig DarwinStreamingSrvr6.0.3-Source
wget https://weblion.psu.edu/svn/weblion/users/dcn113/dss-hh-20080728-1.patch
patch -p0 < dss-hh-20080728-1.patch
cd DarwinStreamingSrvr6.0.3-Source
mv Install Install.orig
wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/Install
chmod +x Install
./Buildit
./Install
给源码安装补丁文件,进入DarwinStreamingSrvr6.0.3-Source目录,并打补丁:
cd DarwinStreamingSrvr6.0.3-Source wget http://www.abrahamsson.com/dss-6.0.3.patch patch -p1 < dss-6.0.3.patch
执行
./Buildit
编译完成后,我们来生成linux下的dss安装包
执行 ./buildtarball
生成DarwinStreamingSrvr-Linux.tar.gz
解压缩
tar -zxvf DarwinStreamingSrvr-Linux.tar.gz cd DarwinStreamingSrvr-Linux
对Install文件做修改
if [ $INSTALL_OS = "Linux" ]; then /usr/sbin/useradd -M qtss > /dev/null 2>&1 else /usr/sbin/useradd qtss > /dev/null 2>&1 fi
将-M修改成-m
执行./Install
Please enter a new administrator user name: 【新管理员】
Please enter a new administrator Password: 【密码】
查看是否安裝成功
ps aux | grep Darwin(查看流媒体服务器的进程)
root ... ... ... /usr/local/sbin/DarwinStreamingServer
qtss ... ... ... /usr/local/sbin/DarwinStreamingServer
netstat -ntulp | grep Darwin(查看流媒体服务器的端口)
3、启动 Darwin Streaming Server
sudo /usr/local/sbin/DarwinStreamingServer
启动 Web 管理介面 (tcp port 1220)
sudo /usr/local/sbin/streamingadminserver.pl
ps. 以上两项在刚安装好的时候会自动启动,不需手动执行
小技巧:自动启动流媒体服务器的方法:
自动运行流媒体服务器序非常简单,把上述命令添加在/etc/rc.d/rc.local脚本中即可。
最后在服务器输入 http://你的IP:1220/来访问web管理
默认的媒体文件存放在/usr/local/movies
你可以在web管理面板修改这个路径。
4、访问自己的流媒体服务
可以使用VLC media player这个软件,输入
rtsp://你的IP/sample_100kbit.mp4
来播放默认的测试视频。如果你的网速够给力的话效果还不错 :)
StreamingLoadTool使用说明
8.DarwinStreamingsrvr6.03中StreamingLoadtool测试工具
测试命令:./StreamingLoadTool -n 100(用户数) -u rtsp://localhost/streamingloadtool.mov
./StreamingLoadTool -n 1 -p 8554 -V 2 -u rtsp://localhost/test.ts //测试live555命令
测试结果:
Active Playing Attempts Success Errors Failed Bitrate
100 24 100 0 0 0 347k
100 100 100 0 0 0 16831k
100 100 100 0 0 0 22193k
100 100 100 0 0 0 20525k
100 100 100 0 0 0 13441k
94 76 100 24 0 0 10015k
13 0 100 100 0 0 0k
StreamingLoadTool test complete. Total number of connections: 100.
Total bytes received: 80864324. Total packets received: 163111.
Total out of order packets: 0. Total out of bound packets: 0.
Total ACKs sent: 117834. Total malformed packets: 58633.
10.webbench 测试工具,主要测试http
测试命令:./webbench -c 10(客户数) -t 60(时间) http://lcoalhost/
11.ptop streamer for devlopper测试命令(GRAPE I/O模式)
Streamers-test/test.sh -e Streamers/streamer-ml-monl-grapes-static -v ~/working/input.ts -N 0 -O 1 -o "cvlc -
(一个源,后台0个peer运行,一个peer输出)
12.P2PTV-sim for research 测试命令
./sim NumPeers=3 Degree=1 PeerType=LATEST_RANDOM NumChunks=10 ChunkArrivalsFile="Absolute_time_arrival" ChunkDelaysFile="Chunk_delay" ChunkDelayCounters=10
注释:
若要测试H264需要修改RTSPClientlib中SendReliableUDPSetup相关的track值,同时需要修改StreamingLoadTool中关于streamingloadtool.mov的值将其改为.264就行
1. 下载DarwinStreamingServer6.03源码:
http://dss.macosforge.org/downloads/DarwinStreamingSrvr6.0.3-Source.tar
2. 由于版本差异以及平台问题,需要打patch:
搜罗了一下网上对于6.03的几个基本patch,主要需要下面三个:
1. dss-6.0.3.patch
2. dss-hh-20080728-1.patch
3. dss-6.0.3-x86_64.patch(x86_64环境下需要,不然会出现内存异常)
4. 补丁追加命令如:patch -p1 < dss-6.0.3.patch
对于上述几个patch包,已制作打补丁小工具addpatch
3. 编译,安装
1. 编译:源码下编译工具:Buildit
2. 清除编译:源码目录下:clean
3. 安装:源码下面安装工具:Install(原安装文件不是很好用,我已经做简单调整)
4. Dss相关停止启动也制作了简单工具,有需要可以共享
5. 流媒体测试工具使用StreamingLoadTool
使用方法如下:
-u指定url(现在代码不够灵活,url需要如下格式:rtsp://ip/streamingloadtool.mov格式)
-n指定客户端数量
./StreamingLoadTool -u rtsp://192.168.10.10/streamingloadtool.mov -n 200
6. 测试结果
[root@TEST Test4Dss]# ./StreamingLoadTool -u rtsp://192.168.10.10/streamingloadtool.mov -n 200
Found bad directive in StreamingLoadTool config file: concurrentclients
Checking for 'streamingloadtool.mov' on the target servers
##WARNING: Error connecting to rtsp://foo.bar.com/sample.mov.
Done checking for 'streamingloadtool.mov' on all servers -- 1 valid URL's
StreamingLoadTool test in progress.
Config file: streamingloadtool.conf. Client type: RTSP/ReliableUDP client. Num clients: 200.
Movie length: 40. Run forever: 1. HTTP cookie: 1000200. Port: 554
Writing StreamingLoadTool log at: streamingloadtool.log
Active Playing Attempts Success Errors Failed Bitrate
200 44 200 0 0 0 2349k
200 200 200 0 0 0 87352k
200 200 200 0 0 0 107701k
200 200 200 0 0 0 107103k
200 200 200 0 0 0 68994k
200 157 203 45 0 0 52351k
200 195 400 200 0 0 61923k
200 200 400 200 0 0 107362k
200 200 400 200 0 0 107544k
200 200 400 200 0 0 86964k
199 197 402 203 0 0 53458k
199 127 592 395 0 0 48516k
200 197 604 400 5 0 96862k
200 197 612 400 12 0 106152k
200 200 615 400 15 0 99836k
200 200 615 400 15 0 61383k
如图:
图一
测试中途停止ctrl+c
图二
抓包结果:
DESCRIBE rtsp://192.168.10.10/streamingloadtool.mov RTSP/1.0
CSeq: 1
Accept: application/sdp
User-agent: QTS
Bandwidth: 50000
RTSP/1.0 200 OK
Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )
Cseq: 1
Last-Modified: Wed, 26 Oct 2011 10:23:21 GMT
Cache-Control: must-revalidate
Content-length: 433
Date: Fri, 28 Oct 2011 04:20:48 GMT
Expires: Fri, 28 Oct 2011 04:20:48 GMT
Content-Type: application/sdp
x-Accept-Retransmit: our-retransmit
x-Accept-Dynamic-Rate: 1
Content-Base: rtsp://192.168.10.10/streamingloadtool.mov/
v=0
o=StreamingServer 3528764467 1319624601000 IN IP4 192.168.10.10
s=/streamingloadtool.mov
u=http:///
e=admin@
c=IN IP4 0.0.0.0
b=AS:253
t=0 0
a=control:*
a=range:npt=0- 70.00000
m=video 0 RTP/AVP 96
b=AS:209
a=3GPP-Adaptation-Support:1
a=rtpmap:96 X-SV3V-ES/90000
a=control:trackID=3
m=audio 0 RTP/AVP 97
b=AS:44
a=3GPP-Adaptation-Support:1
a=rtpmap:97 X-QDM/32000/2
a=control:trackID=4
a=x-bufferdelay:3.66
SETUP rtsp://192.168.10.10/streamingloadtool.mov/trackID=3 RTSP/1.0
CSeq: 2
Transport: RTP/AVP;unicast;client_port=6992-6993
x-Retransmit: our-retransmit
User-agent: QTS
Bandwidth: 50000
RTSP/1.0 200 OK
Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )
Cseq: 2
Last-Modified: Wed, 26 Oct 2011 10:23:21 GMT
Cache-Control: must-revalidate
Session: 6451247484896933116
Date: Fri, 28 Oct 2011 04:20:48 GMT
Expires: Fri, 28 Oct 2011 04:20:48 GMT
Transport: RTP/AVP;unicast;source=192.168.10.10;client_port=6992-6993;server_port=6970-6971;ssrc=177E63BB
x-Retransmit: our-retransmit
SETUP rtsp://192.168.10.10/streamingloadtool.mov/trackID=4 RTSP/1.0
CSeq: 3
Session: 6451247484896933116
Transport: RTP/AVP;unicast;client_port=6994-6995
x-Retransmit: our-retransmit
User-agent: QTS
Bandwidth: 50000
RTSP/1.0 200 OK
Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )
Cseq: 3
Session: 6451247484896933116
Last-Modified: Wed, 26 Oct 2011 10:23:21 GMT
Cache-Control: must-revalidate
Date: Fri, 28 Oct 2011 04:20:48 GMT
Expires: Fri, 28 Oct 2011 04:20:48 GMT
Transport: RTP/AVP;unicast;source=192.168.10.10;client_port=6994-6995;server_port=6970-6971;ssrc=6148610D
x-Retransmit: our-retransmit
PLAY rtsp://192.168.10.10/streamingloadtool.mov RTSP/1.0
CSeq: 4
Session: 6451247484896933116
Range: npt=0.0-
x-prebuffer: maxtime=3.0
User-agent: QTS
Bandwidth: 50000
RTSP/1.0 200 OK
Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )
Cseq: 4
Session: 6451247484896933116
x-Prebuffer: time=0.23466
Range: npt=0.00000-70.00000
RTP-Info: url=rtsp://192.168.10.10/streamingloadtool.mov/trackID=3;seq=52539;rtptime=242052550,url=rtsp://192.168.10.10/streamingloadtool.mov/trackID=4;seq=11838;rtptime=1069604625
用官方达尔文流媒体服务器代码,测试了李明提供的服务器(192.168.10.10),具体服务器配置:
内存:6G
CPU:Version: Intel(R) Xeon(R) CPU E5506 @ 2.13GHz
并发测试结果:
1.当客户端数量为203的时候,服务、连接播放都正常(虽然会有一定数量的错误),如图三所示
图三
2.当客户端数量大于203的时候,服务出现异常,如图四所示:
图四
3.当客户端数量在大于190的时候,工具测试RTCP统计日志会出现错误信息,如图五所示:
图五
7. 另外一个RTSP客户端:openRTSP客户端进行测试,具体数据和结果没有进行分析,仅供参考,测试结果如下:
执行命令: ./openRTSP rtsp://192.168.10.10/streamingloadtool.mov
测试Log
[root@TEST testProgs]# ./openRTSP rtsp://192.168.10.10/streamingloadtool.mov
Opening connection to 192.168.10.10, port 554...
...remote connection opened
Sending request: OPTIONS rtsp://192.168.10.10/streamingloadtool.mov RTSP/1.0
CSeq: 2
User-Agent: ./openRTSP (LIVE555 Streaming Media v2011.10.27)
Received 206 new bytes of response data.
Received a complete OPTIONS response:
RTSP/1.0 200 OK
Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )
Cseq: 2
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD
Sending request: DESCRIBE rtsp://192.168.10.10/streamingloadtool.mov RTSP/1.0
CSeq: 3
User-Agent: ./openRTSP (LIVE555 Streaming Media v2011.10.27)
Accept: application/sdp
Received 893 new bytes of response data.
Received a complete DESCRIBE response:
RTSP/1.0 200 OK
Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )
Cseq: 3
Last-Modified: Wed, 26 Oct 2011 10:23:21 GMT
Cache-Control: must-revalidate
Content-length: 433
Date: Fri, 28 Oct 2011 08:46:31 GMT
Expires: Fri, 28 Oct 2011 08:46:31 GMT
Content-Type: application/sdp
x-Accept-Retransmit: our-retransmit
x-Accept-Dynamic-Rate: 1
Content-Base: rtsp://192.168.10.10/streamingloadtool.mov/
v=0
o=StreamingServer 3528780391 1319624601000 IN IP4 192.168.10.10
s=/streamingloadtool.mov
u=http:///
e=admin@
c=IN IP4 0.0.0.0
b=AS:253
t=0 0
a=control:*
a=range:npt=0- 70.00000
m=video 0 RTP/AVP 96
b=AS:209
a=3GPP-Adaptation-Support:1
a=rtpmap:96 X-SV3V-ES/90000
a=control:trackID=3
m=audio 0 RTP/AVP 97
b=AS:44
a=3GPP-Adaptation-Support:1
a=rtpmap:97 X-QDM/32000/2
a=control:trackID=4
a=x-bufferdelay:3.66
Opened URL "rtsp://192.168.10.10/streamingloadtool.mov", returning a SDP description:
v=0
o=StreamingServer 3528780391 1319624601000 IN IP4 192.168.10.10
s=/streamingloadtool.mov
u=http:///
e=admin@
c=IN IP4 0.0.0.0
b=AS:253
t=0 0
a=control:*
a=range:npt=0- 70.00000
m=video 0 RTP/AVP 96
b=AS:209
a=3GPP-Adaptation-Support:1
a=rtpmap:96 X-SV3V-ES/90000
a=control:trackID=3
m=audio 0 RTP/AVP 97
b=AS:44
a=3GPP-Adaptation-Support:1
a=rtpmap:97 X-QDM/32000/2
a=control:trackID=4
a=x-bufferdelay:3.66