linux 安装ffmpeg详解

来源:互联网 发布:淘宝网升级企业店铺 编辑:程序博客网 时间:2024/06/15 23:51

前言:

      .tar.gz包解压:tar -zvxf xxx.tar.gz

      .tar.bz2包解压:bzip2 -d  xxx.tar.bz2解压成.gz包。


1、lame

     地址:http://sourceforge.net/project/showfiles.php?group_id=290&package_id=309
     安装方法: 
#tar -vxf lame-3.99.5.tar.gz#cd lame-3.99.5#./configure --enable-shared#make#make install

2、libogg
     地址:http://www.xiph.org/downloads/
     安装方法:
#tar -vxf libogg-1.3.2.tar.gz#cd libogg-1.3.2 #.configure#make#make install

3、libvorbis 
    地址:http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
    安装方法:
#tar -vxf libvorbis-1.1.2.tar.gz#cd libvorbis-1.1.2./autogen.sh
出现错误!!
You must have autoconf installed to compile vorbis.Download the appropriate package for your distribution,or get the source tarball at ftp://ftp.gnu.org/pub/gnu/checking for automake... You must have automake installed to compile vorbis.Download the appropriate package for your system,or get the source from one of the GNU ftp siteslisted in http://www.gnu.org/order/ftp.htmlchecking for libtool... nope.You must have libtool installed to compile vorbis.Download the appropriate package for your system,or get the source from one of the GNU ftp siteslisted in http://www.gnu.org/order/ftp.html
很正常,将依赖的autoconf、automake、libtool安装起即可!
#yum install autoconf automake libtool
安装完毕之后,回来继续安装libvorbis 。
#./autogen.sh#make#make install

4、xvid
     地址:http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz 
   安装方法:
#tar -vxf xvidcore-1.1.3.tar.gz#cd xvidcore-1.1.3/build/generic#./configure#make#make install

5、x264 
   地址: ftp://ftp.videolan.org/pub/videolan/x264/snapshots/ 
   安装方法:
#bzip2 -d last_x264.tar.bz2 #tar -vxf last_x264.tar #cd x264-snapshot-20170615-2245/#./configure
出现错误:
Found no assemblerMinimum version is nasm-2.13If you really want to compile without asm, configure with --disable-asm.
提示没有安装nasm包,当然也可以在./configure --disable-asm,但是我们在这里将nasm包安装起来。
地址:http://www.nasm.us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.xz
 安装方法:
#tar -vxf nasm-2.13.01.tar.xz#cd cd nasm-2.13.01#./configure#make && make install
安装完毕nasm之后,继续安装x264.
#cd ../x264-snapshot-20170615-2245/#./configure#make && make install

6、libdca
   地址: http://www.videolan.org/developers/libdca.html
   安装方法:
#tar -vxf tar -vxf libdca-0.0.5.tar.bz2#cd libdca-0.0.5#./configure#make && make install

7、a52dec
   地址:http://liba52.sourceforge.net/downloads.html 
  安装方法:
#tar -vxf a52dec-0.7.4.tar.gz #cd a52dec-0.7.4#./configure#make && make install

8、faad2
   地址:http://www.audiocoding.com/downloads.html
   安装方法:
#tar -vxf faad2-2.7.tar.gz #cd faad2-2.7#./configure#make && make install

9、faac 
    地址:http://www.audiocoding.com/downloads.html
   安装方法:
解压,进入faac目录。
#./bootstrap#./configure#make
出现错误:
make时会出现有关3gp.o的错误,解决方法:
注释掉faac-1.28/common/mp4v2/mpeg4ip.h里的第126行:char *strcasestr(const char *haystack, const char *needle);
重新make
#make#make install

10、amrnb
   地址:http://ftp.penguin.cz/pub/users/utx/amr/
  安装方法:
#同上

11、amrwb
   地址:http://ftp.penguin.cz/pub/users/utx/amr/
    安装方法:
#同上

以上是在安装ffmpeg所需的工具包,必须安装。
以上软件安装总结:软件安装步骤大家没必要去记忆,拿到一个软件,首先查看ReadMe文件,它会告诉我们,该软件运行平台(Windows/Linux/Mac)及相应安装步骤,按照该步骤安装即可或者找官网也有相应的安装说明。

12、ffmpeg

    从ffmpeg官网:http://ffmpeg.org/download.html下载tar.bz2格式包。
    安装方法:

#tar -jxvf ffmpeg-3.3.3.tar.bz2#cd ffmpeg-3.3.3#./configure --enable-shared --prefix=/usr/local/ffmpeg#make (大概需要10分钟)#make install

如果遇到类似错误:ffmpeg: error while loading shared libraries:libavdevice.so.55: cannot open shared object file: No such file or directory

没有相应的动态来接库,其实该链接库在我们安装ffmpeg目录下(默认在/usr/local/ffmepg/lib)

1、搜索该动态库

#find / -name  libavdevice.so.55

2、vi /etc/ld.so.conf

将步骤1搜索到的结果添加到该文件当中。

3、执行ldconfig,使之生效。


也可以将ffmpeg目录加入到环境变量中,如下:

vi /etc/profile

加入以下内容:

FFMPEG=/user/local/ffmpeg

执行下列命令,使之生效:

source /etc/profile