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 ...
随机推荐
- STM32 实现内部Flash的读写(HAL库版)
Flash 中文名字叫闪存,是一种长寿命的非易失性(断电数据不丢失)的存储器.可以对称为块的存储器单元块进行擦写和再编程,在进行写入操作之前必须先执行擦除.一个Nand Flash由多个块(Block ...
- 2019/11/09 TZOJ
1001 Interesting Integers http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail& ...
- 有用的官方API和官网
1.Bootstrap API:http://www.runoob.com/bootstrap/bootstrap-tutorial.html 2.百度地图API示例:http://lbsyun.ba ...
- mybatis配置mapper.xml 的基本操作
XML 映射文件 本文参考mybatis中文官网进行学习总结:http://www.mybatis.org/mybatis-3/zh/sqlmap-xml.html MyBatis 的真正强大在于它的 ...
- spring-第十八篇之spring AOP基于XML配置文件的管理方式
1.在XML配置文件中配置切面.切入点.增强处理.spring-1.5之前只能使用XML Schema方式配置切面.切入点.增强处理. spring配置文件中,所有的切面.切入点.增强处理都必须定义在 ...
- android 学习路线
转载来源:https://blog.csdn.net/lixuce1234/article/details/77947405 jixiaohua发了一篇一个老鸟也发了一份他给公司内部小伙伴整理的路线图 ...
- KNN算法案例--手写数字识别
import numpy as np import matplotlib .pyplot as plt import pandas as pd from sklearn.neighbors impor ...
- Using Keyboard Navigation
http://technet.microsoft.com/en-us/library/cc939835.aspx
- CodeChef Mahesh and his lost array
Mahesh and his lost array Problem code: ANUMLA Submit All Submissions All submissions for this ...
- 基于Idea从零搭建一个最简单的vue项目
一.需要了解的基本知识 node.js Node.js是一个Javascript运行环境(runtime),发布于2009年5月,由Ryan Dahl开发,实质是对Chrome V8引擎进行了封装.N ...