服務(wù)項目:網(wǎng)站建設(shè)、仿站、程序開發(fā)、APP開發(fā)設(shè)計、移動網(wǎng)站開發(fā)設(shè)計、企業(yè)網(wǎng)站設(shè)計、電子商務(wù)網(wǎng)站開發(fā)、網(wǎng)站維護、網(wǎng)站推廣、UX/UI 、HTML5、CSS3、JS / Jquery ...
四川???萍加邢薰?></a></div>
                    <div   id=四川浚??萍加邢薰? title=
四川???萍加邢薰?(開發(fā)設(shè)計官網(wǎng))TEL : 15308000360 / QQ : 38585404

您的位置:首頁 > 技術(shù)經(jīng)驗 > 服務(wù)器 > 正文

在CentOS上編譯安裝FFmpeg
技術(shù)支持服務(wù)電話:15308000360 【7x24提供運維服務(wù),解決各類系統(tǒng)/軟硬件疑難技術(shù)問題】

在CentOS編譯安裝ffmpeg比較麻煩,以前也搞過多次,由于博客調(diào)整,特重新記錄一下,以備不時之需。

若此篇文章還不能解決您的問題,請聯(lián)系QQ:38585404  (有償技術(shù)支持)

使用yum安裝ffmpeg和相關(guān)軟件
快速安裝 ffmpeg 直接安裝:

yum install ffmpeg ffmpeg-devel
若沒有找到相應(yīng)包,需要先加入要應(yīng)的包。
將下列代碼命名為 dag.repo 放在 /etc/yum.repos.d 目錄 下。
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1
然后再執(zhí)行上方的安裝命令。 安裝 ffmpeg-php 擴展
wget /path/to/this/file/ffmpeg-php-0.5.2.1.tbz2
tar -xjf ffmpeg-0.5.2.1.tbz2
phpize
./configure
make
make install
修改 php.ini 文件 安裝完成后
將會在/usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so
看到php擴展文件。

打開php.ini文件,加入下面兩行
[ffmpeg]
extension=ffmpeg.so
重啟WEB服務(wù)器。使用phpinfo即可看到ffmpeg相關(guān)信息。

php 使用方法
$extension = "ffmpeg";
$extension_soname = $extension . "." . PHP_SHLIB_SUFFIX;
$extension_fullname = PHP_EXTENSION_DIR . "/" . $extension_soname;

// load extension
if(!extension_loaded($extension)) {
    dl($extension_soname) or die("Can't load extension $extension_fullname\n");
}
?>
安裝 Mplayer 和 Mencoder
yum install mplayer mencoder
常見問題
常見問題及解決方案請參考這里:http://www.mysql-apache-php.com/ffmpeg-install.htm

自行編譯安裝 ffmpeg

