欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

基于nginx-rtmp模块的mp4播放

程序员文章站 2022-07-08 18:27:18
...

参考我上一篇流媒体服务器搭建的步骤https://blog.csdn.net/weixin_45380730/article/details/104824262
不同的地方:将mp4放在服务器目录上
修改nginx.conf
rtmp {
server {
listen 1935;

    application myapp {  
        live on;  
    }  
    application hls {  
        live on;  
        hls on;  
        hls_path /tmp/hls;  
    }  
}  

}
http下添加:
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp;
add_header Cache-Control no-cache;
推流:
[aaa@qq.com mp4]# ffmpeg -re -i test.mp4 -c copy -f flv rtmp://192.168.247.128:1935/hls/test1
方法一;用vlc打开视频:
基于nginx-rtmp模块的mp4播放
参考:https://blog.csdn.net/liuweihui521/article/details/84323999
https://www.cnblogs.com/dad-world/p/12180103.html

方法二:浏览器打开基于nginx-rtmp模块的mp4播放
1.下载video.js地址:http://www.jq22.com/jquery-info404
解压至/usr/local/nginx/html
2.修改 video5.18.4.js里面的index.html

完整代码: Video.js | HTML5 Video Player

To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video