Ubuntu安装SRS流媒体服务
通过网盘分享的文件:srs
链接: https://pan.baidu.com/s/1tdnxxUWh8edcSnXrQD1uLQ?pwd=0000 提取码: 0000
官网地址:Build | SRS
将百度网盘提供的srs 和 conf 下载或上传到指定服务器
# 安装需要的依赖包
sudo apt install -y cmake tclsh unzip gcc g++ make libpcre3-dev zlib1g-dev libssl-dev pkg-config nasm# 解压srs.zip 包
unzip srs.zipmv srs.conf srs/trunk/conf/ # 端口如果有冲突请使用自定义端口即可cd srs/trunk# 配置srs
./configure --sanitizer=off#编译
make# 启动服务
./objs/srs -c conf/srs.conf# 查看服务启动状态
./etc/init.d/srs status# 查看日志
tail -n 30 -f ./objs/srs.log# 查看进程号
ps -ef | grep srskill -9 PID# 设置开机自启动 和 崩溃重启
sudo vim /etc/systemd/system/srs.service# 填入以下内容 位置记得改对了[Unit]
Description=SRS (Simple Realtime Server)
After=network.target[Service]
Type=simple
User=root
WorkingDirectory=/root/srs/trunk
ExecStart=/root/srs/trunk/objs/srs -c /root/srs/trunk/conf/srs.conf
Restart=always
RestartSec=5s
StartLimitInterval=0
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=srs[Install]
WantedBy=multi-user.target# 特别注意 srs.conf 中 daemon 要设置为 off ,防止与系统重启冲突sudo systemctl daemon-reloadsudo systemctl start srssudo systemctl enable srssudo systemctl status srs
使用OBS或者FFmpeg进行测试
访问地址:播放地址要改为自己的 app 和 streamKey
8080:http_server listen 端口
http://你的服务器IP:8080/players/srs_player.html?autostart=true&stream=aaa.flv&port=8080&schema=http
详细功能可参考官方文档