安裝依賴項
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel
安裝相應(yīng)軟件包
可以建立目錄存放軟件包
mkdir ~/ffmpeg_sources
注意:以下軟件包請有選擇的安裝,如果不需要請在./configure時移除或關(guān)閉相關(guān)選項
安裝 yasm
Yasm是一個完全重寫的NASM匯編。目前,它支持x86和AMD64指令集。 x264 和 FFmpeg都使用Yasm.
cd ~/ffmpeg_sources
git clone --depth 1 git://github.com/yasm/yasm.git
cd yasm
autoreconf -fiv
./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin"
make
make install
make distclean
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar zxf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin"
make
make install
make distclean
. ~/.bash_profile
安裝 x264 H.264 編碼器。http://trac.ffmpeg.org/wiki/Encode/H.264
cd ~/ffmpeg_sources
git clone --depth 1 git://git.videolan.org/x264
cd x264
./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin" --enable-static
make
make install
make distclean
wget ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
tar jxf last_x264.tar.bz2
cd x264-snapshot-20130311-2245/
./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin" --enable-shared
make
make install
make distclean
需要ffmpeg配置./configure --enable-gpl --enable-libx264
注:由于libx264的code有GPL信息,所以,支持libx264時,需要—enable-gpl,ffmpeg在license方面還是比我們國內(nèi)的人更重視
安裝 x265
H.265/HEVC編碼器.http://trac.ffmpeg.org/wiki/Encode/H.265
cd ~/ffmpeg_sources
hg clone https://bitbucket.org/multicoreware/x265
cd ~/ffmpeg_sources/x265/build/linux
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/local/ffmpeg" -DENABLE_SHARED:bool=off ../../source
make
make install
cd ~/ffmpeg_sources
wget https://bitbucket.org/multicoreware/x265/downloads/x265_1.9.tar.gz
cd ~/ffmpeg_sources/x265
cmake ./source -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/local/ffmpeg" -DENABLE_SHARED:bool=off
make
make install
需要ffmpeg配置./configure --enable-gpl --enable-libx265
安裝 libfdk_aac
AAC音頻編碼器,F(xiàn)raunhofer AAC library
cd ~/ffmpeg_sources
git clone --depth 1 git://git.code.sf.net/p/opencore-amr/fdk-aac
cd fdk-aac
autoreconf -fiv
./configure --prefix="/usr/local/ffmpeg" --enable-shared
make
make install
make distclean
需要ffmpeg配置--enable-libfdk_aac ,如果指定了--enable-gpl還要配置--enable-nonfree
安裝 libmp3lame
Mp3音頻編碼器
wget http://iweb.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar zxf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin" --enable-shared --enable-nasm
make
make install
make distclean
需要ffmpeg配置--enable-libmp3lame
安裝 libopus Opus
音頻編解碼器
cd ~/ffmpeg_sources
git clone git://git.opus-codec.org/opus.git
cd opus
autoreconf -fiv
./configure --prefix="/usr/local/ffmpeg" --disable-shared
make
make install
make distclean
wget http://downloads.xiph.org/releases/opus/opus-1.0.3.tar.gz
tar zxf opus-1.0.3.tar.gz
cd opus-1.0.3
./configure --prefix="/usr/local/ffmpeg" --enable-shared
make
make install
make distclean
需要ffmpeg配置--enable-libopus
安裝 libogg庫
libogg是Ogg流庫,libtheora、libvorbis需要libogg庫,speex需要它。
cd ~/ffmpeg_sources
curl -O http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
tar xzvf libogg-1.3.2.tar.gz
cd libogg-1.3.2
CFLAGS="-fPIC" ./configure --prefix="/usr/local/ffmpeg" --disable-shared
make
make install
make distclean
安裝 libvorbis庫
Vorbis音頻編碼器,需要libogg庫。http://trac.ffmpeg.org/wiki/CompilationGuide/Centos#libogg
cd ~/ffmpeg_sources
curl -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz
tar xzvf libvorbis-1.3.4.tar.gz
cd libvorbis-1.3.4
LDFLAGS="-L/usr/local/ffmpeg/lib" CPPFLAGS="-I/usr/local/ffmpeg/include" ./configure --prefix="/usr/local/ffmpeg" --with-ogg="/usr/local/ffmpeg" --disable-shared
make
make install
make distclean
需要ffmpeg配置--enable-libvorbis
安裝 libvpx
VP8/VP9視頻編碼器
cd ~/ffmpeg_sources
git clone --depth 1 http://git.chromium.org/webm/libvpx.git
cd libvpx
./configure --prefix="/usr/local/ffmpeg" --enable-examples
make
make install
make clean
需要ffmpeg配置--enable-libvpx

安裝 libfaac
ACC音頻編碼器
wget http://ncu.dl.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.gz
tar zxf faac-1.28.tar.gz
cd faac-1.28
./bootstrap
./configure --prefix=/usr/local/ffmpeg --with-mp4v2 --enable-shared
make
make install
make distclean
需要ffmpeg配置--enable-libfaac

