nginx添加mp4、flv视频支持模块

系统:Centos7
nginx版本:1.10
1、下载 nginx_mod_h264_streaming

cd opt
wget http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.7.tar.gz
tar xf  nginx_mod_h264_streaming-2.2.7.tar.gz

2、编译nginx

tar xf nginx-1.10.3.tar.gz
cd nginx-1.10.3 
./configure --prefix=/data/nginx --with-http_ssl_module \
--with-http_realip_module --with-http_addition_module \
--with-http_xslt_module --with-http_image_filter_module \
--with-http_sub_module --with-http_dav_module --with-http_flv_module \
--with-http_mp4_module --with-http_gzip_static_module \
--with-http_random_index_module --with-http_secure_link_module \
--with-http_stub_status_module --with-pcre=/usr/local/pcre-8.31 \
--with-openssl=/usr/local/openssl-0.9.8r \
--add-module=/opt/nginx_mod_h264_streaming-2.2.7

3、报错ngx_http_streaming_module.c:158: 错误:‘ngx_http_request_t’ 没有名为 ‘zero_in_uri’ 的成员
解决:修改nginx_mod_h264_streaming-2.2.7的源代码

vi nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c
....
#  /* TODO: Win32 */
#  if (r->zero_in_uri)
#  {
#    return NGX_DECLINED;
#  }

注释或者删除以上代码,即可。我试过注释但是不起作用,不知道是什么原因,我就直接删除了。
清除编译信息,重新configure;

make clean
./configure ...(config信息同上,不再重复)

4、报错

../nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c: 在函数‘esds_read’中:
../nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:377:16: 错误: 变量‘stream_priority’被设定但未被使用 [-Werror=unused-but-set-variable]
../nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:376:12: 错误: 变量‘stream_id’被设定但未被使用 [-Werror=unused-but-set-variable]
../nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c: 在函数‘stsd_parse_vide’中:
../nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:529:22: 错误: 变量‘level_indication’被设定但未被使用 [-Werror=unused-but-set-variable]
../nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:528:22: 错误: 变量‘profile_compatibility’被设定但未被使用 [-Werror=unused-but-set-variable]
../nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:527:22: 错误: 变量‘profile_indication’被设定但未被使用 [-Werror=unused-but-set-variable]
../nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:526:22: 错误: 变量‘configuration_version’被设定但未被使用 [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors
make[1]: *** [objs/addon/src/mp4_reader.o] 错误 1

解决方法:
修改Makefile文件

vi nginx-1.10.3/objs/Makefile
CC =    cc
CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror  g  -D_LARGEFILE_SOURCE -DBUILDING_NGINX
CPP =   cc -E
LINK =  $(CC)
删除-Werror字段,然后重新make.
make
make install
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值