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