make時可能會出現(xiàn)如下錯誤:
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*)’ /usr/include/string.h:369:28: error: ambiguates old declaration ‘const char* strcasestr(const char*, const char*)’
make[3]: *** [3gp.o] Error 1
make[3]: Leaving directory `/usr/local/pc/ffmpeg/faac-1.28/common/mp4v2'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/usr/local/pc/ffmpeg/faac-1.28/common'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/pc/ffmpeg/faac-1.28'
make: *** [all] Error 2
解決方法: 先執(zhí)行:
make clean
修改源文件:
vim common/mp4v2/mpeg4ip.h
找到這句:char *strcasestr(const char *haystack, const char *needle); 把這一行注釋掉,在前面加 //
重新繼續(xù)編譯:
make
make install

開始編譯安裝 ffmpeg
cd ~/ffmpeg_sources
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg
PKG_CONFIG_PATH="/usr/local/ffmpeg/lib/pkgconfig" ./configure --prefix="/usr/local/ffmpeg" --extra-cflags="-I/usr/local/ffmpeg/include" --extra-ldflags="-L/usr/local/ffmpeg/lib" --bindir="/usr/local/bin" --pkg-config-flags="--static" --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libfaac --enable-libvpx
make
make install
make distclean
hash -r
注: 編譯完成后ffmpeg,ffprobe,ffserver,lame,x264都可以使用。
編譯安裝時可以參考Windows Build:http://ffmpeg.zeranoe.com/builds/
如果還需要持續(xù)更新請保留ffmpeg_sources目錄。

編輯/etc/ld.so.conf文件加入如下內(nèi)容
/usr/local/lib
/usr/local/ffmpeg/lib

保存退出后執(zhí)行l(wèi)dconfig命令

其它可選軟件包

安裝 OpenCORE AMR
wget http://iweb.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz
tar zxf opencore-amr-0.1.3.tar.gz
./configure --prefix="/usr/local/ffmpeg"  –enable-shared
make
make install
需要ffmpeg配置--enable-libopencore-amrnb 和/或 --enable-libopencore-amrwb
安裝 VisualOn AAC
注:github的tag和master版均無法autoconf,用zeranoe版代替
wget wget http://ffmpeg.zeranoe.com/builds/source/external_libraries/vo-aacenc-0.1.3.tar.xz
xz -d vo-aacenc-0.1.3.tar.xz
tar xf vo-aacenc-0.1.3.tar
cd vo-aacenc-0.1.3
./configure --prefix="/usr/local/ffmpeg" 
make
make install
也可
wget http://iweb.dl.sourceforge.net/project/opencore-amr/vo-aacenc/vo-aacenc-0.1.3.tar.gz
需要ffmpeg配置--enable-libvo-aacenc
安裝 VisualOn AMR-WB
注:github的tag和master版均無法autoconf,用zeranoe版代替
wget http://ffmpeg.zeranoe.com/builds/source/external_libraries/vo-amrwbenc-0.1.2.tar.xz
xz -d vo-amrwbenc-0.1.2.tar.xz
tar xf vo-amrwbenc-0.1.2.tar
cd vo-amrwbenc-0.1.2
./configure --prefix="/usr/local/ffmpeg"
需要ffmpeg配置--enable-libvo-amrwbenc
安裝 frei0r
先安裝新版autoconf,這會覆蓋掉系統(tǒng)中的舊版本哦
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar zxf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure --prefix="/usr/local/ffmpeg" 
make
make install
wget http://files.dyne.org/frei0r/releases/frei0r-plugins-1.4.tar.gz
tar zxf frei0r-plugins-1.4.tar.gz
cd frei0r-plugins-1.4
./configure --prefix="/usr/local/ffmpeg" 
make
make install
安裝 gnutls

注意:/etc/ld.so.conf要加上lib64。并且不要使用yum remove gnutls gnutls-devel 首先安裝nettle:

wget http://www.lysator.liu.se/~nisse/archive/nettle-2.5.tar.gz
tar zxf nettle-2.5.tar.gz
cd nettle-2.5
./configure --prefix="/usr/local/ffmpeg"  –enable-shared
make
make install
然后安裝gnutls新版:
wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.1/gnutls-3.1.9.1.tar.xz
xz -d gnutls-3.1.9.1.tar.xz
tar xf gnutls-3.1.9.1.tar
cd gnutls-3.1.9.1
PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig ./configure –enable-shared
make
make install
安裝 rtmpdump
wget http://rtmpdump.mplayerhq.hu/download/rtmpdump-2.3.tgz tar zxf rtmpdump-2.3.tgz cd rtmpdump-2.3 make make install
安裝 schroedinger
注:先安裝好orc庫
wget http://code.entropywave.com/download/orc/orc-0.4.17.tar.gz
tar zxf orc-0.4.17.tar.gz
cd orc-0.4.17
./configure --prefix="/usr/local/ffmpeg" 
make
make install
/sbin/ldconfig
wget http://diracvideo.org/download/schroedinger/schroedinger-1.0.11.tar.gz
tar zxf schroedinger-1.0.11.tar.gz
cd schroedinger-1.0.11
PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig ./configure
make
make install
安裝 soxr
注:新版libsoxr貌似與當前ffmpeg不兼容,用舊版
yum install -y xz
wget http://hivelocity.dl.sourceforge.net/project/soxr/soxr-0.1.0-Source.tar.xz
xz -d soxr-0.1.0-Source.tar.xz
tar xf soxr-0.1.0-Source.tar
cd soxr-0.1.0-Source
./go
cd Release/
make
make install
/sbin/ldconfig
安裝 speex
音頻編碼解碼器。需要安裝libogg庫
yum install speex-devel
wget http://downloads.xiph.org/releases/speex/speex-1.2rc1.tar.gz
tar zxf speex-1.2rc1.tar.gz
cd speex-1.2rc1
./configure --prefix="/usr/local/ffmpeg" 
make
make install
ffmpeg ./configure 添加 --enable-libspeex
安裝 libfreetype
字體呈現(xiàn)庫,使用drawtext http://ffmpeg.org/ffmpeg-filters.html#drawtext-1
yum install freetype-devel
ffmpeg ./configure 添加 --enable-libfreetype
安裝 libsdl庫
wget http://www.libsdl.org/release/SDL-1.2.15.tar.gz
tar zxf SDL-1.2.15.tar.gz
cd SDL-1.2.15
./configure --prefix="/usr/local/ffmpeg" 
make
make install
/sbin/ldconfig
安裝 theora
Theora視頻編碼器,需要需要libogg,libvorbis和libsdl庫
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
tar zjf libtheora-1.1.1.tar.bz2
./configure  --prefix="/usr/local/ffmpeg" --with-ogg="/usr/local/ffmpeg" --disable-examples --enable-shared --disable-sdltest --disable-vorbistest
make
make install
make distclean
ffmpeg ./configure 添加 --enable-libtheora
安裝 twolame
wget http://downloads.sourceforge.net/twolame/twolame-0.3.13.tar.gz
tar zxf twolame-0.3.13
.tar.gz
cd twolame-0.3.13
./configure --prefix="/usr/local/ffmpeg" 
make
make install
/sbin/ldconfig
安裝 xvid
wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
tar zxf xvidcore-1.3.2.tar.gz
cd xvidcore
cd build/generic
./configure --prefix="/usr/local/ffmpeg" 
make
make install
更新FFmpeg及相關(guān)組件
更新依賴項
刪除舊文件,更新依賴項
rm -rf ~/ffmpeg_build ~/bin/{ffmpeg,ffprobe,ffserver,lame,vsyasm,x264,yasm,ytasm}
# yum install autoconf automake cmake gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel
更新 x264
cd ~/ffmpeg_sources/x264
make distclean
git pull
然后運行
./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin" --enable-static
make
make install
make distclean
更新 x265
cd ~/ffmpeg_sources/x265
rm -rf ~/ffmpeg_sources/x265/build/linux/*
hg update
cd ~/ffmpeg_sources/x265/build/linux
然后運行
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/local/ffmpeg" -DENABLE_SHARED:bool=off ../../source
make
make install
更新 libfdk_aac
cd ~/ffmpeg_sources/libfdk_aac
make distclean
git pull
然后運行
cd fdk-aac
autoreconf -fiv
./configure --prefix="/usr/local/ffmpeg" --disable-shared
make
make install
make distclean
更新 libvpx
cd ~/ffmpeg_sources/libvpx
make clean
git pull
然后運行
cd libvpx
./configure --prefix="/usr/local/ffmpeg" --disable-examples
make
make install
make clean
更新FFmpeg
cd ~/ffmpeg_sources/ffmpeg
make distclean
git pull
然后運行
cd ffmpeg
PKG_CONFIG_PATH="/usr/local/ffmpeg/lib/pkgconfig" ./configure --prefix="/usr/local/ffmpeg" --extra-cflags="-I/usr/local/ffmpeg/include" --extra-ldflags="-L/usr/local/ffmpeg/lib" --bindir="/usr/local/bin" --pkg-config-flags="--static" --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
make
make install
make distclean
hash -r
還原所有本文安裝內(nèi)容
rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffserver,lame,vsyasm,x264,yasm,ytasm}
# yum erase autoconf automake cmake gcc gcc-c++ git libtool mercurial nasm pkgconfig zlib-devel
hash -r
注:如安裝其它軟件包需要自行刪除

自動安裝shell

https://gist.github.com/gboudreau/f24aed76b4cc91bfb2c1

#!/bin/sh
 
# Based on instructions found here: http://wiki.razuna.com/display/ecp/FFMpeg+Installation+on+CentOS+and+RedHat#FFMpegInstallationonCentOSandRedHat-InstallX264
 
if [ "`/usr/bin/whoami`" != "root" ]; then
    echo "You need to execute this script as root."
    exit 1
fi
 
cat > /etc/yum.repos.d/centos.repo<
[centos]
name=CentOS-6 – Base
baseurl=http://mirror.centos.org/centos/6/os/x86_64/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
enabled=1
priority=1
protect=1
includepkgs=SDL SDL-devel gsm gsm-devel libtheora theora-tools libdc1394 libdc1394-devel libraw1394-devel
EOF
rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
 
rpm -Uhv http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
yum -y update
 
yum -y install glibc gcc gcc-c++ autoconf automake libtool git make nasm pkgconfig
yum -y install SDL-devel a52dec a52dec-devel alsa-lib-devel faac faac-devel faad2 faad2-devel
yum -y install freetype-devel giflib gsm gsm-devel imlib2 imlib2-devel lame lame-devel libICE-devel libSM-devel libX11-devel
yum -y install libXau-devel libXdmcp-devel libXext-devel libXrandr-devel libXrender-devel libXt-devel
yum -y install libogg libvorbis vorbis-tools mesa-libGL-devel mesa-libGLU-devel xorg-x11-proto-devel zlib-devel
yum -y install libtheora theora-tools
yum -y install ncurses-devel
yum -y install libdc1394 libdc1394-devel
yum -y install amrnb-devel amrwb-devel opencore-amr-devel
 
cd /opt
wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
tar xzvf xvidcore-1.3.2.tar.gz && rm -f xvidcore-1.3.2.tar.gz
cd xvidcore/build/generic
./configure --prefix="/usr/local/ffmpeg" && make && make install
 
cd /opt
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.1.tar.gz
tar xzvf libogg-1.3.1.tar.gz && rm -f libogg-1.3.1.tar.gz
cd libogg-1.3.1
./configure --prefix="/usr/local/ffmpeg" --disable-shared && make && make install
 
cd /opt
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz
tar xzvf libvorbis-1.3.4.tar.gz && rm -f libvorbis-1.3.4.tar.gz
cd libvorbis-1.3.4
./configure --prefix="/usr/local/ffmpeg" --with-ogg="/usr/local/ffmpeg" --disable-shared && make && make install
 
cd /opt
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz
tar xzvf libtheora-1.1.1.tar.gz && rm -f libtheora-1.1.1.tar.gz
cd libtheora-1.1.1
./configure --prefix="/usr/local/ffmpeg" --with-ogg="/usr/local/ffmpeg" --disable-examples --disable-shared --disable-sdltest --disable-vorbistest && make && make install
 
cd /opt
wget http://downloads.sourceforge.net/opencore-amr/vo-aacenc-0.1.2.tar.gz
tar xzvf vo-aacenc-0.1.2.tar.gz && rm -f vo-aacenc-0.1.2.tar.gz
cd vo-aacenc-0.1.2
./configure --prefix="/usr/local/ffmpeg" --disable-shared && make install
 
yum -y remove yasm
cd /opt
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzfv yasm-1.2.0.tar.gz && rm -f yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin" && make install
export "PATH=$PATH:/usr/local/bin" 
 
cd /opt
git clone http://git.chromium.org/webm/libvpx.git
cd libvpx
git checkout tags/v1.3.0
./configure --prefix="/usr/local/ffmpeg" --disable-examples && make && make install
 
cd /opt
git clone git://git.videolan.org/x264.git
cd x264
./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin" --enable-static && make install
 
export LD_LIBRARY_PATH=/usr/local/lib/:/usr/local/ffmpeg/lib/
echo /usr/local/lib >> /etc/ld.so.conf.d/custom-libs.conf
echo /usr/local/ffmpeg/lib/ >> /etc/ld.so.conf.d/custom-libs.conf
ldconfig
 
cd /opt
git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
git checkout release/2.2
PKG_CONFIG_PATH="/usr/local/ffmpeg/lib/pkgconfig"
export PKG_CONFIG_PATH
./configure --prefix="/usr/local/ffmpeg" --extra-cflags="-I/usr/local/ffmpeg/include" --extra-ldflags="-L/usr/local/ffmpeg/lib" --bindir="/usr/local/bin" \
--extra-libs=-ldl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvpx --enable-libfaac \
--enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libvo-aacenc --enable-libxvid --disable-ffplay \
--enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads --arch=x86_64 && make install
 
# Test the resulting ffmpeg binary
cp /usr/local/bin/ffmpeg /usr/bin/
ffmpeg -v
git clone --depth 1 http://chromium.googlesource.com/webm/libvpx.git



上一篇:CentOS下 ls ,tree,用法簡單命令
下一篇:安裝PHP組件uploadprogress

相關(guān)熱詞搜索:centos FFmpeg