搭載SRS伺服器(二)-RTMP部署例項
阿新 • • 發佈:2019-02-03
RTMP部署的步驟。
假設ip地址為192.168.0.41
1.第一步,獲取SRS。
git clone https://github.com/ossrs/srs
cd srs/trunk
如果提示git不存在,請自行更新
apt-get install git
2.或者使用git更新已有程式碼:
git pull
3.編譯SRS。
./configure && make
4.編寫SRS配置檔案
將以下內容儲存為檔案,譬如conf/rtmp.conf,伺服器啟動時指定該配置檔案(srs的conf資料夾有該檔案)。
# conf/rtmp.conf listen 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/live Stream: livestream
7.觀看RTMP流。
RTMP流地址為:rtmp://192.168.0.41/live/livestream
可以使用VLC觀看。
或者使用線上SRS播放器播放:srs-player
備註:請將所有例項的IP地址192.168.0.41都換成部署的伺服器IP地址。