原址: 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的更多相关文章

  1. 使用 ffmpeg nginx rtmp 搭建实时流处理平台

    环境: ubuntu 16.04 问题引入: 使用 opencv 获取摄像头数据帧, 进行处理之后(如进行 keypoint 识别), 将 opencv 中图像的 Mat类型转化为 ffmpeg 的 ...

  2. 三、Windows下用FFmpeg+nginx+rtmp搭建直播环境 实现推流、拉流

    一.环境 1.开发环境:windows 2.开发工具:FFmpeg.nginx.nginx-rmtp-module (链接:https://pan.baidu.com/s/119d2GeMzddas_ ...

  3. 用FFmpeg+nginx+rtmp搭建环境实现推流

    Windows: 1.下载文件: 链接:https://pan.baidu.com/s/1c2LmIHHw-dwLOlRN6iTIMg 提取码:g7sj 2.解压文件: 解压到nginx-1.7.11 ...

  4. ffmpeg,rtmpdump和nginx rtmp实现录屏,直播和录制

    公司最近在做视频直播的项目,我这里分配到对直播的视频进行录制,录制的方式是通过rtmpdump对rtmp的视频流进行录制 前置的知识 ffmpeg: 用于实现把录屏工具发出的视频和音频流,转换成我们需 ...

  5. ffmpeg+nginx 实现rtsp转rtmp并通过nginx转发

    Windows安装 ffmpeg ffmpeg windows版下载地址https://ffmpeg.zeranoe.com/builds/ static版本就行 配置环境变量:下载的压缩包解压后的路 ...

  6. ffmpeg+nginx搭建直播服务器

    Nginx与Nginx-rtmp-module搭建RTMP视频直播和点播服务器 https://zhuanlan.zhihu.com/p/28009037 FFmpeg总结(十三)用ffmpeg基于n ...

  7. (转)Nginx+rtmp+ffmpeg搭建流媒体服务器

    (1)下载第三方扩展模块nginx-rtmp-module # mkdir module && cd module //创建一个存放模块的目录 # wget https://githu ...

  8. centos7+nginx+rtmp+ffmpeg搭建流媒体服务器(保存流目录与http目录不要随意配置,否则有权限问题)

    搭建nginx-http-flv-module升级代替rtmp模块,详情:https://github.com/winshining/nginx-http-flv-module/blob/master ...

  9. nginx RTMP FFmpeg 视频直播

    /**************************************************************************** * nginx RTMP FFmpeg 视频 ...

  10. 基于Nginx+nginx-rtmp-module+ffmpeg搭建rtmp、hls流媒体服务器

    上篇文章是基于Red5与ffmpeg实现rtmp处理NVR或摄像头的监控视频处理方案,有兴趣的朋友可以查看. Nginx及nginx-rtmp-module安装 新建目录 mkdir /usr/loc ...

随机推荐

  1. ECMAScript 2015 迭代器协议:实现自定义迭代器

    迭代器协议定义了一种标准的方式来产生一个有限或无限序列的值,并且当所有的值都已经被迭代后,就会有一个默认的返回值. 当一个对象只有满足下述条件才会被认为是一个迭代器:它实现了一个 next() 的方法 ...

  2. stl vector创建二维数组

    vector<vector<); for (auto it = v.begin(); it != v.end(); it++) { ; (*it).reserve();//预留空间为5,但 ...

  3. Jmeter接口自动化培训

    课程前提 速成班,讲的不会非常深,每个人基础不一样,但是实现接口自动化没有问题,因为jmeter更多的用来做性能测试.当然有兴趣我们也可以穿插一点 课程基本大纲 接口基础概念 部署本地测试环境(使用d ...

  4. PA动画使用教程

    1.动画复制与动画粘贴.动画删除 PA的动画复制.动画粘贴不会覆盖原有动画: PPT自带的动画刷会覆盖原有动画: 注意: 超级属性的动画复制.粘贴有bug,应使用自带的动画刷: PA动画的复制.粘贴只 ...

  5. _groovy

    _groovy与beanshell类似,只是它执行的是apache groovy脚本,并返回结果. 如果定义了属性 “groovy.utilities”,属性将会被脚本引擎加载,这样就可以定义一些通用 ...

  6. spring-第十九篇AOP面向切面编程之增强处理的优先级

    1.从我们第十七篇举例了不同类型的增强处理. spring AOP采用和AspectJ一样的优先顺序来织入增强处理:在“进入”连接点时,具有最高优先级的增强处理将先被织入(在给定的两个Before增强 ...

  7. 在没有iis的情况下,webApi自托管(转自momo314)

    第一步 新建一个控制台应用程序 并添加WebApi相关引用,注意,添加之后会默认帮你添加 System.Web.Http.WebHost 的引用,不过,折并没有什么鸟用,干掉他,然后手动添加引用 Sy ...

  8. 一波骚操作,我把 SQL 执行效率提高了 10,000,000 倍!

    作者:风过无痕-唐 http://www.cnblogs.com/tangyanbo/p/4462734.html 场景 我用的数据库是mysql5.6,下面简单的介绍下场景 课程表: create  ...

  9. Java 不被看好前景堪忧?可能是想多了!

    Java技术栈 www.javastack.cn 优秀的Java技术公众号 来源:代码湾 Java发行二十多年来,尤其是在战胜C和C++成为最受程序员喜欢的编程语言之后,一直都是开发者的宠儿. 虽然斯 ...

  10. Codeforces - 1189B - Number Circle - 贪心

    https://codeforc.es/contest/1189/problem/B 优先考虑最大的元素怎么构造.拿两个次大的围着他就很好,但是其他的怎么安排呢?就直接降序排列就可以了. a数组还开错 ...