Simple Rtmp Server的安裝與簡單使用


Simple Rtmp Server是一個國人編寫的開源的RTMP/HLS流媒體服務器. 功能與nginx-rtmp-module類似, 可以實現rtmp/hls的分發.

  有關nginx-rtmp-module的可參照: http://blog.csdn.NET/redstarofsleep/article/details/45092147

  編譯與安裝過程十分的簡單

 

[plain]  view plain  copy
 
 print?
  1.   ./configure --prefix=/usr/local/srs --rtmp-hls  
  2.   
  3.   make  
  4.   
  5.   make install  

  標准的三條命令就可完成安裝. --rtmp-hls表示開啟rtmp和hls, 其它的編譯參數可通過./configure -h查看.

 

 

  安裝完后,目錄下有三個文件夾conf, etc, objs. 我們常用的是conf和objs兩個目錄下的內容, conf下是各類配置文件的例子, objs下是可執行文件.

  啟動服務器是通過-c參數指定一個配置文件即可

[plain]  view plain  copy
 
 print?
  1.   ./objs/srs -c conf/hls.conf  

  

 

  如果是hls的話,配置文件大概是這樣的:

 

[plain]  view plain  copy
 
 print?
  1. # the config for srs to delivery hls  
  2. # @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleHLS  
  3. # @see full.conf for detail config.  
  4.   
  5. listen              1935;  
  6. max_connections     1000;  
  7. vhost __defaultVhost__ {  
  8.     hls {  
  9.         enabled         on;  
  10.         hls_path        /usr/local/nginx/html;  
  11.         hls_fragment    10;  
  12.         hls_window      60;  
  13.     }  
  14. }  


  其中的hls_path是存放hls分片ts文件和m3u8的目錄, 我上面的例子中把它指定到nginx下.這樣就可以直接播放hls視頻流了.

 

  如果是ffmpeg推送,那是和nginx-rtmp-module是一樣的:

 

[plain]  view plain  copy
 
 print?
  1. ffmpeg -re -i "D:\download\film\aqgy\02.mp4" -vcodec libx264 -vprofile baseline -acodec aac    
  2.  -ar 44100 -strict -2 -ac 1 -f flv -s 1280x720 -q 10 rtmp://server:1935/    
  3. myapp/test1  


  總體來說這個SimpleRtmpServer在配置使用上沒有什么難度,基本都是參照nginx-rtmp-module的.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM