live555源码分析系列
live555源码分析(一)live555初体验
live555源码分析(二)基本组件上
live555源码分析(三)基本组件下
live555源码分析(四)RTSPServer分析
live555源码分析(五)DESCRIBE请求的处理
live555源码分析(六)SETUP和PLAY请求的处理
live555源码分析(七)播放过程
live555源码分析(八)多播
一个为流媒体提供解决方案的跨平台的C++开源项目,它实现了对标准流媒体传输是一个为流媒体提供解决方案的跨平台的C++开源项目,它实现了对标准流媒体传输协议如RTP/RTCP、RTSP、SIP等的支持。Live555实现了对多种音视频编码格式的音视频数据的流化、接收和处理等支持,包括MPEG、H.263+、DV、JPEG视频和多种音频编码。同时由于良好的设计,Live555非常容易扩展对其他格式的支持。目前,Live555已经被用于多款播放器的流媒体播放功能的实现,如VLC(VideoLan)、MPlayer
上述简介来自百度,简单的说,live555常被用来二次开发做RTSP服务器,它支持多种音视频格式,容易扩展
live555下载地址
其中live555-latest.tar.gz
为live555的最新版本,各文件夹下面存放着相应格式的音视频文件
点击下载live555-latest.tar.gz
将压缩包拷贝到Linux平台,解压
# tar vxf live555-latest.tar.gz
进入目录
# cd live
在live555的根目录下有一个genMakefiles
文件,还有许多配置文件config.linux
、config.macosx
等等
根据自己的平台执行genMakefiles
# ./genMakefiles linux
执行之后会生成一个Makefile文件,执行make开始编译
# make
编译完成后,在mediaServer
目录下会生成live555MediaServer
,这是live555实现的一个rtsp服务器
在testProgs
目录有一系列的测试程序
并且会生成相应的库
./liveMedia/libliveMedia.a
./groupsock/libgroupsock.a
./UsageEnvironment/libUsageEnvironment.a
./BasicUsageEnvironment/libBasicUsageEnvironment.a
安装库
# make install
将一个test.264
视频文件拷贝到testProgs
目录下
运行testH264VideoStreamer
,这是一个多播H264文件的Rtsp服务器,它会播放test.264
./testH264VideoStreamer
运行过后,控制台会打印
Play this stream using the URL "rtsp://192.168.31.115:8554/testStream"
在vlc输入urlrtsp://192.168.31.115:8554/testStream
就可以看到视频了
再测试testOnDemandRTSPServer
,这是一个点播的单播Rtsp服务器,运行
./testOnDemandRTSPServer
控制台会打印
"mpeg4ESVideoTest" stream, from the file "test.m4e"
Play this stream using the URL "rtsp://192.168.31.115:8554/mpeg4ESVideoTest"
"h264ESVideoTest" stream, from the file "test.264"
Play this stream using the URL "rtsp://192.168.31.115:8554/h264ESVideoTest"
"h265ESVideoTest" stream, from the file "test.265"
Play this stream using the URL "rtsp://192.168.31.115:8554/h265ESVideoTest"
"mpeg1or2AudioVideoTest" stream, from the file "test.mpg"
Play this stream using the URL "rtsp://192.168.31.115:8554/mpeg1or2AudioVideoTest"
"mpeg1or2ESVideoTest" stream, from the file "testv.mpg"
Play this stream using the URL "rtsp://192.168.31.115:8554/mpeg1or2ESVideoTest"
"mp3AudioTest" stream, from the file "test.mp3"
Play this stream using the URL "rtsp://192.168.31.115:8554/mp3AudioTest"
"wavAudioTest" stream, from the file "test.wav"
Play this stream using the URL "rtsp://192.168.31.115:8554/wavAudioTest"
"amrAudioTest" stream, from the file "test.amr"
Play this stream using the URL "rtsp://192.168.31.115:8554/amrAudioTest"
"vobTest" stream, from the file "test.vob"
Play this stream using the URL "rtsp://192.168.31.115:8554/vobTest"
"mpeg2TransportStreamTest" stream, from the file "test.ts"
Play this stream using the URL "rtsp://192.168.31.115:8554/mpeg2TransportStreamTest"
"aacAudioTest" stream, from the file "test.aac"
Play this stream using the URL "rtsp://192.168.31.115:8554/aacAudioTest"
"dvVideoTest" stream, from the file "test.dv"
Play this stream using the URL "rtsp://192.168.31.115:8554/dvVideoTest"
"ac3AudioTest" stream, from the file "test.ac3"
Play this stream using the URL "rtsp://192.168.31.115:8554/ac3AudioTest"
"matroskaFileTest" stream, from the file "test.mkv"
Play this stream using the URL "rtsp://192.168.31.115:8554/matroskaFileTest"
"webmFileTest" stream, from the file "test.webm"
Play this stream using the URL "rtsp://192.168.31.115:8554/webmFileTest"
"oggFileTest" stream, from the file "test.ogg"
Play this stream using the URL "rtsp://192.168.31.115:8554/oggFileTest"
"opusFileTest" stream, from the file "test.opus"
Play this stream using the URL "rtsp://192.168.31.115:8554/opusFileTest"
"mpeg2TransportStreamFromUDPSourceTest" stream, from a UDP Transport Stream input source
(IP multicast address 239.255.42.42, port 1234)
Play this stream using the URL "rtsp://192.168.31.115:8554/mpeg2TransportStreamFromUDPSourceTest"
(We use port 80 for optional RTSP-over-HTTP tunneling.)
在vlc输入urlrtsp://192.168.31.115:8554/h264ESVideoTest
,就可以看到视频文件了