ffmpeg+nginx-rtmp-module
原址: https://www.cnblogs.com/cnsanshao/p/6370938.html
另外: vlc播放器能播放rtsp协议
nginx安装和配置
模块下载
https://github.com/arut/nginx-rtmp-module nginx编译参数
./configure --user="www" --group="www" --prefix=/opt/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-pcre=/opt/tools/pcre-8.36 --add-module=/opt/tools/echo-nginx-module-master --add-module=/opt/tools/nginx-rtmp-module-master nginx.conf配置
[root@localhost ~ ::&&]#cat /opt/nginx/conf/nginx.conf | grep -v "^.*#\|^$"
worker_processes ; #注意 这里必须设置为1,页面上显示不了
events {
worker_connections ;
}
rtmp{
server{
listen 1935;
chunk_size 4000;
application hls {
live on;
hls on;
hls_path /opt/nginx/html/hls;
hls_fragment 5s;
}
}
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout ;
server {
listen ;
server_name localhost;
location /{
root /opt/nginx/html ;
index index.html index.htm;
}
error_page /50x.html;
location = /50x.html {
root html;
}
}
}
ffmpeg安装配置
包位置
F:\share\src\ffmpeg
安装yasm
tar -zxvf yasm-1.3..tar.gz
cd yasm-1.3.
./configure
make
make install
安装ffmpeg
./configure --prefix=/opt/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-zlib --enable-bzlib --enable-pic
make && make install [root@localhost ~ ::&&]#vim /etc/ld.so.conf
include ld.so.conf.d/*.conf
/opt/ffmpeg/lib #添加 ldconfig
rtsp转rtmp
nohup ffmpeg -i rtsp://admin:abc12345@192.168.2.22:554/ -vcodec copy -acodec copy -f flv rtmp://192.168.30.71:1935/hls/22 > 22.out &
编写展示html
[root@localhost /opt/nginx/html ::&&]#cat test2.html
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="http://static.sgamer.com/css/video-js.css" rel="stylesheet">
<script src="http://static.sgamer.com/js/video.min.js"></script> </head>
<body>
<video id="my-player" class="video-js" controlspreload="auto" data-setup='{}' style="width: 256px;height: 256px;">
<source src='rtmp://192.168.30.71:1935/hls/22' type='rtmp/m3u8'/>
</video>
<video id="my-player2" class="video-js" controlspreload="auto" data-setup='{}' style="width: 256px;height: 256px;">
<source src='rtmp://192.168.30.71:1935/hls/21' type='rtmp/m3u8'/>
</video>
<video id="my-player3" class="video-js" controlspreload="auto" data-setup='{}' style="width: 256px;height: 256px;">
<source src='rtmp://192.168.30.71:1935/hls/30' type='rtmp/m3u8'/>
</video>
<video id="my-player4" class="video-js" controlspreload="auto" data-setup='{}' style="width: 256px;height: 256px;">
<source src='rtmp://192.168.30.71:1935/hls/20' type='rtmp/m3u8'/>
</video> <video id="my-player5" class="video-js" controlspreload="auto" data-setup='{}' style="width: 256px;height: 256px;">
<source src='rtmp://192.168.30.71:1935/hls/10' type='rtmp/m3u8'/>
</video> <script type="text/javascript">
var player = videojs('my-player');
var options = {};
#根据video的id 来获取video播放
var player = videojs('my-player', options, function onPlayerReady() {
videojs.log('Your player is ready!');
// In this context, `this` is the player that was created by Video.js.
this.play();
// How about an event listener?
this.on('ended', function() {
videojs.log('Awww...over so soon?!');
});
}); var player2 = videojs('my-player2', options, function onPlayerReady() {
videojs.log('Your player is ready!');
// In this context, `this` is the player that was created by Video.js.
this.play();
// How about an event listener?
this.on('ended', function() {
videojs.log('Awww...over so soon?!');
});
}); var player3 = videojs('my-player3', options, function onPlayerReady() {
videojs.log('Your player is ready!');
// In this context, `this` is the player that was created by Video.js.
this.play();
// How about an event listener?
this.on('ended', function() {
videojs.log('Awww...over so soon?!');
});
}); var player4 = videojs('my-player4', options, function onPlayerReady() {
videojs.log('Your player is ready!');
// In this context, `this` is the player that was created by Video.js.
this.play();
// How about an event listener?
this.on('ended', function() {
videojs.log('Awww...over so soon?!');
});
}); var player5 = videojs('my-player5', options, function onPlayerReady() {
videojs.log('Your player is ready!');
// In this context, `this` is the player that was created by Video.js.
this.play();
// How about an event listener?
this.on('ended', function() {
videojs.log('Awww...over so soon?!');
});
}); </script>
</body>
</html>
ffmpeg+nginx-rtmp-module的更多相关文章
- 使用 ffmpeg nginx rtmp 搭建实时流处理平台
环境: ubuntu 16.04 问题引入: 使用 opencv 获取摄像头数据帧, 进行处理之后(如进行 keypoint 识别), 将 opencv 中图像的 Mat类型转化为 ffmpeg 的 ...
- 三、Windows下用FFmpeg+nginx+rtmp搭建直播环境 实现推流、拉流
一.环境 1.开发环境:windows 2.开发工具:FFmpeg.nginx.nginx-rmtp-module (链接:https://pan.baidu.com/s/119d2GeMzddas_ ...
- 用FFmpeg+nginx+rtmp搭建环境实现推流
Windows: 1.下载文件: 链接:https://pan.baidu.com/s/1c2LmIHHw-dwLOlRN6iTIMg 提取码:g7sj 2.解压文件: 解压到nginx-1.7.11 ...
- ffmpeg,rtmpdump和nginx rtmp实现录屏,直播和录制
公司最近在做视频直播的项目,我这里分配到对直播的视频进行录制,录制的方式是通过rtmpdump对rtmp的视频流进行录制 前置的知识 ffmpeg: 用于实现把录屏工具发出的视频和音频流,转换成我们需 ...
- ffmpeg+nginx 实现rtsp转rtmp并通过nginx转发
Windows安装 ffmpeg ffmpeg windows版下载地址https://ffmpeg.zeranoe.com/builds/ static版本就行 配置环境变量:下载的压缩包解压后的路 ...
- ffmpeg+nginx搭建直播服务器
Nginx与Nginx-rtmp-module搭建RTMP视频直播和点播服务器 https://zhuanlan.zhihu.com/p/28009037 FFmpeg总结(十三)用ffmpeg基于n ...
- (转)Nginx+rtmp+ffmpeg搭建流媒体服务器
(1)下载第三方扩展模块nginx-rtmp-module # mkdir module && cd module //创建一个存放模块的目录 # wget https://githu ...
- centos7+nginx+rtmp+ffmpeg搭建流媒体服务器(保存流目录与http目录不要随意配置,否则有权限问题)
搭建nginx-http-flv-module升级代替rtmp模块,详情:https://github.com/winshining/nginx-http-flv-module/blob/master ...
- nginx RTMP FFmpeg 视频直播
/**************************************************************************** * nginx RTMP FFmpeg 视频 ...
- 基于Nginx+nginx-rtmp-module+ffmpeg搭建rtmp、hls流媒体服务器
上篇文章是基于Red5与ffmpeg实现rtmp处理NVR或摄像头的监控视频处理方案,有兴趣的朋友可以查看. Nginx及nginx-rtmp-module安装 新建目录 mkdir /usr/loc ...
随机推荐
- Linux 初始化系统 systemd - journald 日志
journalctl 中文手册 archlinux - journal systemd-journald 用于检索 systemd 的日志,是 systemd 自带的日志系统. 1. systemd- ...
- java.io.NotSerializableException错误解决方法
运行tomcat下面的 ssh项目,启动,打开某页面(让session起作用),停止:再启动,有可能会报类似如下的错误: org.apache.catalina.session.StandardMan ...
- Linux——文件打包与压缩
Linux 下常见常用的压缩包文件格式有*.zip,*.rar,*.7z*.gz,*.xz,*.bz2,*.tar,*.tar.gz,*.tar.xz,*tar.bz2等后缀的压缩文件 文件后缀名 说 ...
- Vue-实现简单拖拽(自定义属性)
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"& ...
- composer 版本号前置~与^符号的区别
语义化版本https://semver.org/lang/zh-CN/ 了解版本号分 所以用这个说法来理解composer.json里面版本的控制
- 18、NumPy——矩阵库(Matrix)
NumPy 矩阵库(Matrix) NumPy 中包含了一个矩阵库 numpy.matlib,该模块中的函数返回的是一个矩阵,而不是 ndarray 对象. 一个 的矩阵是一个由行(row)列(col ...
- k8s nginx ingress配置TLS
在没有配置任何nginx下,k8s的nginx默认只支持TLS1.2,不支持TLS1.0和TLS1.1 默认的 nginx-config(部分可能叫 nginx-configuration)的配置如下 ...
- direct模式下的收发
生产者 import pika import sys connection = pika.BlockingConnection(pika.ConnectionParameters( host='loc ...
- ELK + Filebeat日志分析系统安装
之前搭建过elk,用于分析日志,无奈服务器资源不足,开了多个Logstash之后发现占用内存过高,于是现在改为Filebeat做日志收集,记录一下搭建过程和遇到问题的解决方案. 第一步 , 安装jdk ...
- Java代码乱象!
文章转载自公众号 阿里巴巴中间件 , 作者 陈昌毅 导读 查尔斯·狄更斯在<双城记>中写道:“这是一个最好的时代,也是一个最坏的时代.” 移动互联网的快速发展,出现了许多新机遇,很多创业 ...