使用 SRS/OBS/VLC 快速搭建直播服务系统

环境准备

推流服务器
  • 我用 SRS 运行在 Debian/Jessie 下 v2.0.209 。
编译安装
./configure --prefix=/opt/srs --with-stat --with-nginx --with-ffmpeg --full --jobs=32
make -j32
make -j32 install
cp -fv /opt/srs/etc/init.d/srs /etc/init.d/srs
推流工具
  • 我用 OBS MAC版 v0.15.1 ,手动下载安装。
  • 用 ffmpeg 也可以,brew 命令行安装。
拉流工具
  • 我用 VLC MAC版 v2.2.4 ,手动下载安装或用 brew 命令行安装。

配置使用

配置SRS
  • 主配置文件 /opt/srs/conf/srs.conf
listen              1935;
max_connections     1000;
srs_log_tank        file;
srs_log_file        /tmp/srs.log;
http_api {
    enabled         on;
    listen          1985;
}
http_server {
    enabled         on;
    listen 0.0.0.0:80 backlog=8192;
    server_name live.higkoo.com;
    location / {
        resolver 223.5.5.5;
        proxy_buffering off;
        proxy_set_header Host srs.higkoo.com;
        proxy_pass http://srs.higkoo.com/;
    }
    rewrite ^/(.+)\.flv$ [app]/[stream].flv;
}
stats {
    network         0;
}
vhost __defaultVhost__ {
    http_remux {
        enabled     on;
	mount     [vhost]/[app]/[stream].flv;
    }
}
向上推流
  • 将推流服务端指定到服务器IP:
    手动推流
  • 务必记住你的推流路径(/live)和流密钥(livestream)。或者用 ffmpeg:

ffmpeg -re -i /Volumes/Data/BML/Demo.MP4 -c copy -f flv rtmp://srs.higkoo.com:1935/live/livestream

手动拉流
  • 用VLC就可以在线看直播了: 在线看直播
  • 整个URL地址就是推流时用到的推流路径(/live)和流密钥(livestream)拼接而成。

测试效果

推拉流预览

测试环境

  • Debian / Jessie 8.4

Linux live626 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-1 (2016-03-06) x86_64 GNU/Linux

  • OSX EI 10.11.5

Darwin higkoo-mac-mini 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64

  • SRS/2.0.209(ZhouGuowen)

Build: 2016-06-24 08:03:25 Configuration:--x86-x64 --prefix=/usr --with-stat --with-nginx Features:--prefix=/usr --with-hls --with-hds --with-dvr --with-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 --without-arm-ubuntu12 --without-mips-ubuntu12 --log-trace

  • OBS 0.15.1 (mac)
  • VLC media player 2.2.4 Weatherwax (revision 2.2.4-3-g2fc51dd)

编译者 fpk 编译时间 rufus.local (Jun 1 2016 17:58:56) 编译器: clang: warning: argument unused during compilation: '-mmacosx-version-min=10.6'

转载于:https://my.oschina.net/higkoo/blog/710854

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值