rtsp服务器搭建(RTSP流媒体服务器的搭建与测试)

总结有福利C++实现RTSP/RTP流媒体服务器,同时支持Linux和Windows编译环境。使用VLC客户端测试通过。实现RTSP的OPTIONS、DESCRIBE、SETUP、PLAY、PAUSE、TEARDOWN,实现SDP生成,实现RTP打包,实现TS文件解析。有相应的源码分析文档。新增功能一别名别名主要是替换URL中真实的文件名和路径。使用别名,Helix Universal Server管理员可以伪装真实的资源在发布的URL中,这样做可以使URL更友好,更短。 二内容缓存内容缓存可以使两台以上的Helix Universal Server传输多媒体文件,这样做有两个好处:第一:缓存改进了客户播放内容的品质第二:内容缓存节约了传送成本,直接将内容缓存至离客户最近的网络。 三定制日志定制日志是系统生成报告的一个灵活功能。这里使用了模板功能,它定义了哪些信息被捕捉,什么时候去捕捉。你可以使用默认的模板也可以创建你自己的模板。 四模仿直播传输代理 SLTA (Simulated Live Transfer Agent )SLTA可以像直播那样传输一个流媒体片度,它使RealNetworks下一代的工具。SLTA像上一代技术G2SLTA一样支持很多的流媒体格式,它提供了一种发布流媒体的更强劲的方式,像一台直播机一样,将一个流媒体发布到接受者那里。 五RTSP 缓存指示在默认的情况下,一个代理可能缓存所有的点播内容和直播内容在一台Helix Universal Server上。但是可能你不想缓存其中的一些内容。RTSP缓存指示可以告诉那些缓存的 Helix Universal Server 应该缓存什么内容,不应该缓存什么内容。RTSP所赋予你更大的灵活性。 六冗余服务本功能可以使你为内容发布添加等级。默认的情况下,RealOne Player在中断后,将向Helix Universal Server重新申请连接。不论如何,你可以指定另外一个服务器来让RealOne Player连接。七Windows Media 流媒体支持Helix Universal Server可以使用MMS协议或者HTTP协议向Windows Media Player传输Windows Media格式的流媒体。它也可以通过HTTP方式与Windows Media Encoder连接,允许传输Windows Media 的广播到其他的Helix Unviersal Servers.因此,你可以使用一个统一的流媒体网络来发布多种格式的流媒体,例如:RealMedia,Windows Media 以及QuickTime。 八MPEG 流媒体支持Helix Universal Server可以发布MPEG-1,MPEG-2,MP3,以及MPEG-4格式的内容。详细内容参见“MPEG音频与视频” 九智能流Helix Universal Serve可以帮助在保证带宽的情况下进行Real音频或者Real视频的广播。使用智能流你可以先从服务器端发送测试包到接受者那里,不管客户端使用什么样的流媒体码率,在智能流的控制下,只有一个适合客户端的码率可以被接受。 十RealOne Player 的统计新的客户统计状态类型4,可以更好的返回RealOne Player的信息,包含每一个流信息包,带宽等信息,以便可以更好的根据返回结果使用TurboPlay功能.架设网络直播电视支持多种流媒体文件:音频文件:RealAudio.Wav.Au.MPEG-1.MPEG-2.MP3视频文件:RealVideo.AVI.QuickTime.其他类型:RealPix.RealText.GIF.JPEG.SMIL.Real G2 with Flash等等.但Helix SERver不支持所有的流媒体文件,所以还要一些软件支持,因此Helix Universal Platform提供了一功能强大的工具—Helix Producer.它可以将Helix Server 不支持的流媒体文件转换成它支持的流媒体文件.Helix Server提供了多种类型服务:1).点播(On-Demand)任何时候,用户都可以通过单击Helix Server管理员公布的web连接,向Helix Server提出播放流媒体文件的要求,服务器再按照用户的要求,以"流"的方式不断地把数据传给用户.用户就可以像播放本地流媒体文件一样,随意控制文件播放.2).直播(Live)网络直播和现实生活中的电视直播方式是类似的.直播的过程大致如下:1.在现场使用摄像机,话筒等媒体采集工具采集实况信号.2.用数/模转换设备如视频采集卡将采集的模拟信号转换成数字信号.3.数字信号经压缩编码软件如Helix Producer转换成流媒体数据流,并送往Helix Server/4.用户单击web连接时,Helix Server将接收到的数据流发送给用户.和点播不同的是,用户收看的是实时信号,用户不能控制快进,暂停.3).模拟直播(Simulated Live)模拟直播的过程如下:1.流媒体文件储存在服务器或其他PC机上.2.利用Helix Server提供的辅助工具"SLTA",将流媒体文件以数据流的形式发送给Helix Server.3.用户单击wen连接时,Helix Server将接收到的数据流发送给用户.用户看到的是事先制作好的流媒体文件,就像是日常生活中通过电视收看故事片一样.二、Linux环境下安装配置HelixServer安装[root@localhost data]# ls
  DistributedLicensing.lic  HelixServer  ISP-Hosting.lic  setup.tar.gz
  [root@localhost data]# tar -zxvf setup.tar.gz    #解压HelixServer Unlimited 11
  helix-server-retail-11.01-rhel4-setup.bin
  [root@localhost data]# ls
  DistributedLicensing.lic  helix-server-retail-11.01-rhel4-setup.bin  setup.tar.gz
  HelixServer               ISP-Hosting.lic
  [root@localhost data]# chmod 700 helix-server-retail-11.01-rhel4-setup.bin   # 添加执行权限
  [root@localhost data]# ./helix-server-retail-11.01-rhel4-setup.bin #安装HelixServer Unlimited 11
  Extracting files for Helix installation……………………
  Welcome to the Helix Server 11.0 (11.0.1.1884) Setup for UNIX
  Setup will help you get Helix Server running on your computer.
  Press [Enter] to continue…
  If a Helix Server license key file has been sent to you,
  please enter its directory path below. If you have not
  received a Helix Server license key file, then this server
  WILL NOT OPERATE until a license key file is placed in
  the servers License directory.  Please obtain a free
  Basic Helix Server license or purchase a commercial license
  from our website at http://www.real.com/.  If you need
  further assistance, please visit our on-line support area
  at http://service.real.com/.
  License Key File: []:   #添加许可证文件 此步先确认,等HelixServer安装完毕之后再添加文件。
  Installation and use of Helix Server requires
  acceptance of the following terms and conditions:
  Press [Enter] to display the license text…  #列出许可协议
  REALNETWORKS, INC.
  END USER LICENSE AGREEMENT
  HELIX(tm) BASIC SERVER FROM
  REALNETWORKS(r)
  REDISTRIBUTION NOT PERMITTED
  Software License for Helix(tm) Basic
  Server from RealNetworks(r)
  IMPORTANT — READ CAREFULLY: This
  RealNetworks License Agreement ("License
  Agreement") is a legal agreement between
  you (either an individual or an entity)
  and RealNetworks, Inc. and its suppliers
  and licensors (collectively "RN") for
  RNs Helix Basic Server, which includes
  computer software and associated media
  and printed materials, whether provided
  in physical form or received on-line in
  electronic form ("Software").  You may
  install only ONE copy of the Software.
  By choosing "Accept," installing,
  copying or otherwise using the Software,
  you agree to be bound by the terms of
  this License Agreement.  If you do not
  agree to the terms of this License
  –More–(4%)
  Choose "Accept" to accept the terms of this
  license agreement and continue with Helix Server setup.
  If you do not accept these terms, enter "No"
  and installation of Helix Server will be cancelled.
  I accept the above license: [Accept]:     #回车,接受许可协议
  Enter the complete path to the directory where you want
  Helix Server to be installed.  You must specify the full
  pathname of the directory and have write privileges to
  the chosen directory.
  Directory:  [/data]: /data/HelixServer    #输入安装目录
  Please enter a username and password that you will use
  to access the web-based Helix Server Administrator and monitor.
  Username []: admin         #输入web登录管理员名称
  Password []:                   # 输入web登录管理员密码
  Confirm Password []:       #再次输入登录管理员密码
  Please enter a port on which Helix Server will listen for
  RTSP connections.  These connections have URLs that begin
  with "rtsp://"
  Port [554]:            #设置RTSP连接端口,保持默认。
  Please enter a port on which Helix Server will listen for
  HTTP connections.  These connections have URLs that begin
  with "http://"
  Port [80]: 8088     #设置HTTP连接端口,为避免和apache冲突,建议更改。
  Please enter a port on which Helix Server will listen for
  MMS connections.  These connections have URLs that begin
  with "mms://"
  Port [1755]:         #设置MMS连接端口,保持默认。
Helix Server will listen for Administrator requests on the
  port shown.  This port has been initialized to a random value
  for security.  Please verify now that this pre-assigned port
  will not interfere with ports already in use on your system;
  you can change it if necessary.
  Port [27465]: 10000         #设置HelixServer远程管理端口,建议更改以便记忆。
  You have selected the following Helix Server configuration:
  Admin User/Password:    admin/****
  Encoder User/Password:  admin/****
  Monitor Password:       ****
  RTSP Port:              554
  HTTP Port:              8088
  MMS Port:               1755
  Admin Port:             10000
  Destination:            /data/HelixServer
  Enter [F]inish to begin copying files, or [P]revious to go  back to the previous prompts: [F]: #如果前面配置没有问题,按"Enter"键复制文件,若想修改前面配置参数,按"P"键返回修改。  Copying Helix Server files….
  Helix Server installation is complete.
  If at any time you should require technical
  assistance, please visit our on-line support area
  at http://service.real.com/.
  Cleaning up installation files…
  Done.
  [root@localhost data]#
  [root@localhost data]# cp *.lic /data/HelixServer/License/    #复制许可证文件
  HelixServer 汉化包
  [root@localhost HelixAdministrator_CHS]# cp -rf * /data/HelixServer/HelixAdministrator/     #复制汉化包文件到HelixAdministrator目录中
  [root@localhost data]# cd HelixServer/
  [root@localhost HelixServer]# ls
  adm_b_db  cdi_b_db  default.cfg  enc_w_db            Lib      master.cfg    Secure
  Bin       Commerce  enc_b_db     HelixAdministrator  License  Plugins       slta.cfg
  Cache     Content   enc_r_db     helixserver.my      Logs     rmserver.cfg
  HelixServer 服务启用和停用
  [root@localhost HelixServer]# ./Bin/rmserver rmserver.cfg &       #后台启动HelixServer
  [1] 6868
  [root@localhost HelixServer]# Helix Server (c) 1995-2005 RealNetworks, Inc. All rights reserved.
  Version:   Helix Server 11.0 (11.0.1.1884) (Build 74277/5688)
  Platform:  linux-rhel4-i686
  Using Config File: rmserver.cfg
  Linux kernel version 2.6.9-78.EL detected [glibc 2.3.4/NPTL 2.3.4]
  Starting PID 6869 TID 3086890688/6869, procnum 0 (controller)
  Creating Server Space…
  Server has allocated 256 megabytes of memory
  Starting TID 3084909440/6871, procnum 1 (timer)
  Calibrating timers…
  Interval timer enabled (10ms resolution).
  Starting TID 3082812288/6872, procnum 2 (core)
  Starting Helix Server 11.0 Core…
  1 CPU Detected…
  Testing File Descriptors…
  Setting per-process descriptor capacity to 672(1003), 21…
  Testing Mutex…(421.50 ops/usec)
  Testing AtomicOps…(61.73 ops/usec)
  I: Loading Plugins from /data/HelixServer/Plugins…
  I: slicensepln.so   0xb50ec0  RealNetworks Licensing Plugin
  I: svrbascauth.so   0x3b9cc0  RealNetworks Basic Authenticator
  I: rn5auth.so       0x11dc40  RealNetworks RN5 Authenticator
  I: rn5auth.so       0x11dc40  RealNetworks Digest Authenticator
  I: rncache.so       0x43c880  RealNetworks Cache Plugin
  I: redbcplin.so     0x6f10a0  RealNetworks Broadcast Redundancy Plugin
  I: encoplin.so      0x13f8f0  RealNetworks Encoder Broadcast Plugin
  I: swfformat.so     0x1ffc30  RealNetworks Macromedia Flash 4 File Format Plugin
  I: snmpplin.so      0x23fe00  RealNetworks Snmp Plugin (Version 11.0.0.0)
  I: miiplin.so       0x2e00e0  RealNetworks Media Import Plugin
  I: xmlcfg.so        0x9fa780  RealNetworks XML Configuration Plugin

  I: audplin.so       0xce14c0  RealNetworks G.7xx Renderer Plugin
  I: audplin.so       0xce14c0  Helix PCM Audio Renderer Plugin
  I: audplin.so       0xce14c0  RealNetworks AU File Format Plugin
  I: audplin.so       0xce14c0  Helix WAVE File Format Plugin
  I: audplin.so       0xce14c0  Helix AIFF File Format Plugin
  I: audplin.so       0xce14c0  RealNetworks DVI4 Renderer Plugin
  I: meiffpln.so      0x35f3b0  RealNetworks Media Export File Format Plugin
  I: smonplin.so      0x91d820  RealNetworks System Monitor
  I: ramplin.so       0x36df70  RealNetworks Ramgen File System
  I: ppvmsql.so       0x4fea10  RealNetworks Mini SQL PPV Database Plugin
  I: wmmcastpln.so    0x3933b0  RealNetworks Windows Media Multicast Plugin
  I: allow.so         0x3a6d00  RealNetworks Basic Allowance Plugin
  I: mp3fformat.so    0x3c8ea0  RealNetworks MP3 File Format Plugin
  I: adminfs.so       0x872920  RealNetworks Admin File System
  I: avifformat.so    0xad7050  RealNetworks AVI File Format Plugin
  I: imgfformat.so    0x45f150  Helix JPEG File Format Plugin
  I: imgfformat.so    0x45f150  Helix GIF File Format Plugin
  I: imgfformat.so    0x45f150  Helix PNG File Format Plugin
  I: imgfformat.so    0x45f150  Helix RealPix Format Plugin
  I: imgfformat.so    0x45f150  Helix RealPix JPEG File Format Codec Plugin
  I: imgfformat.so    0x45f150  Helix RealPix GIF File Format Codec Plugin
  I: imgfformat.so    0x45f150  Helix RealPix PNG File Format Codec Plugin
  I: imgfformat.so    0x45f150  Helix WBMP File Format Plugin
  I: wmsrcpln.so      0x3e4000  RealNetworks Windows Media Live Broadcast Source Plugin
  I: smlfformat.so    0xaf3330  RealNetworks SMIL File Format Plugin
  I: asxplin.so       0x375f60  RealNetworks Asxgen File System
  I: cdistpln.so      0x6cbec0  RealNetworks Content Distribution Plugin
  I: isphoster.so     0xd430c0  RealNetworks ISP hosting plugin
  I: shelfsys.so      0xc28e60  RealNetworks Shell File System
  I: mp4fformat.so    0x535d30  RealNetworks Mpeg4 File Format Plugin
  I: encfs.so         0x405e10  RealNetworks Encoder Administration File System Plugin
  I: ppvbasic.so      0x95cfd0  RealNetworks FlatFile Database Plugin
  I: asfwmpln.so      0xc4ecd0  RealNetworks Active Stream Format Version 1 Plugin
  I: dbmgr.so         0x40d670  RealNetworks Database Manager
  I: ppvallow.so      0x422980  RealNetworks Pay Per View Allowance Plugin
  I: pplyplin.so      0xb78160  RealNetworks Scalable Multicast Plugin
  I: authmgr.so       0x9c2bf0  Helix Authentication Manager
  I: meiplin.so       0x58a400  RealNetworks Media Export Interface Plugin
  I: asncfsys.so      0x5a8490  RealNetworks Network Optimized File System
  I: qtbcplin.so      0x5bdde0  RealNetworks QuickTime Live Broadcast Plugin
  I: smplfsys.so      0x69fcb0  RealNetworks Local File System
  I: plusplin.so      0xd95070  RealNetworks PlusURL File Format Plugin
  I: hxsdp.so         0xde0180  RealNetworks SDP Stream Description Plugin
  I: sdpgenfsys.so    0xe5cac0  RealNetworks Dynamic SDP Generation Plugin
  I: bdstplin.so      0x70cc50  RealNetworks Broadcast Distribution Plugin
  I: tmplgpln.so      0xd4d3b0  RealNetworks Custom Logging Plugin
  I: rmfformat.so     0x7449c0  RealNetworks RealMedia File Format Plugin
  I: brcvplin.so      0x7d8910  RealNetworks Broadcast Reception Plugin
  I: cdadplin.so      0xdc6000  RealNetworks Content Distribution Advise Plugin
  I: tagfsys.so       0xe71730  RealNetworks XMLTagFileSystem
  I: rtfformat.so     0x83ffe0  Helix RealText File Format Plugin
  I: archplin.so      0xa25500  RealNetworks Live Archiver Plugin
  I: httpfsys.so      0x8bed90  RealNetworks HTTP File System with CHTTP Support
  I: httpfsys.so      0x8bed90  RealNetworks RFC 2397 Data Scheme File System
  I: vsrcplin.so      0x96ed10  RealNetworks View Source Tag Replacement Plugin
  I: vsrcplin.so      0x96ed10  RealNetworks View Source Allowance Plugin
  I: vsrcplin.so      0x96ed10  RealNetworks View Source File System
  Starting TID 3080715136/6873, procnum 3 (rmplug)
  Loading Helix Server License Files…
  Starting TID 3078617984/6874, procnum 4 (rmplug)
  Starting TID 3076520832/6875, procnum 5 (rmplug)
  Starting TID 3074423680/6876, procnum 6 (rmplug)
  Starting TID 3072326528/6877, procnum 7 (rmplug)
  Starting TID 3070229376/6878, procnum 8 (rmplug)
  Starting TID 3068132224/6879, procnum 9 (rmplug)
  Starting TID 3066035072/6880, procnum 10 (rmplug)
  Starting TID 3063937920/6881, procnum 11 (rmplug)
  Starting TID 3061840768/6882, procnum 12 (rmplug)
  Starting TID 3059743616/6883, procnum 13 (rmplug)
  Starting TID 3057646464/6884, procnum 14 (rmplug)
  Starting TID 3055549312/6885, procnum 15 (rmplug)
  Starting TID 3053452160/6886, procnum 16 (rmplug)
  Starting TID 3051355008/6887, procnum 17 (rmplug)
  Starting TID 3049257856/6888, procnum 18 (rmplug)
  Starting TID 3047160704/6889, procnum 19 (rmplug)
  Starting TID 3045063552/6890, procnum 20 (memreap)
  Starting TID 3042966400/6891, procnum 21 (streamer)
  [root@localhost HelixServer]# ps -ef|grep rmserver       #查看当前rmserver进程
  root      6868  6309  0 10:37 pts/1    00:00:00 ./Bin/rmserver rmserver.cfg
  root      6869  6868  6 10:37 ?        00:00:00 ./Bin/rmserver rmserver.cfg
  root      6870  6868  0 10:37 ?        00:00:00 ./Bin/rmserver rmserver.cfg
  root      6893  6309  0 10:37 pts/1    00:00:00 grep rmserver
  [root@localhost HelixServer]# cat ./Logs/rmserver.pid   #查看 HelixServer进程号
  6984
  [root@localhost HelixServer]# kill 6984       #停止HelixServer服务
 访问HelixServer管理界面在Web浏览器中输入http://HelixServer 域名或IP:端口号/admin/index.html,如http://192.168.1.90:10000/admin/index.html将弹出"用户验证"对话框,在该对话框中输入HelixServer管理员名称和密 码。用户验证通过后即可进入到HelixServer服务器管理界面IP地址绑定:当HelixServer被安装在一个拥有多个IP地址的系统上,需要指定服务器监 听的IP。加载点配置:加载点出现在Helix Server的每一个连接中.它是一个到文件实际存放位置的访问指向.下面的页面中将显示所有加载点以及它们所对应的实际存放路径. 服务器连接控制:当服务器的带宽有限时,可以根据需要限制服务器的同时连接数量,以保留一定带宽,确保用户的连接速度。如果连接数量过大,后面 用户发起的连接将会失败,并会收到服务器返回错误信信息。最大连接数"0"表示不限制连接访问控制:通过在服务器中建立访问控制规则,能有效的控制客户端在访问服务器时,允许或拒绝来自某一IP或某台机器对某个端口的访问请求。服务器监控:通过服务器监可以动态的显示服务器的当前性能,及连接数量。总结;通过这个RTMP流的优势是,可以避免视频文件被浏览器通过http方式进行下载所有流服务器存储媒体文件的方式都是将文件放在指定目录下面,且磁盘系统绝大部分I/O都是读操作,写操作只会发生在上传和更新媒体文件过程中。对于这种I/O操作特性,建议选择RAID 5用于中小规模的视频点播服务。这样可以提供比独立磁盘更高的数据安全性和读取速度,同时将成本控制在较小的范围内。实际可用容量为(N-1)个磁盘。文档 +问题 +交流 +学习+资料视频+源码分享 可以后台私信‘资料’内容包括:C/C++,Linux,Nginx,golang,ZeroMQ,MySQL,Redis,fastdfs,MongoDB,ZK,ffmpeg,流媒体, 音视频,CDN,P2P,K8S,Docker,Golang,TCP/IP,协程,嵌入式,ARM,DPDK等等。。。

本文出自快速备案,转载时请注明出处及相应链接。

本文永久链接: https://www.175ku.com/27076.html