rtsp开源服务器之live555

Live555是一个实现了RTSP协议的开源流媒体框架,Live555包含RTSP服务器端的实现以及RTSP客户端的实现。Live555可以将若干种格式的视频文件或者音频文件转换成视频流或者音频流在网络中通过RTSP协议分发传播,这便是流媒体服务器最核心的功能。Live555支持以下几种文件格式的流化:  

A MPEG Transport Stream file (with file name suffix ".ts")A Matroska or WebM file (with filename suffix ".mkv" or ".webm")An Ogg file (with filename suffix ".ogg", "ogv", or ".opus")A MPEG-1 or 2 Program Stream file (with file name suffix ".mpg")A MPEG-4 Video Elementary Stream file (with file name suffix ".m4e")A H.264 Video Elementary Stream file (with file name suffix ".264")A H.265 Video Elementary Stream file (with file name suffix ".265")A VOB video+audio file (with file name suffix ".vob")A DV video file (with file name suffix ".dv")A MPEG-1 or 2 (including layer III - i.e., 'MP3') audio file (with file name suffix ".mp3")A WAV (PCM) audio file (with file name suffix ".wav")An AMR audio file (with file name suffix ".amr")An AC-3 audio file (with file name suffix ".ac3")An AAC (ADTS format) audio file (with file name suffix ".aac")

  经过Live555流化后的视频流或者音频流可以通过实现了标准RTSP协议的播放器(如VLC)来播放。

  Live555的官网:http://www.live555.com/,下载Live555的源代码:
http://www.live555.com/liveMedia/public/

下载源码后解压得到live目录,目录结构如下,lib目录是编译后产生的目录:


主要使用其中的四个目录,分别对应Live555的四个库:

    UsageEnvironment目录,生成的静态库为libUsageEnvironment.lib,这个库主要包含一些基本数据结构以及工具类的定义

    groupsock目录,生成的静态库为libgroupsock.lib,这个库主要包含网络相关类的定义和实现

    liveMedia目录,生成的静态库为libliveMedia.lib,这个库包含了Live555核心功能的实现

    BasicUsageEnvironment目录,生成的静态库为
libBasicUsageEnvironment.lib,这个库主要包含对UsageEnvironment库中一些类的实现

  mediaServer目录中包含Live555流媒体服务器的标准示例程序,运行live555MediaServer.exe后出现如下界面:

   

  在mediaServer目录中放入你的媒体文件,如test.mp3,在VLC播放器中选择“媒体”-“打开网络串流”,然后输入
rtsp://127.0.0.1:8554/test.mp3 就可以播放刚才的mp3文件了。

  proxyServer目录中是live555实现的代理服务器的例子程序,这个程序可以从其他的流媒体服务器(如支持RTSP的摄像机)取实时的视频流然后转发给多个RTSP客户端,这个程序很有用,可以转发摄像机的实时视频流。

  testProgs目录中包含很多的测试例子程序,我经常用的是
testOnDemandRTSPServer.cpp,我是从这个例子程序开始学习Live555的。