1.在ubuntu中安装好git
2.下载项目
官网链接:https://github.com/ZLMediaKit/ZLMediaKit/wiki/%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B
#国内用户推荐从同步镜像网站gitee下载
git clone --depth 1 https://gitee.com/xia-chu/ZLMediaKit
cd ZLMediaKit
#千万不要忘记执行这句命令
git submodule update --init
3.运行
cd ZLMediaKit/release/linux/Debug
#通过-h可以了解启动参数
./MediaServer -h
#以守护进程模式启动
./MediaServer -d &
4.推流测试
静态视频推流
192.168.123.80,192.168.56.101为ubuntu虚拟机地址(中间有换过地址)
rtsp推流
ffmpeg -re -i "mbycut.mp4" -vcodec h264 -acodec aac -strict -2 -f rtsp -rtsp_transport tcp rtsp://192.168.56.101/live/test
rtsp方式拉流
ffplay rtsp://192.168.56.101/live/test
rtp推流
ffmpeg -re -i "mbycut.mp4" -vcodec h264 -acodec aac -f rtp_mpegts rtp://192.168.123.80:10001/live/test
rtp拉流
ffplay rtp://192.168.123.80:10001/live/test
rtmp推流
ffmpeg -re -i "mbycut.mp4" -vcodec h264 -acodec aac -strict -2 -f flv rtmp://192.168.123.80/live/test
rtmp拉流
ffplay rtmp://192.168.123.80/live/test
5.不缓存的方式拉流
rtsp方式拉流
ffplay rtsp://192.168.123.80/live/test -analyzeduration 1 -fflags nobuffer
6.使用ONVIF Device Manage工具获取摄像头输出流地址
//调用ZLMediaKit接口addStreamProxy获取一个新地址
摄像头播放流地址rtsp://username:xxx@192.168.123.46:554/Streaming/Channels/1?transportmode=unicast&profile=Profile_1
注意:secret参数在ZLMediaKit-master的conf目录的config.imi文件中
//通过ZLMediaKit获取的播放流地址
ffplay -rtsp_transport tcp -fflags nobuffer -analyzeduration 500000 -i rtsp://192.168.123.80/live/test