ffmpeg的安装(for X86 and ARM)

来源:互联网 发布:java微信企业号开发 编辑:程序博客网 时间:2024/06/14 02:31

本以为ffmpeg在ARM下的安装挺简单的,想不到还是有点麻烦和复杂。


首先下载ffmpeg的安装包,官网上都有。

然后解压:

#tar -xvzf  ffmpeg*****

然后进入到解压目录中。


对于X86系统,比较简单,先在/usr/local/目录下创建ffmpeg文件夹:

#./configure   --prefix=/usr/local/ffmpeg   --enable-shared

#make

#make install



对于ARM系统,执行:

#./configure  --prefix=/usr/local/ffmpeg  --arch=arm --target-os=linux --enable-shared  --cross-prefix=arm-linux-

这里需要注意的是,编译工具需要针对具体的交叉编译工具而定,加入你的机器上的交叉编译工具是arm-linux-gcc则选择arm-linux-

我的PC上的是arm-none-linux-gnueabi-

树莓派上的是arm-linux-gnueabihf-


如果碰到这样的问题:

C compiler test failed.If you think configure made a mistake, make sure you are using the latestversion from Git.  If the latest version fails, report the problem to theffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.Include the log file "config.log" produced by configure as this will helpsolving the problem.

则是说明交叉编译工具没有选择对,需要仔细查看你得机器下的交叉编译工具


然后执行:

#make

#make install


如果在执行make时碰到这样的问题:

Relocation in generic ELF(EM:3)错误

则是上次编译的和这次编译冲突导致的。执行make  clean后继续make即可。


然后进入到/usr/local/ffmpeg。这里面有我们需要的库文件,把lib下的文件和include下的文件拷贝到/usr/lib/下和/usr/include/下:

#cp ./lib/*  /usr/lib/

#cp .include/* /usr/include/ -rf


如果是第二次拷贝,会让你一个个选择是否覆盖,非常麻烦,可以在cp前面加上/bin/,即/bin/cp,这样使用的就是原生态的cp命令,可以强制覆盖相同文件。


这里还需要注意一个问题,即使是从别的地方拷贝过来的ARM的库,在本机器上也未必能够运行。可能是交叉编译工具的问题吧。

所以要在那台机器上使用库,则在哪台机器上编译安装,一定不要直接拷贝库文件!


原创粉丝点击