FFMpeg 安裝 ( 支援HTML 5 Video Player Codec:MP4、WebM、Ogg )

FFMpeg發展到現在其實已經很方便安裝
甚至已經可以透過安裝第三方Yum Repo的方式直接使用Yum安裝
但是此一方法有個問題存在 “不支援WebM Codec”
因此即使網路上可以參考的ClipBucket文件已經非常詳細
( 志清國小 陳善豐老師提供的:影音網站架站教學-clipbucket教學)

仍舊無法直接參考,必須要自己手動安裝
以下是花了不少時間turn出來的手冊

環境介紹:
OS:CentOS release 6.2 (Final) .. i686
Platform:VMware ESXi 5.0
FFMpeg版本:0.65 .. ( 試過了比0.65還新的版本,發現在ClipBucket平台中會有相容性的問題,因此最後選擇0.65的版本 )

 

利用RPMforge擴充安裝套件

for 32bit

rpm -Uhv http://repo.bstack.net/RPMforge/rpmforge-release-0.5.2-2.el6.rf.i686.rpm

for 64bit

rpm -Uhv http://repo.bstack.net/RPMforge/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

清除yum暫存資料

yum clean all

進行系統更新

yum update

安裝gcc、gcc-c++

yum install gcc gcc-c++ -y

安裝svn,版本控制

yum install subversion -y

安裝make,製作安裝檔案

yum install make -y

安裝git,分散式的版本控制系統,可藉由git將遠端source code全部下載至本機

yum install git -y

安裝check-devel

yum install check-devel -y

安裝核心開發工具包

yum groupinstall "Development Tools" -y

 

====ld.so.conf (紀錄讀入快取記憶體當中的動態函式庫所在的目錄,以增進動態函式庫的讀取速度)====

grep /usr/local/lib /etc/ld.so.conf
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig

 

====yasm彙編器====

可增加編碼速度,webm、x264安裝必要套件 http://yasm.tortall.net/

cd /usr/local/src/
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure
make && make install
ldconfig
cd ..

 

====MP4Box====

cd /usr/local/src/
wget http://www.repo.bstack.net/mp4box/gpac-0.4.5.tar.gz
wget http://www.repo.bstack.net/mp4box/gpac_extra_libs-0.4.5.tar.gz
tar -zxvf gpac-0.4.5.tar.gz
tar -zxvf gpac_extra_libs-0.4.5.tar.gz
cd gpac_extra_libs
cp -r * /usr/local/src/gpac/extra_lib
cd ..
cd gpac
chmod 755 configure
./configure
make lib
make apps
make install lib
make install
cp bin/gcc/libgpac.so /usr/lib
install -m644 bin/gcc/libgpac.so /usr/local/lib/libgpac.so
chmod +x /usr/local/lib/libgpac.so
ldconfig

 

====FLVtool2====

yum install ruby -y
cd /usr/local/src
wget http://www.repo.bstack.net/flvtool/flvtool2-1.0.6.tgz
tar zxvf flvtool2-1.0.6.tgz
cd /usr/local/src/flvtool2-1.0.6/
ruby setup.rb config && ruby setup.rb setup && ruby setup.rb install

 

====WebM====

wget http://webm.googlecode.com/files/libvpx-v1.0.0.tar.bz2
mv libvpx-v1.0.0.tar.bz2 /usr/local/src/
cd /usr/local/src/
tar -jxv -f libvpx-v1.0.0.tar.bz2
cd libvpx-v1.0.0
./configure && make && make install
ldconfig
cd ..

 

====OGG====

wget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
tar zxvf libogg-1.3.0.tar.gz
cd libogg-1.3.0
./configure && make clean && make && make install
ldconfig
cd ..

 

====Vorbis audio codec====

wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.gz
tar xzvf libvorbis-1.3.2.tar.gz
cd libvorbis-1.3.2
./configure && make clean && make && make install
ldconfig
cd ..

 

====x264====

利用git下載最新版之x264

git clone git://git.videolan.org/x264.git

因為udn有擋git port,所以在別的地方下載吧

wget http://cowman-chiang.no-ip.org/x264.tar (不確定檔案是否會一直存在)

cd x264
./configure --enable-shared && make clean && make && make install
ldconfig
cd ..

 

====xvidcore====

wget http://downloads.xvid.org/downloads/xvidcore-1.2.2.tar.gz
tar -zxf xvidcore-1.2.2.tar.gz
cd xvidcore/build/generic
./configure
make
make install
ldconfig
cd ../../../

 

====a52dec====

wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
tar -zxf a52dec-0.7.4.tar.gz
cd a52dec-0.7.4
./configure --enable-shared=PKGS
make
make install
ldconfig
cd ..

 

====Theora====

wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz
cd libtheora-1.1.1.tar.gz
tar -xvf libtheora-1.1.1.tar.gz
cd libtheora-1.1.1
./configure && make clean && make && make install
ldconfig
cd ..

 

====Faad2====

wget http://downloads.sourceforge.net/project/faac/faad2-src/faad2-2.7/faad2-2.7.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2
2-src%2Ffaad2-2.7%2F&ts=1336548742&use_mirror=nchc
tar -xvf faad2-2.7.tar.gz
cd faad2-2.7
autoreconf -vif
./configure && make clean && make && make install
ldconfig
cd ..

 

====Faac====

wget http://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2F
src%2Ffaac-1.28%2F&ts=1336548832&use_mirror=nchc
tar -xvf faac-1.28.tar.gz
cd faac-1.28

./configure && make clean && make && make install

In some servers the compilation may fail with the following error
中文:
In file included from mp4common.h:29,
from 3gp.cpp:28:
mpeg4ip.h:126: 錯誤:對 「char* strcasestr(const char*, const char*)」 的新宣告
英文:
In file included from mp4common.h:29, from 3gp.cpp:28:mpeg4ip.h:126: error: new declaration ‘char* strcasestr(const char*, const char*)’
原因:
That is because the C function strcasestr declared in the libfaac sources is already declared in a system-wide library. To solve it: Edit the file /usr/local/src/faac-1.28/common/mp4v2/mpeg4ip.h and delete the following line (around line 126)
char *strcasestr(const char *haystack, const char *needle);
接著再進行:
./configure && make clean && make && make install

ldconfig
cd ..

 

====Lame====

wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flame%2F
2F&ts=1336548924&use_mirror=nchc
tar -xvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure && make clean && make && make install
ldconfig
cd ..

 

====amrwbenc====

wget http://downloads.sourceforge.net/project/opencore-amr/vo-amrwbenc/vo-amrwbenc-0.1.2.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fpr
r%2Ffiles%2Fvo-amrwbenc%2F&ts=1336549028&use_mirror=nchc
tar -xvf vo-amrwbenc-0.1.2.tar.gz
cd vo-amrwbenc-0.1.2
./configure && make clean && make && make install
ldconfig
cd ..

 

====amr====

wget http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz?r=http%3A%2F%2Fsourceforge.net%2F
amr%2Ffiles%2Fopencore-amr%2F&ts=1336549087&use_mirror=nchc
tar -xvf opencore-amr-0.1.3.tar.gz
cd opencore-amr-0.1.3
./configure && make clean && make && make install
ldconfig
cd ..

 

====libraw1394====

wget http://downloads.sourceforge.net/project/libraw1394/libraw1394/libraw1394-2.0.5.tar.gz
tar -zxf libraw1394-2.0.5.tar.gz
cd libraw1394-2.0.5
./bootstrap
./configure
make
make install
ldconfig
cd ..

 

====libdc1394====

wget http://downloads.sourceforge.net/project/libdc1394/libdc1394-2/2.1.2/libdc1394-2.1.2.tar.gz
tar -zxf libdc1394-2.1.2.tar.gz
cd libdc1394-2.1.2
./configure
make
make install
ldconfig
cd ..

 

====FFMpeg====

安裝libgsm

yum imstall gsm-devel gsm-tools -y

安裝librtmp

yum imstall librtmp librtmp-devel -y

安裝schroedinger

yum install schroedinger schroedinger-devel -y

wget http://ffmpeg.org/releases/ffmpeg-0.6.5.tar.bz2
tar xvf ffmpeg-0.6.5.tar.bz2
cd ffmpeg-0.6.5

for 32bit

./configure --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables' --enable-avfilter --enable-libdc1394 --enable-libgsm --enable-librtmp --enable-libschroedinger --enable-postproc --enable-pthreads --enable-swscale --enable-vdpau --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-libmp3lame --enable-libx264 --enable-libfaac --enable-libvorbis --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-x11grab --enable-libvpx --enable-libtheora --extra-cflags=-fPIC --disable-ffplay --enable-libxvid

for 64bit

64位元需要配置PKG_CONFIG_PATH參數

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig CFLAGS="-fPIC -m64"

centos 64bit

./configure --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=atom -fasynchronous-unwind-tables' --enable-avfilter --enable-libdc1394 --enable-libgsm --enable-librtmp --enable-libschroedinger --enable-postproc --enable-pthreads --enable-swscale --enable-vdpau --enable-gpl --enable-version3 --enable-nonfree --enable-libmp3lame --enable-libx264 --enable-libfaac --enable-libvorbis --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-x11grab --enable-libvpx --enable-libtheora --enable-pic --disable-ffplay --enable-libxvid
make && make install
ldconfig
cd ..

This entry was posted in ClipBucket, Linux. Bookmark the permalink.