基于nginx-rtmp模块的mp4播放

参考我上一篇流媒体服务器搭建的步骤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;
推流:
[root@localhost 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

上一篇:date 获取昨天日期


下一篇:5 分钟完成 Nginx 直播服务部署(直播 + 分流 + 画面水印)