7

linux安装编译配置ffmpeg

 1 year ago
source link: https://blog.p2hp.com/archives/9692
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

linux安装编译配置ffmpeg | Lenix Blog

1、下载 ffmpeg
下载网址:http://www.ffmpeg.org/download.html

2、解压缩
tar -zxvf ffmpeg-2.0.1.tar.gz

3、编辑profile文件:
       vi /etc/profile
    在文件末尾加上两句话:
    export FFMPEG_HOME=/usr/local/ffmpeg
    export PATH=$FFMPEG_HOME/bin:$PATH
如果原来已经配置了java环境变量的话
    export PATH=$FFMPEG_HOME/bin:$JAVA_HOME/bin:$PATH
执行 source etc/profile
输出变量 echo $FFMPEG_HOME

4、配置安装路径之类的:

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

--enable-shared 参数据说是允许其编译产生动态库,在以后的编程中要用到这个几个动态库,我也没考证,就直接用了。

如果出现异常,提示因为缺少yasm,需要添加参数,再执行以下命令:

./configure --enable-shared --disable-yasm --prefix=/usr/local/ffmpeg

如果执行结果不对,可以根据提示信息,并查看帮助,解决问题
./configure --help

5、编译安装
make
make install

6、安装之后在/usr/local/ffmpeg会看到有三个目录
bin 执行文件目录
lib 静态,动态链接库目录
include 编程用到的头文件

7、为了防止执行程序找不到库文件,
可以将/usr/local/ffmpeg/lib目录设置到LD_LIBRARY_PATH环境变量

8、若出现error while loading shared libraries: libavdevice.so.52的错误  (注意是  l (是le不是ai ))
修改/etc/ld.so.conf 在最后一行加上/usr/local/ffmpeg/lib
ldconfig -v
并修改 /usr/local/ffmpeg/lib目录下的文件权限为777


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK