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 ...
随机推荐
- centos 7 环境准备工作
删除自带jdk: rpm -e --nodeps `rpm -qa | grep java` 打开 /etc/ 目录下的 profile 文件: vi /etc/profile 将如下代码追加到 pr ...
- 使用rdb文件进行redis数据迁移--python脚本
查找了一些redis迁移的方法,一般做法就是 1. 从源数据库把rdb文件保存,然后传到新的主机上,启动新的redis即可 2. 把新的redis当做源数据库的slave,同步数据 今天开发提了一个测 ...
- canvas绘制小人开口和闭口
css: <style> body{ text-align: center; } canvas{ background: #ddd; } </style>canvas标签:&l ...
- CompletionService的好处与使用场景
转自:https://blog.csdn.net/jdsjlzx/article/details/52912701 FutureTask既是Future.Runnable,又是包装了Callable( ...
- Flutter 仿滴滴出行App
绿色出行 Flutter 仿滴滴出行App 地图:采用高德地图,仅简单完成了部分功能,基础地图,地址检索,逆地理编码. 界面:仿滴滴主界面,地图中心请求动效果,服务tabs展开效果,地址检索界面,城市 ...
- java_第一年_JavaWeb(2)
HTTP协议 HTTP协议——超文本传输协议,用于定义web浏览器和web服务器之间数据交换的过程,遵守一定的通讯的格式: HTTP请求——包括请求行和多个信息头 请求行:包含请求方式(常用的GET. ...
- [Python] 迭代器是什么?你每天在用的for循环都依赖它!
从循环说起 顺序,分支,循环是编程语言的三大逻辑结构,在Python中都得到了支持,而Python更是为循环结构提供了非常便利的语法:for ... in ... 刚从C语言转入Python的同学可能 ...
- CodeChef Sereja and LCM(矩阵快速幂)
Sereja and LCM Problem code: SEALCM Submit All Submissions All submissions for this problem ar ...
- POJ 3764 The xor-longest Path (01字典树)
<题目链接> 题目大意: 给定一颗$n$个节点$(n\leq10^5)$,有边权的树,其边权$(0\leq w < 2^{31})$.让你求出这棵树上任意两个节点之间的异或最大值. ...
- ubuntu安装supervisor以及使用supervisor启动.net core进程
1.下载.net core项目ubuntu系统运行容器dotnet 1.版本:dotnet-sdk-2.1.3-linux-x64.tar.gz 2.将下载好的包上传到ubuntu ...