喜欢就关注我们吧!

 写此篇文章属于笔者在开发项目中,对项目开发架构的一种选型,目前正在探索阿里云的视频直播服务和nginx自行搭建流媒体服务器,希望能选择最优的一种方案,进行开发。

以下是使用nginx自行搭建rtmp流媒体服务器,分别从windows系统和linux系统中进行搭建。


一、Windows系统搭建

nginx下载地址:http://nginx-win.ecsds.eu/download/nginx 1.7.11.3 Gryphon.zip

rtmp下载地址:https://github.com/arut/nginx-rtmp-module/

1.引入rtmp模块

下载完成后新建文件夹 nginx 1.7.11.3 Gryphon

将 nginx 1.7.11.3 Gryphon.zip 压缩包解压到  nginx 1.7.11.3 Gryphon

然后将 nginx-rtmp-module 复制到 nginx 的根目录下,如下图所示

2.新建配置文件

在 nginx 根目录下新建文件 /conf/nginx.conf,文件内容为

#user  nobody;# multiple workers works !worker_processes  2; #error_log  logs/error.log;#error_log  logs/error.log  notice;#error_log  logs/error.log  info; #pid        logs/nginx.pid; events {    worker_connections  8192;    # max value 32768, nginx recycling connections+registry optimization =     #   this.value * 20 = max concurrent connections currently tested with one worker    #   C1000K should be possible depending there is enough ram/cpu power    # multi_accept on;} rtmp {    server {        listen 1935;        chunk_size 4000;        application live {             live on;              # record first 1K of stream             record all;             record_path /tmp/av;             record_max_size 1K;              # append current timestamp to each flv             record_unique on;              # publish only from localhost             allow publish 127.0.0.1;             deny publish all;              #allow play all;        }    }} http {    #include      /nginx/conf/naxsi_core.rules;    include       mime.types;    default_type  application/octet-stream;     #log_format  main  '$remote_addr:$remote_port - $remote_user [$time_local] "$request" '    #                  '$status $body_bytes_sent "$http_referer" '    #                  '"$http_user_agent" "$http_x_forwarded_for"';     #access_log  logs/access.log  main; #     # loadbalancing PHP#     upstream myLoadBalancer {#         server 127.0.0.1:9001 weight=1 fail_timeout=5;#         server 127.0.0.1:9002 weight=1 fail_timeout=5;#         server 127.0.0.1:9003 weight=1 fail_timeout=5;#         server 127.0.0.1:9004 weight=1 fail_timeout=5;#         server 127.0.0.1:9005 weight=1 fail_timeout=5;#         server 127.0.0.1:9006 weight=1 fail_timeout=5;#         server 127.0.0.1:9007 weight=1 fail_timeout=5;#         server 127.0.0.1:9008 weight=1 fail_timeout=5;#         server 127.0.0.1:9009 weight=1 fail_timeout=5;#         server 127.0.0.1:9010 weight=1 fail_timeout=5;#         least_conn;#     }     sendfile        off;    #tcp_nopush     on;     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 ##     #gzip  on;     server {        listen       80;        server_name  localhost;          location /stat {            rtmp_stat all;            rtmp_stat_stylesheet stat.xsl;        }        location /stat.xsl {            root nginx-rtmp-module/;        }        location /control {            rtmp_control all;        }         #charset koi8-r;        #access_log  logs/host.access.log  main;         ## Caching Static Files, put before first location        #location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {        #    expires 14d;        #    add_header Vary Accept-Encoding;        #} # For Naxsi remove the single # line for learn mode, or the ## lines for full WAF mode        location / {            #include    /nginx/conf/mysite.rules; # see also http block naxsi include line            ##SecRulesEnabled;         ##DeniedUrl "/RequestDenied";         ##CheckRule "$SQL >= 8" BLOCK;         ##CheckRule "$RFI >= 8" BLOCK;         ##CheckRule "$TRAVERSAL >= 4" BLOCK;         ##CheckRule "$XSS >= 8" BLOCK;            root   html;            index  index.html index.htm;        } # For Naxsi remove the ## lines for full WAF mode, redirect location block used by naxsi        ##location /RequestDenied {        ##    return 412;        ##} ## Lua examples !#         location /robots.txt {#           rewrite_by_lua '#             if ngx.var.http_host ~= "localhost" then#               return ngx.exec("/robots_disallow.txt");#             end#           ';#         }        #error_page  404              /404.html;        # redirect server error pages to the static page /50x.html        #        error_page   500 502 503 504  /50x.html;        location = /50x.html {            root   html;        }        # proxy the PHP scripts to Apache listening on 127.0.0.1:80        #        #location ~ \.php$ {        #    proxy_pass   http://127.0.0.1;        #}        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000        #        #location ~ \.php$ {        #    root           html;        #    fastcgi_pass   127.0.0.1:9000; # single backend process        #    fastcgi_pass   myLoadBalancer; # or multiple, see example above        #    fastcgi_index  index.php;        #    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;        #    include        fastcgi_params;        #}        # deny access to .htaccess files, if Apache's document root        # concurs with nginx's one        #        #location ~ /\.ht {        #    deny  all;        #}    }    # another virtual host using mix of IP-, name-, and port-based configuration    #    #server {    #    listen       8000;    #    listen       somename:8080;    #    server_name  somename  alias  another.alias;    #    location / {    #        root   html;    #        index  index.html index.htm;    #    }    #}    # HTTPS server    #    #server {    #    listen       443 ssl spdy;    #    server_name  localhost;    #    ssl                  on;    #    ssl_certificate      cert.pem;    #    ssl_certificate_key  cert.key;    #    ssl_session_timeout  5m;    #    ssl_prefer_server_ciphers On;    #    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;    #    ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:ECDH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!eNULL:!MD5:!DSS:!EXP:!ADH:!LOW:!MEDIUM;    #    location / {    #        root   html;    #        index  index.html index.htm;    #    }    #}}

3.启动服务

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

4.测试启动成功

浏览器打开地址 http://127.0.0.1/ 打开如下所示即可

二、OBS Studio测试

1.下载OBS

https://obsproject.com/

2.设置OBS

3.效果展示

1、ffmpeg拉流

rtmp服务器_nginx+windwos 搭建 rtmp 流媒体服务器相关推荐

  1. 海康摄像机视频rtsp转rtmp,windows下搭建nginx流媒体服务器,使用ffmpeg推流。

    1.运行nginx服务: cmd命令运行切换目录 cd/ e: cd E:\nginx nginx.exe -c conf/nginx-win.conf 2.ffmpeg视频推流 cmd命令切换目录 ...

  2. 手把手教你搭建Nginx-rtmp流媒体服务器+使用ffmpeg推流

    手把手教你搭建Nginx-rtmp流媒体服务器+使用ffmpeg推流 转载自:https://www.jianshu.com/p/06c2025edcd3 by – paperfish 最近尝试着搭建 ...

  3. 搭建Nginx-rtmp流媒体服务器+使用ffmpeg推流

    搭建Nginx-rtmp流媒体服务器+使用ffmpeg推流 硕士毕业后,一直从事算法工程师,具有丰富的深度学习,图像视频处理经验,因此录制了一些课程,欢迎大家观看,有问题可以找我私聊:QQ:81664 ...

  4. linux搭建rtsp服务端,手把手搭建RTSP流媒体服务器

    0.引言 本文主要讲解如何搭建RTSP流媒体服务器的过程,使用开源项目ZLMediaKit.通过这个开源项目,推RTSP流到服务器,然后拉流端可以拉取RTSP.RTMP等流. ZLMediaKit码云 ...

  5. FFmpeg入门详解之100:搭建Nginx流媒体服务器

    这里小编给大家推荐一款流媒体服务器Nginx,可以实现RTMP和HLS等.搭建完成后,可以使用FFmpeg推流,实现直播功能. 注意:操作环境是Ubuntu18.04, 总共分为几个步骤: 1.安装N ...

  6. linux vlc流媒体服务器,vlc media server rtsp 流媒体服务器搭建成功经验分享

    vlc 由videolan.org 出品,开源免费的一款本地和网络播放器,支持个音视频格式非常多,还可以用来搭建 rtsp 流媒体服务器,非常好用,支持的平台很多:windows.mac.linux都 ...

  7. python打造流媒体服务器_使用Flask搭建一个流媒体服务器

    摘要 收到前不久订阅的PythonWeekly发过来的一个邮件通知,由Miguel写的一篇介绍如何使用Flask搭建一个流媒体服务器的文章,思路很新颖也很有意思.你可以点击这里阅读英文原文.或者跟随本 ...

  8. 使用Flask搭建一个流媒体服务器

    摘要 收到前不久订阅的PythonWeekly发过来的一个邮件通知,由Miguel写的一篇介绍如何使用Flask搭建一个流媒体服务器的文章,思路很新颖也很有意思.你可以点击这里阅读英文原文.或者跟随本 ...

  9. Linux 服务器内网搭建NTP时间服务器(Network Time Protocol)

    文章目录 Linux 服务器内网搭建NTP时间服务器(Network Time Protocol) 一.在主服务器端安装NTP时间服务器 二.在客户端安装NTP时间服务器 三.Xhell 同时控制多个 ...

最新文章

  1. 解放你内心的自然领袖,从你的内心而非你的自我来领导你自己
  2. linux内核单独安装,Linux内核编译与安装
  3. java调用keras theano模型_使用Keras获得模型输出的梯度w.r.t权重
  4. 看完这篇 HashMap ,和面试官扯皮就没问题了
  5. php向前截取字符串函数,ThinkPHP 模板substr的截取字符串函数详解
  6. android q桌面,Android Q带来全新桌面模式
  7. php 创建任务程序命令行,PHP Yii 命令行程序以及定时任务详解
  8. curviloft插件怎么用_Curviloft (曲线放样) v1.8a
  9. pyserial库是python语言用于,python的pyserial模块
  10. 基于FPGA的交通灯设计
  11. 这次是90城的数据!中国90座城市建筑物屋顶矢量数据集(2020)
  12. HTML <meta> http-equiv 属性
  13. 关于仿古砖的历史,你知道多少?
  14. linux下zip文件密码破解Fcrackzip
  15. 有奖 | 你想要什么样的程序员贴纸?
  16. 企业如何用InfBox架设自己的内部即时信息IM服务器
  17. arrayToJson将数组转化为json格式的js代码
  18. 获取页面form表单对象的方式
  19. 速度环+直立环+转向环
  20. 如何使用CASIA-OLHWDB联机手写汉字数据集?(解答篇)

热门文章

  1. vue 不能响应set结构增加数据_Vue.set()动态的新增与修改数据,触发视图更新的方法...
  2. python集合操作 读取_python – Django – 如何使用QuerySet过滤来获取对象的子集?...
  3. 公共课计算机基础怎么样,公共课第一学期《计算机基础》
  4. html js停止计时,用 js 写的计时器,暂停计时无法生效
  5. 红帽linux配置apache,红帽linux9中Apache服务器的配置
  6. WeirdSort CodeForces - 1311B(暴力)
  7. 互联网时代的十大特征和趋势
  8. python时间模块使用教程_Python datetime模块使用方法小结
  9. cstring判断是否包含子串_最长子串-滑动窗口
  10. android 八核手机,八核手机