简介
是一个为流媒体提供解决方案的跨平台的C++开源项目,它实现了对标准流媒体传输是一个为流媒体提供解决方案的跨平台的C++开源项目,它实现了对标准流媒体传输协议如RTP/RTCP、RTSP、SIP等的支持。Live555实现了对多种音视频编码格式的音视频数据的流化、接收和处理等支持,包括MPEG、H.263+、DV、JPEG视频和多种音频编码。同时由于良好的设计,Live555非常容易扩展对其他格式的支持。目前,Live555已经被用于多款播放器的流媒体播放功能的实现,如VLC(VideoLan)、MPlayer。
编译安装
代码下载
wget http://www.live555.com/liveMedia/public/live555-latest.tar.gz
解压
tar xzf live555-latest.tar.gz
cd live
生成makefile文件
./genMakefiles armlinux #注意后面这个参数是根据当前操作系统选择合适的config.<后缀>文件获取得到的
编译生成
make
最后就会在当前目录下生成mediaServer 文件夹,有一个live555MediaServer可执行文件。 这样就启动了一个RTSP服务器, 可以看到并不是支持所有的视频格式(不支持MP4格式文件)。
运行测试
# ./live555MediaServer
LIVE555 Media Server
version 1.10 (LIVE555 Streaming Media library version 2022.07.14).
Play streams from this server using the URL
rtsp://192.168.12.208:8554/<filename>
where <filename> is a file present in the current directory.
Each file's type is inferred from its name suffix:
".264" => a H.264 Video Elementary Stream file
".265" => a H.265 Video Elementary Stream file
".aac" => an AAC Audio (ADTS format) file
".ac3" => an AC-3 Audio file
".amr" => an AMR Audio file
".dv" => a DV Video file
".m4e" => a MPEG-4 Video Elementary Stream file
".mkv" => a Matroska audio+video+(optional)subtitles file
".mp3" => a MPEG-1 or 2 Audio file
".mpg" => a MPEG-1 or 2 Program Stream (audio+video) file
".ogg" or ".ogv" or ".opus" => an Ogg audio and/or video file
".ts" => a MPEG Transport Stream file
(a ".tsx" index file - if present - provides server 'trick play' support)
".vob" => a VOB (MPEG-2 video with AC-3 audio) file
".wav" => a WAV Audio file
".webm" => a WebM audio(Vorbis)+video(VP8) file
See http://www.live555.com/mediaServer/ for additional documentation.
(We use port 80 for optional RTSP-over-HTTP tunneling).)
注意:
1)rtsp://192.168.12.208:8554/<filename>当前的访问端口是8554
2)文件后缀264前面没有h
3)不支持MP4格式
编译错误记录
1)c++: error: unrecognized command line option '-m64'
执行指令./genMakefiles linux-64bit 出错提示如下:
cd liveMedia ; make
make[1]: Entering directory `/home/dong/live555/live/liveMedia'
c++ -c -Iinclude -I../UsageEnvironment/include -I../groupsock/include -m64 -fPIC -I/usr/local/include -I. -O2 -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -Wall -DBSD=1 Media.cpp
c++: error: unrecognized command line option '-m64'
make[1]: *** [Media.o] Error 1
解决:目前操作系统是版本:
[root@taishan-atlas opt]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (AltArch)
linux-64bit是x86架构64位操作系统的编译版本,对应的配置文件是config.linux-64bit
由于目前对应的是ARM版本,因此对应的配置文件是config.armlinux
2)make[1]: arm-elf-g++: Command not found
[root@taishan-atlas live]# ./genMakefiles armlinux
[root@taishan-atlas live]# make
cd liveMedia ; make
make[1]: Entering directory `/home/dong/live555/live/liveMedia'
arm-elf-g++ -c -Iinclude -I../UsageEnvironment/include -I../groupsock/include -I/usr/local/include -I. -O2 -DSOCKLEN_T=socklen_t -DNO_SSTREAM=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -Wall -DBSD=1 Media.cpp
make[1]: arm-elf-g++: Command not found
make[1]: *** [Media.o] Error 127
原因:config.armlinux配置文件中第一行CROSS_COMPILE?=存在一个arm-elf变量,最后会追加到g++前面,直接去掉,留空就行,然后重新生成Makefile文件
文件修改为
CROSS_COMPILE?=
COMPILE_OPTS = $(INCLUDES) -I/usr/local/include -I. -O2 -DSOCKLEN_T=socklen_t -DNO_SSTREAM=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
C = c
C_COMPILER = $(CROSS_COMPILE)gcc
C_FLAGS = $(COMPILE_OPTS)
CPP = cpp
CPLUSPLUS_COMPILER = $(CROSS_COMPILE)g++
CPLUSPLUS_FLAGS = $(COMPILE_OPTS) -Wall -DBSD=1
OBJ = o
LINK = $(CROSS_COMPILE)g++ -o
LINK_OPTS =
CONSOLE_LINK_OPTS = $(LINK_OPTS)
LIBRARY_LINK = $(CROSS_COMPILE)ar cr
LIBRARY_LINK_OPTS = $(LINK_OPTS)
LIB_SUFFIX = a
LIBS_FOR_CONSOLE_APPLICATION = -lssl -lcrypto
LIBS_FOR_GUI_APPLICATION =
EXE =
英文编译说明
How to configure and build the code on Unix (including Linux, Mac OS X, QNX, and other Posix-compliant systems)
The source code package can be found (as a ".tar.gz" file) here. Use "tar -x" and "gunzip" (or "tar -xz", if available) to extract the package; then cd to the "live" directory. Then run
./genMakefiles <os-platform>
where <os-platform> is your target platform - e.g., "linux" or "solaris" - defined by a "config.<os-platform>" file. This will generate a Makefile in the "live" directory and each subdirectory. Then run "make".
If the "make" fails, you may need to make small modifications to the appropriate "config.<os-platform>" file, and then re-run "genMakefiles <os-platform>". (E.g., you may need to add another "-I<dir>" flag to the COMPILE_OPTS definition.)
Some people (in particular, FreeBSD users) have reported that the GNU version of "make" - often called "gmake" - works better than their default, pre-installed version of "make". (In particular, you should try using "gmake" if you encounter linking problems with the "ar" command.)
If you're using "gcc" version 3.0 or greater: You may also wish to add the -Wno-deprecated flag to CPLUSPLUS_FLAGS.
If no "config.<os-platform>" file exists for your target platform, then try using one of the existing files as a template.
If you wish, you can also 'install' the headers, libraries, and applications by running "make install".