./configure --prefix=/usr/local/nginx --with-http_dav_module --with-http_stub_status_module --with-http_addition_module --with-http_sub_module --with-http_flv_module --with-http_mp4_module --with-pcre --with-http_ssl_module --with-http_gzip_static_module --add-module=/usr/local/src/nginx-rtmp-module
/usr/local/nginx/sbin
搭建nginx+rtmp 参考https://www.cnblogs.com/Naylor/p/18070157
##推流地址
ffmpeg -re -i 1.mp4 -c copy -f flv rtmp://47.116.113.104:1935/live/123
http://47.116.113.104/live/123/index.m3u8
ffmpeg -re -i 1.mp4 -c copy -f flv rtmp://47.116.113.104:1935/myapptest/mystream
ffmpeg -re -i 1.mp4 -vcodec copy -acodec copy -f flv rtmp://47.116.113.104:1935/live/test
http://47.116.113.104/live?port=1935&app=live&stream=test
http://47.116.113.104/flv_live?port=1935&app=myapp&stream=mystream
ffmpeg -re -i 1.mp4 -vcodec copy -acodec copy -f flv rtmp://47.116.113.104:1935/myapp/badao
http://127.0.0.1:800/live?port=1935&app=myapp&stream=badao
rtmp://47.116.113.104:1953/myapp/mystream
##nginx+rtmp+ffmpeg+java接口鉴权+浏览器播放
https://blog.csdn.net/lcz134258/article/details/89490497
生成的推流地址uuid为1234567890,我们存入缓存如redis和数据库中,摄像头那边推流,我们通过服务配置 on_publish参数,获取推流参数与缓存如redis和数据库的值,做比较是否存在,存在则验证通过成功,不存在则推送失败。
##接口鉴权
ffmpeg -re -i orange.mp4 -vcodec libx264 -acodec aac -f flv rtmp://10.9.160.147:1935/live/home?vin=1234567890
http://localhost:8089/cloudLive/vin/auth;
@Controller
@RequestMapping(value = "/vin")
public class AuthController {
@RequestMapping(value = "/auth", method = RequestMethod.POST)
@ResponseBody
public String hello(HttpServletRequest request,HttpServletResponse response) {
String vin = request.getParameter("vin");
System.out.println("vin:"+vin);
if(vin.equals("1234567890")){
System.out.println("返回编号为200");
return "{\"code\":\"200\",\"detail\":\"SUCCESS\"}"; // 流媒体服务器认证通过必须返回200 流媒体服务器才可以继续推流
}else{
response.setStatus(500);
System.out.println("返回编号为500");
return "{\"code\":\"500\",\"detail\":\"auth error\"}";
}
}
}
==================流媒体Nginx+nginx-http-flv-module流媒体+鉴权==================
https://www.cnblogs.com/thsrite/p/15801959.html
git clone https://github.com/winshining/nginx-http-flv-module.git
/usr/local/src/nginx-1.24.0
./configure --add-module=../nginx-http-flv-module
https://www.jianshu.com/p/74c2bba02990
nginx rtmp 服务加入鉴权机制,支持推流鉴权、拉流鉴权 使用python实现
https://blog.csdn.net/zengliguang/article/details/139085095?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-2-139085095-blog-87159375.235%5Ev43%5Epc_blog_bottom_relevance_base2&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-2-139085095-blog-87159375.235%5Ev43%5Epc_blog_bottom_relevance_base2&utm_relevant_index=5
##对hls做认证需要拦截http请求
https://nginx.org/en/docs/http/ngx_http_auth_request_module.html
##java接口鉴权
https://blog.csdn.net/student_zz/article/details/125781045?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-0-125781045-blog-77839039.235^v43^pc_blog_bottom_relevance_base2&spm=1001.2101.3001.4242.1&utm_relevant_index=1
https://www.cnblogs.com/thsrite/p/15801959.html
https://blog.csdn.net/string_kai/article/details/101038941?spm=1001.2101.3001.6650.3&utm_medium=distribute.pc_relevant.none-task-blog-2~default~LandingCtr~default-3.queryctrv2&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2~default~LandingCtr~default-3.queryctrv2&utm_relevant_index=6
rtmp {
out_queue 1024;
out_cork 8;
max_streams 128;
timeout 15s;
drop_idle_publisher 15s;
log_interval 5s; #log模块在access.log中记录日志的间隔时间,对调试非常有用
log_size 1m; #log模块用来记录日志的缓冲区大小
server {
listen 1935;
server_name www.test.*; #用于虚拟主机名后缀通配
application myapp {
live on;
on_play http://localhost:8081/check; #Java验证服务的地址
...
@RequestMapping("/check")
@ResponseBody
public String check(HttpServletResponse response, @RequestParam(name = "key") String key) {
//验证过程省略
response.setStatus(200);
return "{\"code\":\"" + response.getStatus() + "\",\"detail\":\"" + detail + "\"}";
}
...
function startVideo() {
var _video = videoElement = document.getElementById('videoElement');
var temp = {
type: 'flv',
enableWorker: true,
isLive: true,
stashInitialSize: 128,
hasAudio: false,
hasVideo: true,
lazyLoad: false,
enableStashBuffer: false
};
temp["url"] = "http://127.0.0.1:81/live?port=1935&app=myapp&stream=mystream&key="+_data
var flvPlayer = flvjs.createPlayer(temp);
flvPlayer.attachMediaElement(videoElement);
flvPlayer.load();
flvPlayer.play();
...
https://www.cnblogs.com/badaoliumangqizhi/p/17199477.html