服务搭建

从github下clone项目

git

下来后进入trunk文件夹下编译

cd

编译

我的环境是centos7
使用如下命令在trunk文件夹下进行编译

./configure --prefix=/opt/module/srs --with-hls --with-hds --with-dvr --without-nginx --with-ssl --without-ffmpeg --with-transcode --with-ingest --with-stat --with-http-callback --with-http-server --without-stream-caster --with-http-api --with-librtmp --without-research --with-utest --without-gperf --without-gmc --without-gmp --without-gcp --without-gprof

【音视频】srs直播平台搭建_音视频

make

make

完成后就可以打开服务了

打开服务

./objs/srs -c ./conf/rtmp.conf

【音视频】srs直播平台搭建_git_02

打开服务后,可以看一下是否打开服务:

ps -aux | grep

如果没有问题了,就可以视频流传输测试了

测试

首先,使用ffmpeg将视频推到服务器上:

ffmpeg -re -i ./doc/source.flv -c copy -f flv rtmp://localhost/live/livestream

此时需要将ffmpeg的项目clone下来并编译、make后运行。

如果没有报错,则表明开始推流了。

打开下面的页面播放流(若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

一点延迟后就可以看到播放了。

问题记录

librtmp 不在维护

--with-librtmp

​https://github.com/ossrs/srs-librtmp/issues/32​

解决方法

./configure --prefix=/opt/module/srs --with-hls --with-hds --with-dvr --without-nginx --with-ssl --without-ffmpeg --with-transcode --with-ingest --with-stat --with-http-callback --with-http-server --without-stream-caster --with-http-api --without-research --with-utest --without-gperf --without-gmc --without-gmp --without-gcp --without-gprof

之后就会进行编译,在停止时根据提示来安装其他工具,并再次执行上述命令。

如果出现如无法找到CherryPy-3.2.4或者其他的包

解决方法

如果出现上述问题,需要将3rdparty文件夹中的问题压缩包复制到objs文件夹下,并解压。

cp

完成后继续调用上述命令进行编译项目。

make: was not declared in this scope

可能与使用最新分支有关,我是图省事用官方的wiki实现了下,编译的时候正常~

用官方wiki试试
​​​https://ossrs.net/lts/zh-cn/docs/v4/doc/getting-started-build​