1.下载源码:
git clone -b 4.0release https://gitee.com/ossrs/srs.git
2.编译:
cd srs/trunk
./configure
make
3.启动服务器:
./objs/srs -c conf/srs.conf ###不支持webrtc
或者
./objs/srs -c conf/rtmp2rtc.conf ###支持本地webrtc(http访问)
或者
./objs/srs -c conf/https.rtc.conf ###支持本地webrtc(https访问需要证书)
4. 查看SRS的状态
./etc/init.d/srs status
5.查看SRS的日志
tail -n 30 -f ./objs/srs.log
6.使用FFmpeg或OBS推流(实例文件./doc/source.flv在SRS的源代码目录中有):
ffmpeg -re -i ./doc/source.flv -c copy -f flv rtmp://localhost/live/livestream
7.打开下面的页面播放流(若SRS不在本机,请将localhost更换成服务器IP):
RTMP (by VLC): rtmp://localhost/live/livestream
H5(HTTP-FLV): http://localhost:8080/live/livestream.flv
H5(HLS): http://localhost:8080/live/livestream.m3u8
WebRTC: webrtc://localhost/live/livestream
8.webrtc 需要配置CANDIDATE
CANDIDATE="192.168.5.22"