Ubuntu 10.04下架设流媒体服务器
个人建议:使用DarwinStreamingSrvr5.5.5,因为DarwinStreamingSrvr6.0.3安装过程中有很多问题需要解决!
目前主流的流媒体服务器有微软的windows media server、RealNetworks的Helix server和苹果公司的Darwin Streaming Server. 微软的windows media server只能在windows 2000 server和windows 2003 server下使用,不在考虑之列。RealNetworks的Helix server是一款跨平台的软件,功能也很强大,但并非免费软件,只能cut掉了。苹果公司的Darwin Streaming Server是一款跨平台的开源流媒体服务器软件,由苹果公司出品,其品质不用怀疑了,而且还免费。所以在架设流媒体服务器时就选择了Darwin Streaming Server.
Darwin Streaming Server使用标准的实时传输协议/实时流媒体协议 (RTP/RTSP),通过互联网实时传送媒体。Darwin Streaming Server 也能提供对传送 H.264、MPEG-4 和 3GPP 文件的固有支持——因此,你可以在 Mac 和 Linux、Windows 上的任何与标准兼容的媒体播放器上执行你的内容,当然还包括手机和接收盒等各种兼容标准的设备。不仅如此,它还允许你使用 Icecast 兼容协议,通过 HTTP 传送标准的 MP3 文件到 MP3 客户端。
一、软件安装
首先上http://dss.macosforge.org/下载源代码,当前最新版本为6.0.3,但我选择了5.5.5版本,因为这个版本提供了针对 linux的安装脚本。下载了DarwinStreamingSrvr5.5.5-Linux.tar.gz文件后,解压缩,然后运行如下命令安装:
~/tmp/DarwinStreamingSrvrlinux-Linux$ chmod +x Install
~/tmp/DarwinStreamingSrvrlinux-Linux$ sudo ./Install
[sudo] password for kh:
Installing Darwin Streaming Server
Checking for and Killing currently running Darwin Streaming Server
Warning: bad ps syntax, perhaps a bogus ‘-’? See http://procps.sf.net/faq.html
Warning: bad ps syntax, perhaps a bogus ‘-’? See http://procps.sf.net/faq.html
Removing previous versions of Darwin Streaming Server
Backing up previous config files
Inserting path to perl into scripts..
Creating unprivileged user to run the server = “qtss”.
copying DarwinStreamingServer to /usr/local/sbin/DarwinStreamingServer
copying PlaylistBroadcaster to /usr/local/bin/PlaylistBroadcaster
copying MP3Broadcaster to /usr/local/bin/MP3Broadcaster
copying qtpasswd to /usr/local/bin/qtpasswd
creating /usr/local/sbin/StreamingServerModules directory
copying createuserstreamingdir to /usr/local/bin/createuserstreamingdir
creating /etc/streaming directory
Generating a new prefs file at /etc/streaming/streamingserver.xml
INFO: Module Loaded…QTSSRefMovieModule [dynamic]
INFO: Module Loaded…QTSSHomeDirectoryModule [dynamic]
INFO: Module Loaded…QTSSFileModule [static]
INFO: Module Loaded…QTSSReflectorModule [static]
INFO: Module Loaded…QTSSRelayModule [static]
INFO: Module Loaded…QTSSAccessLogModule [static]
INFO: Module Loaded…QTSSFlowControlModule [static]
INFO: Module Loaded…QTSSPosixFileSysModule [static]
INFO: Module Loaded…QTSSAdminModule [static]
INFO: Module Loaded…QTSSMP3StreamingModule [static]
INFO: Module Loaded…QTSSAccessModule [static]
WARNING: No users file found at /etc/streaming/qtusers.
WARNING: No groups file found at /etc/streaming/qtgroups.
chown: invalid user: `qtss’
copying relayconfig.xml-Sample to /etc/streaming/relayconfig.xml-Sample
copying qtusers to /etc/streaming/qtusers
chown: invalid user: `qtss’
copying qtgroups to /etc/streaming/qtgroups
chown: invalid user: `qtss’
copying readme.txt to /var/streaming/readme.txt
copying 3rdPartyAcknowledgements.rtf to /var/streaming/3rdPartyAcknowledgements.rtf
creating /usr/local/movies directory
creating /var/streaming/playlists directory
copying sample_100kbit.mov into /usr/local/movies/sample_100kbit.mov
copying sample_300kbit.mov into /usr/local/movies/sample_300kbit.mov
copying sample_100kbit.mp4 into /usr/local/movies/sample_100kbit.mp4
copying sample_300kbit.mp4 into /usr/local/movies/sample_300kbit.mp4
copying sample.mp3 into /usr/local/movies/sample.mp3
copying sample_50kbit.3gp into /usr/local/movies/sample_50kbit.3gp
copying sample_h264_100kbit.mp4 into /usr/local/movies/sample_h264_100kbit.mp4
copying sample_h264_300kbit.mp4 into /usr/local/movies/sample_h264_300kbit.mp4
copying sample_h264_1mbit.mp4 into /usr/local/movies/sample_h264_1mbit.mp4
copying StreamingLoadTool to /usr/local/bin/StreamingLoadTool
copying streamingloadtool.conf to /etc/streaming/streamingloadtool.conf
copying streamingadminserver.pl into /usr/local/sbin/streamingadminserver.pl
copying Admin HTML to /var/streaming/AdminHtml directory
chown: invalid user: `qtss’
chown: invalid user: `qtss’
chown: invalid user: `qtss’
Launching streamingadminserver.pl
Cannot switch to group qtss
Installation Complete
Darwin Streaming Server Setup
In order to administer the Darwin Streaming Server you must create an administrator user [Note: The administrator user name cannot contain spaces, or single or double quote characters, and cannot be more than 255 characters long].
Please enter a new administrator user name: keensword007
You must also enter a password for the administrator user [Note: The administrator password cannot contain spaces, or quotes, either single or double, and cannot be more than 80 characters long].
Please enter a new administrator Password:
Re-enter the new administrator password:
Adding userName keensword007
chown: invalid user: `qtss’
Setup Complete!
从提示信息上看,应该是qtss用户未能创建造成的,查看了一下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
但是useradd并没有-M的命令行参数,应该为-m,将-M修改成-m后,再执行Install脚本,安装成功。此时服务已经启动,可以使用如下命令确定服务是否已经启动:
~/tmp/DarwinStreamingSrvrlinux-Linux$ ps aux | grep Darwin
root 10963 0.0 0.0 4368 456 ? Ss 21:23 0:00 /usr/local/sbin/DarwinStreamingServer
qtss 10964 0.0 0.0 38032 2456 ? Sl 21:23 0:00 /usr/local/sbin/DarwinStreamingServer
1000 11003 0.0 0.0 3004 760 pts/1 R+ 21:24 0:00 grep Darwin
如果希望机器启动后自动运行流媒体服务器,输入如下命令:
~/tmp/DarwinStreamingSrvrlinux-Linux$ cd /etc/rc3.d
/etc/rc3.d$ sudo ln -s /usr/local/sbin/streamingadminserver.pl s20streamingserver
。如果要手动启动服务,运行streamingadminserver.pl程序。
二、配置
Darwin Streaming Server采用了web管理模式,可以在本机的浏览器中输入:http://127.0.0.1:1220 。然后输入在安装流媒体服务器时设置的用户名称和密码。
第一次登录时,接着会出现设置向导。首先是一个如图所示的MP3 广播密码设置对话框,在其“New Password”和“Re-enter New Password”输入自己想设置的密码。然后点击“Next”按钮继续。
为了保证数据传输的安全需要您可以在这里钩选“Secure Administration(SSL)”(安全管理),前提是您已经有了可用的SSL 证书。一般可以不选,如图 所示。直接点击“Next”按钮继续。
接下来要设置的是媒体文件的存放主目录, 其默认的目录为“如图所示。这个目录要记住,在服务器中以后添加媒体文件时就要加在这个目录中。设置完毕点击“Next”按钮继续。
最后设置默认传输端口,如果设置了“Streaming on Port 80”则此服务器的访问可以突破防火墙,但如果您在此服务器上同时建有Apache 等占用80 端口的服务。则建议您不要设置此端口。这里如果您没有什么特殊要求的话,使用缺省配置即可,如图9 所示。直接点击“Finish”按钮。
自此流媒体服务器的设置就告一段落,如果您要作进一步的设置,可以通过此管理页面,在其左侧点击相应的选项,进行设置。也可以通过此对前面所做的设置进行更改。
三、在线播放
流媒体服务器部署完毕后,我们就可以使用自己喜欢的播放器在线播放了。例如,在本机上打开Movie Player, 在地址栏输入:
rtsp://127.0.0.1/sample_100kbit.mp4
就可以看到一段QuickTime演示视频。