当前位置: win11系统之家 >  系统教程 >  win10系统教程 >  win10流媒体服务器的搭建方法

win10流媒体服务器的搭建方法 win10流媒体服务器如何搭建

更新时间:2024-02-27 14:18:01作者:zheng

  有些用户想要在自己的windows10电脑中搭建nginx-rtmp流媒体服务器,但是不知道具体的操作方法,今天小编教大家win10流媒体服务器的搭建方法,操作很简单,大家跟着我的方法来操作吧。

  方法如下:

  1、下载nginx

  下载链接: http://nginx-win.ecsds.eu/download/nginx 1.7.11.3 Gryphon.zip,下载完成后解压到需要盘符,将解压后的目录命名为nginx-1.7.11.3-Gryphon

  2、下载nginx-rtmp-module插件

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

  下载完成后解压到刚刚解压的nginx-1.7.11.3-Gryphon目录中

win10流媒体服务器的搭建方法_win10流媒体服务器如何搭建

  3、配置nginx-1.7.11.3-Gryphon文件下 conf\nginx-win-rtmp.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; # } #}}4.、打开cmd窗口进入D:\Program Files (x86)\nginx-1.7.11.3-Gryphon目录输入

  nginx.exe -c conf\nginx-win-rtmp.conf启动服务器

win10流媒体服务器的搭建方法_win10流媒体服务器如何搭建

  5、打开浏览器输入http://localhost出现下图就说明启动成功

win10流媒体服务器的搭建方法_win10流媒体服务器如何搭建

  6、nginx常用命令(需要进入到nginx安装目录执行命令)

  1)、启动:start nginx或nginx.exe

  2)、停止:nginx.exe -s stop或nginx.exe -s quit

  注:stop是快速停止nginx,可能并不保存相关信息;quit是完整有序的停止nginx,并保存相关信息。

  3)、重新载入Nginx:nginx.exe -s reload

  当配置信息修改,需要重新载入这些配置时使用此命令。

  7、下载ffmpeg解压到需要的盘符

  下载地址:https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20190323-5fceac1-win64-static.zip

win10流媒体服务器的搭建方法_win10流媒体服务器如何搭建

  8、配置环境变量

  右键我的电脑,点击1、属性 --》2、高级系统设置---》3、高级---》4、环境变量---》5、编辑Path变量---》增加ffmpeg到bin的目录

win10流媒体服务器的搭建方法_win10流媒体服务器如何搭建

  9、打开cmd窗口输入“ffmpeg”或者“ffmpeg -version”验证安装是否成功,如出现下图ffmpeg版本信息则ok

win10流媒体服务器的搭建方法_win10流媒体服务器如何搭建

  10、打开cmd窗口进入到到ffmpeg.exe目录下,输入ffmpeg命令进行推流

  ffmpeg.exe -re -i D:\serverFile\video\eyes.mp4 -f flv rtmp://localhost:1935/live/test出现下图说明推流成功

win10流媒体服务器的搭建方法_win10流媒体服务器如何搭建

  11、打开VLC播放器可以从你自己的流媒体服务器上拉流观看

win10流媒体服务器的搭建方法_win10流媒体服务器如何搭建

  12、再打开一个cmd窗口,进入ffmpeg目录,使用ffplay命令进行拉流

win10流媒体服务器的搭建方法_win10流媒体服务器如何搭建

  好了rtmp流媒体服务器及ffmpeg搭建完成,推流和拉流一切正常工作。

  以上就是win10流媒体服务器的搭建方法的全部内容,如果有遇到这种情况,那么你就可以根据小编的操作来进行解决,非常的简单快速,一步到位。

相关教程