在windows下安装配置nginx + nginx-rtmp-module + OBS + VLC player

1. 下载 nginx 1.7.11.3 Gryphon
下载链接: http://nginx-win.ecsds.eu/download/nginx 1.7.11.3 Gryphon.zip
下载完成后解压;将解压后的目录名:  nginx 1.7.11.3 Gryphon 改成: nginx-1.7.11

为什么是这个版本呢 (nginx 1.7.11.3 Gryphon)(这是http://nginx-win.ecsds.eu/组织编译好的,非官方)。
这个版本好像是windows平台最后一款支持rtmp直播模块的nginx windows编译版本(非官方)。
其他版本不行么?可以啊,自己编译(推荐虚拟机编译)

2. 下载服务器状态检查程序 stat.xsl
https://github.com/arut/nginx-rtmp-module/
将nginx-rtmp-module-master.zip解压后复制到目录:nginx-1.7.11下,
保证stat.xls的目录为: nginx-1.7.11\nginx-rtmp-module\stat.xsl
3. 配置conf\nginx.conf文件(nginx-win.conf改名)内容如下:

#user  nobody;
worker_processes  2;
events {
    worker_connections  8192;
}
rtmp {
    server {
        listen 1935;
        application live { # 这个名字可以任意取
            live on; # 开启直播
        }        
        application hls {
            live on;
            hls on;
            hls_path D:/bigdata/nginx-1.7.11/html/hls;
            hls_fragment 5s;
        }
    }
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        off;
    server_names_hash_bucket_size 128;
    ## Start: Timeouts ##
    client_body_timeout   10;
    client_header_timeout 10;
    keepalive_timeout     30;
    send_timeout          10;
    keepalive_requests    10;
    ## End: Timeouts ##
    server {
        listen       80;
        server_name  localhost;   
        location /stat { # 服务器状态检查程序
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }
        location /stat.xsl { # 服务器状态检查程序
            root D:/bigdata/nginx-1.7.11/nginx-rtmp-module;
        }
        location / {
            root   html;
            index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

启动nginx,打开“http://localhost/stat”可查看状态。

4,下载安装OBS open broadcast software,版本为21.0.1 下载 https://obsproject.com/download

安装好后开始配置,在“来源”页签界面点+按钮,选“媒体源”,勾选本地文件,循环等,然后选一个视频文件,确定。

点文件菜单-设置,点“流”树形菜单,在URL中填rtmp://192.168.20.211/live,流名称填test,确定。在“输出”树形菜单,录像路径选本地一个文件夹,确定。

安装好VLC player后,点主界面右下角的“开始录制”,“开始推流”按钮。

5,安装VLC player软件,测试

点“媒体”菜单,选“打开网络串流”,URL中输入:rtmp://192.168.20.211/live/test,然后点播放(先操作第4步的开始推流)。

 

posted @ 2018-02-09 16:21  涓水之子  阅读(1200)  评论(0)    收藏  举报