项目简介:视频直播网站由三个部分构成:1.推流端 2.服务器 3.拉流端。在该项目中,推流端用OBS完成,服务器由NGINX+RTMP模块完成,拉流端使用video.js完成。
一、开发环境:
- 推流端:系统:UBUNTU 16.04 工具:obs
- 服务器:系统: UBUNTU 16.04 工具:NGINX+RTMP
- 拉流端:系统:WINDOWS 10 工具:H5
二、 构建服务器
服务器由NGINX+RTMP构成。NGINX是HTTP服务器,RTMP是附加模块。
其中NGINX我选择的是用源码编译方式进行安装,因为这种方式可以自定义安装指定的模块以及最新版本。
首先配置各项依赖库。
下载 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.3-Gryphon
三、 下载服务器状态检查程序 stat.xsl
https://github.com/arut/nginx-rtmp-module/
将nginx-rtmp-module-master.zip解压后复制到目录:nginx-1.7.11.3-Gryphon下,
保证stat.xls的目录为:
nginx-1.7.11.3-Gryphon\nginx-rtmp-module\stat.xsl(注意地址必须为nginx-rtmp-module)
四、 配置文件 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;
}
}
}
http {
#include /nginx/conf/naxsi_core.rules;
include mime.types;
default_type application/octet-stream;
#log_format main 'remoteaddr:remote_port - remoteuser[time_local] "request" ' # 'status bodybytessent"http_referer" '
# '"httpuseragent""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;
# serve

本文详细介绍如何使用OBS、NGINX+RTMP模块和video.js构建视频直播系统,包括服务器配置、OBS推送流设置及H5端视频流播放。

6187

被折叠的 条评论
为什么被折叠?



