原址: 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. delphi 牛逼 了 app (已在软件界掀起波澜)10分钟10行代码做出让人惊叹的程序

    (已在软件界掀起波澜)10分钟10行代码做出让人惊叹的程序 http://v.qq.com/x/page/m0328h73bs7.html?ptag=bbs_csdn_net

  2. Entity Framework Code First属性映射约定 转载https://www.cnblogs.com/libingql/p/3352058.html

    Entity Framework Code First属性映射约定   Entity Framework Code First与数据表之间的映射方式有两种实现:Data Annotation和Flue ...

  3. c#继承与构造函数的调用

    1.实例化父类时,可以通过new子类来实例化父类,执行构造函数的顺序为:先执行父类的构造函数,再执行子类的构造函数. 2.实例化子类时,只可以new子类,执行顺序同上. 3.父类实例化后,只能执行父类 ...

  4. Pikachu漏洞练习平台实验——php反序列化、XXE、SSRF(九)

    1.序列化和反序列化 1.1.概述 在理解这个漏洞前,你需要先搞清楚php中serialize(),unserialize()这两个函数. 序列化serialize()序列化说通俗点就是把一个对象变成 ...

  5. Pikachu漏洞练习平台实验——文件包含(File Inclusion)(六)

    1.概述 1.1简介 在 Web 后台开发中,程序员往往为了提高效率以及让代码看起来更加简洁,会使用 “包含” 函数功能.比如把一系列功能函数都写进 function.php 中,之后当某个文件需要调 ...

  6. Python 学习笔记15 类 - 继承

    我们在编程的过程中,并非都是要重头开始.比如其他人已经有现成的类,我们可以使用其他找人编写的类.术语称之为: 继承. 当一个类继承例外一个类时,它可以获得这个类的所有属性和方法:原有的类称之为 父类, ...

  7. MySQL-第九篇分组和组函数

    1.组函数 组函数:即多行函数,组函数将一组记录作为整体计算,每组记录返回一个结果,而不是每条记录返回一个结果. 2.常用的组函数有: 1>avg([distinct|all]expr):计算多 ...

  8. 分布式自增ID算法-Snowflake详解

    1.Snowflake简介 互联网快速发展的今天,分布式应用系统已经见怪不怪,在分布式系统中,我们需要各种各样的ID,既然是ID那么必然是要保证全局唯一,除此之外,不同当业务还需要不同的特性,比如像并 ...

  9. PHP实现上传文件到服务器

    <?php /**************************** *** 功能:上传文件到服务器 ****************************/ session_start() ...

  10. Vue打包后访问静态资源路径问题

    Vue介绍中static文件夹里放的是静态资源目录,如图片.字体等. 我们发现运行npm run start后本地图片路径是没问题的,但是打包上传后会怎么样呢? 我们知道,执行npm run buil ...