Simple-RTMP-Server 服务器搭建
-
服务器镜像获取
github源码地址
git clone https://github.com/winlinvip/simple-rtmp-server.git
优快云镜像地址
git clone https://code.youkuaiyun.com/winlinvip/srs-csdn.git
OSChina镜像
git clone https://git.oschina.net/winlinvip/srs.oschina.git -
编译系统
./configure --disable-all --with-ssl --with-hls --with-nginx --with-ffmpeg --with-transcode
./configure --disable-all --with-ssl --with-hls --with-nginx --with-transcode(ffmpeg单独安装)
(ffmpeg安装编译:https://www.cnblogs.com/gaoguangjun/p/8512964.html)
问题1:
build x264
Found no assembler
Minimum version is nasm-2.13
If you really want to compile without asm, configure with --disable-asm.
build x264 failed
解决办法:https://blog.youkuaiyun.com/u014037733/article/details/22965139
https://blog.youkuaiyun.com/qq_39759656/article/details/80776550make && sudo make install
-
建立启动服务
3.1 建立软连接
sudo ln -sf /usr/local/srs/etc/init.d/srs /etc/init.d/srs
备注:若SRS安装到其他目录,将/usr/local/srs替换成其他目录。
备注:也可以使用其他的名称,譬如/etc/init.d/srs,可以任意名称,启动时也用该名称。
3.2. 添加服务
sudo update-rc.d srs defaults
3.3 使用init.d脚本管理SRS
查看SRS状态:
sudo /etc/init.d/srs status
启动SRS:
sudo /etc/init.d/srs start
停止SRS:
sudo /etc/init.d/srs stop
重启SRS:
sudo /etc/init.d/srs restart
Reload SRS:
sudo /etc/init.d/srs reload
-
启动分发hls(m3u8/ts)的nginx
sudo ./objs/nginx/sbin/nginx -
指定配置文件运行
./objs/srs -c ./conf/hls.conf -
启动推流编码器
使用FFMPEG命令推流:
./objs/ffmpeg/bin/ffmpeg -re -i ./doc/source.200kbps.768x320.flv -vcodec copy -acodec copy -f flv -y rtmp://srs_server_ip/live/livestream