java做flv直播服务器_使用nginx搭建点播和直播流媒体服务器的方法步骤
环境 centos7 nginx
1 安装nginx依赖包 yum install gcc gcc-c++ openssl-devel zlib-devel pcre pcre-devel yamdi
2.下载解压nginx_mod_h264_streaming,让nginx支持flv,mp4流播放 wget http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.7.tar.gz 解压后需要修改src目录下的ngx_http
_streaming_module.c文件,将r->zero_in_uri所在的if语句注释掉
3.下载解压nginx-rtmp-module,让nginx支持rtmp/hls协议,wegt -o nginx-rtmp-module.zip https://github.com/arut/nginx-rtmp-module/archive/master.zip
4下载清除缓存的模块 wget -Ongx_cache_purge.zip https://github.com/FRiCKLE/ngx_cache_purge/archive/master.zip
5.下载nginx wget http://nginx.org/download/nginx-1.9.0.tar.gz
6 .进入nginx的安装目录下 执行以下命令./configure --prefix=/usr/local/nginx/--add-module=../nginx-rtmp-module-master --add-module=../ngx_cache_purge-master--add-module=../nginx_mod_h264_streaming-2.2.7 --with-http_stub_status_module--with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module--with-http_flv_module
7. 执行以下命令编译文件make && make install ,并修改nginx安装目录下的objs下的Makefile 删除-Werror
9. 修改nginx.conf
10. 通过yum 停止firewalld防火墙并卸载,然后安装iptables-services修改/etc/sysconfig/iptables文件夹放行80端口
11.nginx 配置如下:
#使用的用户和组
#user nobody;
#指定工作衍生的进程数,为cpu的核心数总和
worker_processes 2;
#指定错误日志的存放路径 日志记录级别[debug,info,notice,warn,error,crit]
error_log /usr/local/nginx/logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#指定pid存放的路径
pid /usr/local/nginx/logs/nginx.pid;
events {
#使用的网络I/O模型,linux系统推荐是epoll而freeBSD是kqueue
use epoll;
#允许的连接数,最大的高并发连接数为worker_processes*worker_connections
worker_connections 51200;
}
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
}
#application live2 {
#live on;
#record off;
#}
# video on demand
application media {
play /usr/local/nginx/html/;
}
#application vod_http {
#play http://192.168.31.185/vod;
#}
application hls {
live on;
hls on;
hls_path /tmp/hls;
}
}
}
http {
include mime.types;
default_type application/octet-stream;
#
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
location ~ \.flv$ {
root /usr/local/nginx/html/media/;
flv;
}
location ~ \.mp4$ {
root /usr/local/nginx/html/media/;
mp4;
}
location /stat {
rtmp_stat all;
# Use this stylesheet to view XML as web page
# in browser
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
# XML stylesheet to view RTMP stats.
# Copy stat.xsl wherever you want
# and put the full directory path here
root /path/to/stat.xsl/;
}
location /hls {
# Serve HLS fragments
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp;
add_header Cache-Control no-cache;
}
location /dash {
# Serve DASH fragments
root /tmp;
add_header Cache-Control no-cache;
}
#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;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$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;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
12. 输入xxx.xxx.xxx.xxx/*.mp4/*.flv就能播放视频了
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
java做flv直播服务器_使用nginx搭建点播和直播流媒体服务器的方法步骤相关推荐
- java自动发图文微博_使用node搭建自动发图文微博机器人的方法
本文仅供学习交流,请勿用于商业用途,并遵守新浪微博相关规定. 代码目录 此微博机器人的实现功能如下: 模拟登陆新浪微博,获取cookie: 自动上传图片至微博图床: 自动发送内容不同的图文微博: 通过 ...
- windows下ffmpeg结合Nginx搭建RTMP,直播中的推流和拉流
windows下ffmpeg结合Nginx搭建RTMP,直播中的推流和拉流 推流和拉流的概念 以及RTMP协议 在直播中,一般需要三个角色:主播,服务器,用户.主播通过推流将数据推到服务器上,而用户可 ...
- http协议 git服务器,利用Nginx搭建HTTP访问的Git服务器
利用Nginx搭建HTTP访问的Git服务器过程记录.搭建 Git 仓库,实现 SSH 协议.配合 Nginx 实现 HTTP 协议拉取.推送代码.利用 Nginx 实现 Gitweb 在线浏览代码, ...
- java做flv直播服务器_一种RTMP直播流到HTTPFLV直播流实时转换系统及其工作方法与流程...
本发明属于互联网的音视频技术领域,具体涉及一种RTMP直播流到HTTP FLV直播流实时转换系统及其工作方法. 背景技术: 在传统互联网直播领域,PC端采用RTMP协议进行视频直播,国内一部分CDN服 ...
- java做flv直播服务器,EasyDSS流媒体服务器软件(支持RTMP/HLS/HTTP-FLV/视频点播/视频直播)-正式环境安装部署攻略...
EasyDSS流媒体服务器软件,提供一站式的转码.点播.直播.时移回放服务,极大地简化了开发和集成的工作. 其中,点播功能主要包含:上传.转码.分发.直播功能,主要包含:直播.录像, 直播支持RTMP ...
- 服务器是什么系统_为什么视频监控系统搭建,要使用流媒体服务器做视频分发?...
众所周知,TSINGSEE有很多视频流媒体平台和辅助分发的组件,例如EasyNVR.EasyDSS.EasyGBS均是流媒体平台,而EasyRTMPLive则是负责拉转推的推流网关. 而对于流媒体服务 ...
- java做的桌面应用_把一个java web应用包装成桌面应用的简单做法
昨天玩h2的时候想起来的, 这年头把在线应用报装成桌面应用是越来越流行了,几年前做过类似的事情,简单介绍一下. 1. 选择一个嵌入的web 服务器和 数据库. web服务器我选择的是jetty,虽然t ...
- 摄像头 保存到外网服务器_直播平台搭建千万不要忽略流媒体服务器的存在
"数据显示,2018年第四季度,陌陌直播服务营收29.592亿元(约4.304亿美元),与2017年同期的21.69亿元相比增长了36%.陌陌方面表示,直播服务营收的增长,主要原因在于直播服 ...
- linux搭建mcpe服务器_技术|如何搭建“我的世界”服务器
我们将通过一个一步步的.新手友好的教程来向你展示如何搭建一个"我的世界(Minecraft)"服务器.这将会是一个长期的多人游戏服务器,你可以与来自世界各地的朋友们一起玩,而不用在 ...
最新文章
- PHP问题 —— Deprecated: Function ereg_replace() is de
- 自建通用Makefile 分享
- Windows Phone开发(41):漫谈关键帧动画之下篇
- JVM-11虚拟机性能监控与故障处理工具之【JDK的可视化工具-JConsole】
- cookie与session区别|详细版
- pandans导出Excel并将数据保存到不同的Sheet表中
- win7+计算机+桌面图标不见了怎么办,win7电脑系统桌面图标不见了怎么办
- java 命名内部类_如何把java SWT程序中的匿名内部类改写成命名内部类?
- Spring AOP学习笔记
- docker build 中的上下文路径
- c 子类对象 访问父类对象受保护成员_面向对象编程(OOP)
- 1042: 筛法求素数
- (7)css常用属性2
- Toeplitz matrix 与 Circulant matrix
- python圣诞树代码_用Python画一棵带音乐的雪夜圣诞树
- IDEA 如果修改工作区的主题 也就是黑色背景和白色背景
- 等级保护--云计算安全扩展要求
- comsol奶酪模型 comsol多孔材料
- 94 - 绘制谢尔宾斯基三角形
- 彼得林奇:全球理财师中的NO.1