ubuntu 安装ffmpeg,步骤以及问题解决方案

下载FFmpeg和libx264的包
ffmpeg-2.4.1.tar.bz2  last_x264.tar.bz2

libx264需要yasm,所以先安装yasm

apt-get install yasm 


然后安装libx264

aptitude install libx264-dev


也可以手动安装libx264(原先libx264在ubuntu的软件源里是没有的只能手动安装,现在有了就可以不用手动安装了)
解压缩libx264

tar -xjvf last_x264.tar.bz2

安装libx264

./configure --enable-shared --enable-pic

make

make install


然后安装ffmpeg,ffmpeg有许多依赖包,需要一个一个先安装
1. libfaac

aptitude install libfaac-dev


2. libmp3lame

aptitude install libmp3lame-dev


3. libtheora

aptitude install libtheora-dev


4. libvorbis

aptitude install libvorbis-dev


5. libxvid

aptitude install libxvidcore-dev


6. libxext

aptitude install libxext-dev


7. libxfixes

aptitude install libxfixes-dev


依赖包安装完后,安装ffmpeg
先解压缩ffmpeg

tar -xjvf ffmpeg-2.4.1.tar.bz2


然后编译安装


./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab --enable-libvorbis


make


make install



下面是可能遇到的错误以及解决方案

在ubuntu 12.04上安装ffmpeg后

命令ffmpeg不管用

把编译后文件中/usr/local/ffmpeg/bin/ffmpeg文件复制到/usr/ bin当中

使用命令成功

ffmpeg -version


ffmpeg默认安装目录为“/usr/local/lib”,有些64位系统下软件目录则为“/usr/lib64”,编译过程中可能会出现“ffmpeg: error while loading shared libraries: libmp3lame.so.0: cannot open shared object file: No such file or directory”等类似的错误,解决办法是建立软链接或者移动库文件到相应的目录:

ln -s /usr/local/lib/libmp3lame.so.0.0.0 /usr/lib64/libmp3lame.so.0

mv /usr/local/lib/libmp3lame.so.0.0.0 /usr/lib64/libmp3lame.so.0


1. ERROR: libopenjpeg not found

http://code.google.com/p/openjpeg/downloads/detail?name=openjpeg-1.5.1.tar.gz&can=2&q=

下载openjpeg-1.5.1的代码,注意不要下载openjpeg-2.0的,否则ffmpeg跟openjpeg的接口不支持,编译会处错误。

configure 
make,make install

找到头文件是在/usr/local/include/openjpeg-1.5.1下面,而ffmpeg在连接的时候,其实是/usr/local/include,所以提示说“ERROR: libopenjpeg not found”。将/usr/local/include/openjpeg-1.5.1下面的头文件“openjpeg.h”拷贝到/usr/local/include下面。

 

1,x264也是有这个问题,x264.h这个文件要放在/usr/local/include下,而不是在/usr/local/下单独建个子目录放。 其他的库都是在make install的时候自己建的子文件夹。

需要将libx264的库文件拷贝到/usr/local/lib下
或者直接在configure的时候,改变路径,如下所示:
./configure --includedir=/usr/local/include --libdir=/usr/local/lib --enable-shared
即可。

 

2. ERROR:libfdk_aac not found

http://sourceforge.net/projects/opencore-amr/?source=directory

下载fdk-aac-0.1.1.tar.gz 

执行 

configure

make

make install

 

3. ERROR:libilbc not found

https://github.com/dekkers/libilbc

git clone git://github.com/dekkers/libilbc.git

解压

安装cmake,如下所示

sudo apt-get install cmake

创建一个build目录,执行:

cd build
cmake ..           (这里的..意思是,如果是一个.表示CMakeLists.txt在当前路径下,两个..表示CMakeLists.txt在上一层目录下)

cmake install ..
make                (在build/bin下会找到可执行文件。)

make install      (将生成的库拷贝到linux相关目录下)

 

4. ERROR: libmp3lame >= 3.98.3 not found

sudo apt-get install libmp3lame-dev

 

5. ERROR: libopencore_amrnb not found

sudo apt-get install libx264-dev libxvidcore-dev libopencore-amrwb-dev libopencore-amrnb-dev libfaad-dev libfaac-dev libmp3lame-dev \
libtwolame-dev liba52-0.7.4-dev libcddb2-dev libcdaudio-dev libcdio-cdda-dev libvorbis-dev libopenjpeg-dev

(5) git chone git://git.videolan.org/x264.git
configure
make && make install
(6) ERROR: libvo_aacenc not found
http://sourceforge.net/projects/opencore-amr/files/vo-aacenc/vo-aacenc-0.1.2.tar.gz/download
(7) ERROR: libvo_amrwbenc not found
http://sourceforge.net/projects/opencore-amr/files/vo-amrwbenc/
(8) ERROR: libvpx decoder version must be >=0.9.1
http://code.google.com/p/webm/downloads/detail?name=libvpx-v1.1.0.tar.bz2&can=2&q=
(9)编译 ffplay 需要 libsdl1.2-dev 库:
sudo apt-get install libsdl1.2-dev (10)ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file

Solution:
Search the file libavdevice.so.52 on the server using the ‘find’ command

1
# find / -name libavdevice.so.52

You need to add the path to the directory the file is in, in the ‘ld.so.conf’ file. If for example the file is located under “/usr/local/lib” directory, execute

1
# vi /etc/ld.so.conf

and add the following at the bottom of the file

 
/usr/local/lib

 

加入自己编译ffmpeg的路径/lib

执行ldconfig

 

7. Encoder (codec id 86017) not found for output stream #0.0

解决方案:http://diogomelo.net/blog/11/encoder-codec-id-86017-not-found-output-stream-00-compile-ffmpeg-yourself




  • 3
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值