[常用工具] live555的搭建
live555是一个为流媒体提供解决方案的跨平台的C++开源项目,它实现了对标准流媒体传输协议如RTP/RTCP、RTSP、SIP等的支持。使用live555可以播放rtsp流。本文主要是在linux下搭建使用live555搭建rtsp server,主要步骤如下:
-
下载源码并编译http://www.live555.com/liveMedia/public/live555-latest.tar.gz,linux命令行输入如下代码
cdd /app wget http://www.live555.com/liveMedia/public/live555-latest.tar.gz tar xzf live555-latest.tar.gz cd live ./genMakefiles linux-64bit #注意后面这个参数是根据当前文件夹下config.<后缀>获取得到的 make #编译
-
编译完成后在当前目录下生成mediaServer文件夹,进入该文件夹运行live555MediaServer文件。命令行代码如下:
cd mediaServer ./live555MediaServer
执行live555MediaServer文件后结果如下:
LIVE555 Media Server
version 1.00 (LIVE555 Streaming Media library version 2020.04.24).
Play streams from this server using the URL
rtsp://192.21.11.140/<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 8000 for optional RTSP-over-HTTP tunneling, or for HTTP live streaming (for indexed Transport Stream files only).)
结果中的rtsp://192.21.11.140/就是rtsp路径。将1.264文件放入mediaServer/test文件夹下。在浏览器中调用rtsp://192.21.11.140/test/1.264便能够远程播放该视频。
如果是编程调用该rtsp,则需要使用端口号也就是port 8000。
此外如果要本机调用,可以使用下列方式编写本地rtsp路径
rtsp://127.0.0.1:554/1.264
- 关闭命令行后,live555MediaServer就会关闭。如果想关闭命令行后继续运行,执行下述命令,在关闭命令行后服务会继续运行。
nohup ./live555MediaServer &
文章备份
https://luohenyueji.gitee.io
参考
LIVE555学习1:Linux下live555的编译及测试
使用live555 在linux下搭建 rtsp server
本文来自博客园,作者:落痕的寒假,转载请注明原文链接:https://www.cnblogs.com/luohenyueji/p/16970275.html
![](https://gitcode.net/LuohenYJ/article_picture_warehouse/-/raw/main/wechat/content/%E5%8A%A0%E6%B2%B9%E9%B8%AD.gif)