# SRS https://github.com/ossrs/srs # SRS - 4.0release 参考 https://github.com/ossrs/srs/wiki/v4_CN_Home ``` # 下载源码 git clone -b 4.0release https://gitee.com/ossrs/srs.git # 编译 cd srs/trunk ./configure make # 启动服务器 ./objs/srs -c conf/srs.conf # 查看SRS的状态 ./etc/init.d/srs start ./etc/init.d/srs status ./etc/init.d/srs stop # 或者看SRS的日志 tail -n 30 -f ./objs/srs.log # SRS HOME http://localhost:8080/ # SRS console http://localhost:8080/console/ng_index.html#/summaries?port=1985 # SRS player http://localhost:8080/players/srs_player.html?autostart=true ``` # SRS - feature/gb28181 ## 编译 SRS --with-gb28181 参考 https://github.com/ossrs/srs/issues/1500#issue-528623588 https://github.com/xialixin/srs_code_note/blob/master/doc/srs_gb28181.md https://github.com/ossrs/srs/issues/2763 https://github.com/ossrs/srs/wiki/v4_CN_WebRTC ### 编译 SRS ``` git checkout feature/gb28181 && ./configure --with-gb28181 && make clean && make ``` ### 修改 SRS 启动参数 ./conf/push.gb28181.conf 用于 GB28181 UDP 传输,适用于局域网 ./conf/push.gb28181.tcp.conf 用于 GB28181 TCP 传输,适用于互联网 ``` vim conf/push.gb28181.conf # 修改此参数为你的服务器IP,用于 SIP 服务器 stream_caster { host 192.168.1.70; } # 修改此参数为你的服务器IP,用于 webrtc 播放 rtc_server { candidate 192.168.1.70; } # 添加此参数,用于 webrtc 播放 vhost __defaultVhost__ { rtc { rtmp_to_rtc on; } } sip { # sip监听udp端口 listen 5060; # SIP server ID(SIP服务器ID). # 设备端配置编号需要与该值一致,否则无法注册 serial 34020000002000000001; # SIP server domain(SIP服务器域) realm 3402000000; } ``` ### 启动 SRS ``` # 启动 ./objs/srs -c conf/push.gb28181.conf # 查看SRS的状态 ./etc/init.d/srs start ./etc/init.d/srs status ./etc/init.d/srs stop # SRS HOME http://192.168.1.70:8080/ # SRS console http://192.168.1.70:8080/console/ng_index.html#/summaries?port=1985 # SRS player http://192.168.1.70:8080/players/srs_player.html?autostart=true ``` ## 设备通过 GB28181 注册 SRS 的 SIP 参考 https://github.com/xialixin/srs_code_note/blob/master/doc/srs_gb28181.md https://mp.weixin.qq.com/s/VIPSPaBB5suUk7_I2oOkMw https://blog.csdn.net/jiuaiwo1314/article/details/104986626 chrome://webrtc-internals ### IPC 配置 SIP 界面 海康 IPC 配置界面 ![](https://github.com/xialixin/srs_code_note/raw/master/doc/srs_gb28181_hik_nvr.jpg) 大华IPC配置界面 ![](https://github.com/xialixin/srs_code_note/raw/master/doc/srs_gb28181_dh_ipc.jpg) ### IPC 配置 SIP 信息 设备端进行配置相应的SRS SIP信息,四元组(SIP ID、域、IP和端口) ![](https://mmbiz.qpic.cn/mmbiz_png/LMDDiaViaw3KJmWbmELwsnWeR0AOfuibk1OZonLg1zr498N7sicjK83T9ib3VXAf9Nang53XAcibawhg40XFNGaA7Jsw/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1) 设备端配置正确后,则设备会注册上来,SRS会默认调用INVITE进行拉流 ![](https://mmbiz.qpic.cn/mmbiz_png/LMDDiaViaw3KJmWbmELwsnWeR0AOfuibk1OD1cvC3ypkQkqWG7WRIiaxQ2Egu08iaEicQDHZHfEzOE0vnBtTfbbOoibiaQ/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1) ### 查看 IPC 注册效果