Ubuntu下架设流媒体服务器的基本流程

系统 Linux
本文介绍如何在Ubuntu下使用Darwin Streaming Server实现流媒体服务器搭建。主要分三大搭建步骤,这三部分别是软件安装,配置与在线播放。

目前主流的流媒体服务器有微软的windows media server、RealNetworks的Helixserver和苹果公司的Darwin Streaming Server. 微软的windows media server只能在windows2000 server和windows 2003 server下使用,不在考虑之列。RealNetworks的Helixserver是一款跨平台的软件,功能也很强大,但并非免费软件,只能cut掉了。苹果公司的Darwin StreamingServer是一款跨平台的开源流媒体服务器软件,由苹果公司出品,其品质不用怀疑了,而且还免费。所以在架设流媒体服务器时就选择了DarwinStreaming 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文件后,解压缩,然后运行如下命令安装:

 

  1. ~/tmp/DarwinStreamingSrvrlinux-Linux$ chmod +x Install   
  2. ~/tmp/DarwinStreamingSrvrlinux-Linux$ sudo ./Install  
  3. [sudo] password for keensword007:   
  4. Installing Darwin Streaming Server  
  5. Checking for and Killing currently running Darwin Streaming Server  
  6. Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html  
  7. Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html  
  8. Removing previous versions of Darwin Streaming Server  
  9. Backing up previous config files  
  10. Inserting path to perl into scripts..  
  11. Creating unprivileged user to run the server = "qtss".  
  12. copying DarwinStreamingServer to /usr/local/sbin/DarwinStreamingServer  
  13. copying PlaylistBroadcaster to /usr/local/bin/PlaylistBroadcaster  
  14. copying MP3Broadcaster to /usr/local/bin/MP3Broadcaster  
  15. copying qtpasswd to /usr/local/bin/qtpasswd  
  16. creating /usr/local/sbin/StreamingServerModules directory  
  17. copying createuserstreamingdir to /usr/local/bin/createuserstreamingdir  
  18. creating /etc/streaming directory  
  19. Generating a new prefs file at /etc/streaming/streamingserver.xml  
  20. INFO: Module Loaded...QTSSRefMovieModule [dynamic]  
  21. INFO: Module Loaded...QTSSHomeDirectoryModule [dynamic]  
  22. INFO: Module Loaded...QTSSFileModule [static]  
  23. INFO: Module Loaded...QTSSReflectorModule [static]  
  24. INFO: Module Loaded...QTSSRelayModule [static]  
  25. INFO: Module Loaded...QTSSAccessLogModule [static]  
  26. INFO: Module Loaded...QTSSFlowControlModule [static]  
  27. INFO: Module Loaded...QTSSPosixFileSysModule [static]  
  28. INFO: Module Loaded...QTSSAdminModule [static]  
  29. INFO: Module Loaded...QTSSMP3StreamingModule [static]  
  30. INFO: Module Loaded...QTSSAccessModule [static]  
  31. WARNING: No users file found at /etc/streaming/qtusers.  
  32. WARNING: No groups file found at /etc/streaming/qtgroups.  
  33. chown: invalid user: `qtss'  
  34. copying relayconfig.xml-Sample to /etc/streaming/relayconfig.xml-Sample  
  35. copying qtusers to /etc/streaming/qtusers  
  36. chown: invalid user: `qtss'  
  37. copying qtgroups to /etc/streaming/qtgroups  
  38. chown: invalid user: `qtss'  
  39. copying readme.txt to /var/streaming/readme.txt  
  40. copying 3rdPartyAcknowledgements.rtf to /var/streaming/3rdPartyAcknowledgements.rtf  
  41. creating /usr/local/movies directory  
  42. creating /var/streaming/playlists directory  
  43. copying sample_100kbit.mov into /usr/local/movies/sample_100kbit.mov  
  44. copying sample_300kbit.mov into /usr/local/movies/sample_300kbit.mov  
  45. copying sample_100kbit.mp4 into /usr/local/movies/sample_100kbit.mp4  
  46. copying sample_300kbit.mp4 into /usr/local/movies/sample_300kbit.mp4  
  47. copying sample.mp3 into /usr/local/movies/sample.mp3  
  48. copying sample_50kbit.3gp into /usr/local/movies/sample_50kbit.3gp  
  49. copying sample_h264_100kbit.mp4 into /usr/local/movies/sample_h264_100kbit.mp4  
  50. copying sample_h264_300kbit.mp4 into /usr/local/movies/sample_h264_300kbit.mp4  
  51. copying sample_h264_1mbit.mp4 into /usr/local/movies/sample_h264_1mbit.mp4  
  52. copying StreamingLoadTool to /usr/local/bin/StreamingLoadTool  
  53. copying streamingloadtool.conf to /etc/streaming/streamingloadtool.conf  
  54. copying streamingadminserver.pl into /usr/local/sbin/streamingadminserver.pl  
  55. copying Admin HTML to /var/streaming/AdminHtml directory  
  56. chown: invalid user: `qtss'  
  57. chown: invalid user: `qtss'  
  58. chown: invalid user: `qtss'  
  59. Launching streamingadminserver.pl  
  60. Cannot switch to group qtss  
  61. Installation Complete  
  62. Darwin Streaming Server Setup  
  63. Inorder to administer the Darwin Streaming Server you must 
    create anadministrator user [Note: The administrator user name 
    cannot containspaces, or single or double quote characters, and 
    cannot be more than255 characters long].  
  64. Please enter a new administrator user name: keensword007  
  65. Youmust also enter a password for the administrator user [Note: 
    Theadministrator password cannot contain spaces, or quotes, 
    either singleor double, and cannot be more than 80 characters long].  
  66. Please enter a new administrator Password:   
  67. Re-enter the new administrator password:   
  68. Adding userName keensword007  
  69. chown: invalid user: `qtss'  
  70. Setup Complete! 

 

从提示信息上看,应该是qtss用户未能创建造成的,查看了一下Install脚本,发现创建用户的脚本是这样的:

  1. if [ $INSTALL_OS = "Linux" ]; then  
  2. /usr/sbin/useradd -M qtss > /dev/null 2>&1  
  3. else  
  4. /usr/sbin/useradd qtss > /dev/null 2>&1  
  5. fi 

但是useradd并没有-M的命令行参数,应该为-m,将-M修改成-m后,再执行Install脚本,安装成功。此时服务已经启动,可以使用如下命令确定服务是否已经启动:

 

  1. ~/tmp/DarwinStreamingSrvrlinux-Linux$ ps aux | grep Darwin  
  2. root 10963 0.0 0.0 4368 456 ? Ss 21:23 0:00 /usr/local/sbin/DarwinStreamingServer  
  3. qtss 10964 0.0 0.0 38032 2456 ? Sl 21:23 0:00 /usr/local/sbin/DarwinStreamingServer  
  4. 1000 11003 0.0 0.0 3004 760 pts/1 R+ 21:24 0:00 grep Darwin 

 

如果希望机器启动后自动运行流媒体服务器,输入如下命令:

 

  1. ~/tmp/DarwinStreamingSrvrlinux-Linux$ cd /etc/rc3.d  
  2. /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 Port80”则此服务器的访问可以突破防火墙,但如果您在此服务器上同时建有Apache 等占用80端口的服务。则建议您不要设置此端口。这里如果您没有什么特殊要求的话,使用缺省配置即可。直接点击“Finish”按钮。

自此流媒体服务器的设置就告一段落,如果您要作进一步的设置,可以通过此管理页面,在其左侧点击相应的选项,进行设置。也可以通过此对前面所做的设置进行更改。

三、在线播放

流媒体服务器部署完毕后,我们就可以使用自己喜欢的播放器在线播放了。例如,在本机上打开Movie Player, 在地址栏输入:

 

  1. rtsp://127.0.0.1/sample_100kbit.mp4 

就可以看到一段QuickTime演示视频。

【编辑推荐】

  1. Server 2008中流媒体服务器的部署与应用
  2. 详解gnump3d架设流媒体服务器于Linux环境之中
  3. 喜欢Ubuntu 10.04的十大理由
  4. 一个Ubuntu体验者的工作使用手记
  5. Ubuntu不得不分享的24条使用经验
责任编辑:张浩 来源: 博客园
相关推荐

2010-01-04 13:26:51

Ubuntu安装

2010-05-06 14:15:02

流媒体服务器负载均衡

2009-12-22 16:59:17

Linux环境

2023-03-12 09:22:58

2022-01-08 19:18:57

OBSLinux实时流媒体服务器

2023-10-12 19:46:26

Nginx服务器

2010-05-04 14:10:00

Media Servi

2011-03-11 10:39:04

2009-06-11 11:13:01

LinuxWeb服务器

2009-02-10 15:38:00

ApacheLinuxWeb服务器

2011-07-14 14:01:29

网络服务器配置服务器

2010-05-06 14:30:29

流媒体服务器负载均衡

2010-05-18 17:50:57

Subversion服

2010-05-31 10:09:32

2010-04-30 17:30:21

Server 2008流媒体

2012-02-27 14:09:39

媒体服务器Ubuntu

2010-05-31 19:17:38

2010-05-31 19:07:41

SVN服务器

2009-11-20 15:02:06

2011-08-08 13:52:32

服务器
点赞
收藏

51CTO技术栈公众号