搭载SRS服务器(二)-RTMP部署实例

来源:互联网 发布:工商银行客户端 mac 编辑:程序博客网 时间:2024/06/05 17:38

RTMP部署的步骤。
假设ip地址为192.168.0.41
1.第一步,获取SRS。

git clone https://github.com/ossrs/srscd srs/trunk

如果提示git不存在,请自行更新

apt-get install git

2.或者使用git更新已有代码:

git pull

3.编译SRS。

./configure && make

4.编写SRS配置文件

将以下内容保存为文件,譬如conf/rtmp.conf,服务器启动时指定该配置文件(srs的conf文件夹有该文件)。

# conf/rtmp.conflisten              1935;max_connections     1000;vhost __defaultVhost__ {}

5.启动SRS。

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

6.启动推流编码器。

 for((;;)); do \       ./objs/ffmpeg/bin/ffmpeg -re -i     ./doc/source.200kbps.768x320.flv \    -vcodec copy -acodec copy \    -f flv -y rtmp://192.168.1.170/live/livestream; \    sleep 1; \done

或使用FMLE推流:

FMS URL: rtmp://192.168.1.170/liveStream: livestream

7.观看RTMP流。

RTMP流地址为:rtmp://192.168.0.41/live/livestream

可以使用VLC观看。

或者使用在线SRS播放器播放:srs-player

备注:请将所有实例的IP地址192.168.0.41都换成部署的服务器IP地址。

原创粉丝点击