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

安装nginx-rtmp-module和ffmpeg

2016-02-21 00:55 417 查看
  一,nginx-rtmp-module的安装比较简单

1,装好NGINX;

2,到github下载该模块代码,git clone https://github.com/arut/nginx-rtmp-module;

3,cd to NGINX source director;

4,执行以下命令:./configure –prefix=/alidata/webserver/nginx –add-module=/alidata/download/nginx-rtmp-module ,–prefix选项指的是你的nginx安装路径,如果采用默认安装则不用加上此选项。安装完毕后,可以用nginx -V,大写v,查看成功安装了哪些模块。

  

  二,ffmpeg的安装相对复杂一点,ffmgeg依赖的包比较多,centos 下用yun安装会自动解决依赖包的问题,但为了熟悉一下音视频的各种库,于是采用源码安装,ffmpge安装的网上资料可以讲是信手粘来,哈,本人

主要参考这篇博客:http://www.centoscn.com/image-text/install/2015/0523/5512.html ,只要一步一步来,安装不会有啥问题,所以具体步骤就不再重复描述。需要注意的时候,安装VP8/VP9编解码支持库时,make过程中报错,错误信息如下:

# make

make[1]: Nothing to be done for
all'.

[CXX] third_party/libyuv/source/row_gcc.cc.o

third_party/libyuv/source/row_gcc.cc: Assembler messages:

third_party/libyuv/source/row_gcc.cc:789: Error: suffix or operands invalid for
vpmaddubsw’

third_party/libyuv/source/row_gcc.cc:790: Error: suffix or operands invalid for
vpmaddubsw'

third_party/libyuv/source/row_gcc.cc:791: Error: suffix or operands invalid for
vpmaddubsw’

third_party/libyuv/source/row_gcc.cc:792: Error: suffix or operands invalid for
vpmaddubsw'

third_party/libyuv/source/row_gcc.cc:794: Error: suffix or operands invalid for
vphaddw’

third_party/libyuv/source/row_gcc.cc:795: Error: suffix or operands invalid for
vphaddw'

third_party/libyuv/source/row_gcc.cc:796: Error: suffix or operands invalid for
vpsrlw’

third_party/libyuv/source/row_gcc.cc:797: Error: suffix or operands invalid for
vpsrlw'

third_party/libyuv/source/row_gcc.cc:798: Error: suffix or operands invalid for
vpackuswb’

third_party/libyuv/source/row_gcc.cc:799: Error: no such instruction:
vpermd %ymm0,%ymm6,%ymm0'

third_party/libyuv/source/row_gcc.cc:800: Error: suffix or operands invalid for
vpaddb’

third_party/libyuv/source/row_gcc.cc:831: Error: suffix or operands invalid for
vpmaddubsw'

third_party/libyuv/source/row_gcc.cc:832: Error: suffix or operands invalid for
vpmaddubsw’

third_party/libyuv/source/row_gcc.cc:833: Error: suffix or operands invalid for
vpmaddubsw'

third_party/libyuv/source/row_gcc.cc:834: Error: suffix or operands invalid for
vpmaddubsw’

third_party/libyuv/source/row_gcc.cc:836: Error: suffix or operands invalid for
vphaddw'

third_party/libyuv/source/row_gcc.cc:837: Error: suffix or operands invalid for
vphaddw’

…..

third_party/libyuv/source/row_gcc.cc:5321: Error: no such instruction: `vpermq $0xd8,%ymm0,%ymm0’

make[1]: * [third_party/libyuv/source/row_gcc.cc.o] Error 1

make: * [.DEFAULT] Error 2

经过一番谷歌,找到一段话:

As a workaround if your hardware does not support avx2 (grep avx2

/proc/cpuinfo) you can disable it with –disable-avx2

也就是说,我的系统可能不支持avx2这个东东,grep avx2

/proc/cpuinfo果然没有, avx2是一个指令集,支持更多位数的浮点数运算,因此视频解码上更好 效率更高。但是系统不支持,所以得编译一个不包含avx2的VP8/VP9编解码库则可,最后用以下命令编译通过:

libvpx-v1.3.0.tar.bz2

./configure –enable-shared –disable-avx2

make && make install

用的是v1.3.0版本的VP8/VP9编解码库,成功安装ffmpeg后,信息如下:



三,安装TS流分割器segmenter

git clone https://github.com/johnf/m3u8-segmenter

cd m3u8-segmenter

PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure

make

make install

ln -s /usr/local/bin/m3u8-segmenter /usr/local/bin/segmenter

  目前个人对这个工具的理解是它主要是对ts文件切割成一个个m3u8小文件,HLS拉下来的便是这些可以播放的小文件。

  安装完上述模块或者工具,感觉有不少概念很朦胧,比如什么是TS流,h264又是啥,为了便于后续理解,势必要扫清这些障碍,下一个文章的目标须对基本概念作一个描述和理解。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ffmpeg nginx rtmp