您的位置:首页 > 运维架构 > Nginx

nginx支持MP4模块

2015-09-07 08:54 585 查看

nginx的安装参考:http://lpyyn.iteye.com/blog/2224379

nginx对MP4的支持模块使用Mod-H264-Streaming-Nginx-Version2 ,可以在其官网下载:http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-Nginx-Version2

安装步骤:

  1. 下载http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.7.tar.gz , 解压。
  2. 注释掉解压目录下src/ngx_http_streaming_module.c文件的158~161行的代码,如下图。
  3. 跳转到nginx解压目录,配置安装MP4模块支持。
    ./configure --prefix=/server/nginx --add-module=../nginx_mod_h264_streaming-2.2.7
    
    make
    
    make install
     
nginx本身对MP4的支持        ngnix在现在的稳定版本1.8.0中已经提供了对MP4的支持模块ngx_http_mp4_module ,在配置时可以使用。如果使用第三方的MP4模块不需要安装此模块。 相关参考:http://nginx.org/en/docs/http/ngx_http_mp4_module.html#mp4_limit_rate 
./configure user=www --group=www --prefix=/usr/local/nginx --with-http_spdy_module --with-http_stub_status_module --with-http_ssl_module --with-http_mp4_module --with-http_flv_module --with-pcre
      注:mp4_limit_rate 和 mp4_limit_rate_after只有在商业版本的nginx中才有,参考:https://www.nginx.com/products/streaming-media-delivery/ ,可以使用limit_rate 和 limit_rate_after做下载带宽的限制。如下命令:在下载10m之后,限制传输带宽为150k。
location ~* \.mp4$ {
root /vedio ;
mp4 ;
mp4_buffer_size 1m ;
mp4_max_buffer_size 10m ;
limit_rate 150k ;
limit_rate_after 10m ;
}
  阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: