linux系统下从源码安装FFmpeg、h264 、libfaac 在power8平台,rhel7.0 或者ubuntu14.04

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/linzhaolove/article/details/43083469

声明:此文档只做学习交流使用,请勿用作其他商业用途

author:朝阳_tony
E-mail : [email protected]
Create Date:2015-1-24 11:10:23 Saturday
Last Change:2015-1-24 11:38:31 Saturday
转载请注明出处: http://blog.csdn.net/linzhaolover


摘要:

最近在power8 平台上安装ffmpeg遇到了一点问题总结,说一些需要注意的地方,同时也是记录一下自己的安装过程,方便后期查阅,与大家一起分享一下;

有时候到找不到对应的程序安装包,只好自己从源码编译,然后安装对应的平台;

测试环境:

RedHat 系统 Big Endian

Red Hat Enterprise Linux Server release 7.0 (Maipo)
ppc64 power8 Big endian

#uname -a
Linux 3.10.0-123.el7.ppc64 #1 SMP Mon May 5 11:18:37 EDT 2014 ppc64 ppc64 ppc64 GNU/Linux

还有  Ubuntu14.04 系统 Little Endian

Distributor ID: Ubuntu
Description:    Ubuntu 14.04 LTS
Release:        14.04
Codename:       trusty

# uname -a
Linux 3.13.0-29-generic #53-Ubuntu SMP Wed Jun 4 21:02:53 UTC 2014 ppc64le ppc64le ppc64le GNU/Linux 

1、安装libx264 

git clone git://git.videolan.org/x264
./configure --prefix=/usr --libdir=/usr/lib64 --enable-shared
make install
一般自己的编译的代码,在安装的时候都会默认安装到/usr/local目录下,但有时候如果这个库需要被其他的软件引用,可能回导致无法找到等问题;

由于我的系统64位的,所以指定库的目录是lib64 ,

最后为了让其他库引用,需要enable shared ,


2、安装libfaac

平时我们在Ubuntu下最喜欢安装软件命令莫过于apt-get  了,

# apt-get install libfaac-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libfaac-dev
啥,没有安装包,

查看了一下faac的官网,http://www.audiocoding.com/index.html

原来有了新的安装包faad

apt-get install libfaad-dev

安装faad成功了,但我们想安装的是faac啊, 好吧,还是下载源码手动安装;

wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz
./configure --prefix=/usr --libdir=/usr/lib64
make install

上面是安装lib64目录,在ffmpeg中还调用不到;
还需要安装到lib目录下才行,
./configure --prefix=/usr --libdir=/usr/lib
make install

 
 
 
 

编译faac时遇到一个错误;是自己的定义与系统库中的头文件定义冲突,

In file included from mp4common.h:29:0,
                 from 3gp.cpp:28:
mpeg4ip.h:126:58: error: new declaration ‘char* strcasestr(const char*, const char*)’
 char *strcasestr(const char *haystack, const char *needle);
                                                          ^
In file included from mpeg4ip.h:107:0,
                 from mp4common.h:29,
                 from 3gp.cpp:28:
/usr/include/string.h:365:26: error: ambiguates old declaration ‘const char* strcasestr(const char*, const char*)’
 extern "C++" const char *strcasestr (const char *__haystack,
                          ^
临时解决办法,当然是修改自己的程序了,注释掉自身的

vim common/mp4v2/mpeg4ip.h
注释掉126行  char *strcasestr(const char *haystack, const char *needle);

3、安装FFmpeg 使能h264 、libfaac库

我写这篇文章时FFmpeg的版本是v2.5,

git clone git://source.ffmpeg.org/ffmpeg

./configure  --enable-gpl --enable-memory-poisoning --enable-avresample --cpu=power8 \
        --prefix=/usr \
        --libdir=/usr/lib64 \
        --enable-shared \
        --shlibdir=/usr/lib64 \
        --enable-nonfree \
        --enable-libx264 \
        --enable-libfaac

make -j8
make install
 
 

--cpu=power8 在p8平台,最好打开这个标志,这样可以使能很多的优化库;如果你的不是p8,请不要指定对应平台,或者用缺省值;

--enable-nonfree 由于FFmpeg支持很多费免费的库,而libfaac又是非free的库,所以必须打开这标志,

最后是能你想安装的库

--enable-libx264       --enable-libfaac


总结:

工作中经常遇到各样的问题,多开动脑筋,想想怎么做,大部分事情还是可以解决的;


猜你喜欢

转载自blog.csdn.net/linzhaolove/article/details/43083469