通過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