流媒体 Ubuntu部署srs、windows部署nginx

一、获取项目
//码云克隆
git clone https://gitee.com/winlinvip/srs.oschina.git srs
//github
git clone https://github.com/ossrs/srs.git
二、进入trrunk
cd trunk
三、编译
./configure && make
五、启动(指定配置文件)
./objs/srs -c conf/srs.conf
配置文件默认配置:
# main config for srs.
# @see full.conf for detail config.

listen              1935;
max_connections     1000;
srs_log_tank        file;
srs_log_file        ./objs/srs.log;
http_api {
    enabled         on;
    listen          1985;
}
http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}
stats {
    network         0;
    disk            sda sdb xvda xvdb;
}
vhost __defaultVhost__ {
}

六、ffmpeg推流测试

1、推流本地视频

ffmpeg.exe -re -i demo.wmv -f flv rtmp://127.0.0.1:1935/live/123

2、推流摄像头

  2.1、查看摄像头

  ffmpeg -list_devices true -f dshow -i dummy 

  2.2、推流

  ffmpeg -f dshow -i video="devicesname" -vcodec libx264 -preset:v ultrafast -tune:v zerolatency -f flv rtmp://127.0.0.1:1935/live/123
七、ffplay验证
ffplay "rtmp://127.0.0.1:1935/live/123"
 
八、windows部署nginx
1、下载支持rtmp的nginx
  1.1、下载可用的nginx
  url:http://nginx-win.ecsds.eu/download/nginx%201.7.11.3%20Gryphon.zip
  1.2下载rtmp模块解压后放在nginx.exe的同级目录
  https://codeload.github.com/arut/nginx-rtmp-module/zip/master
2、配置nginx
详情:https://blog.csdn.net/defonds/article/details/9274479/
rtmp {
    server {
        listen 1935;
        chunk_size 4096;
        application live {
            live on;
        }
    }
}

3、启动nginx,cmd进入nginx目录

 nginx.exe -c conf\nginx-win.conf

posted @ 2020-08-18 23:56  zebra_彬  阅读(776)  评论(0编辑  收藏  举报