通过nginx搭建hls流媒体服务器


通过录像文件模拟直播源,通过rtmp协议推送到nginx服务器

 nginx 配置文件 增加

 

[html]  view plain  copy
 
 在CODE上查看代码片派生到我的代码片
  1. rtmp {    
  2.     server {    
  3.         listen 1935;    
  4.        application hls {    
  5.              live on;    
  6.              hls on;    
  7.              hls_path /tmp/app;    
  8.              hls_fragment 5s;    
  9.   
  10.        }    
  11.     }    
  12. }    

 

http 下面增加

[html]  view plain  copy
 
 在CODE上查看代码片派生到我的代码片
  1. location /hls {    
  2.            #server hls fragments    
  3.            types{    
  4.              application/vnd.apple.mpegurl m3u8;    
  5.              video/mp2t ts;    
  6.            }    
  7.         alias /tmp/app;    
  8.         expires -1;    
  9.         }    

 

在 safari浏览器或者vlc中打开 测试地址:  http://192.168.1.105:8080/hls/test.m3u8

 

可以直播了

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM