ffmpegのコンパイル



svnから最新版をダウンロードして、コンパイルする度に嵌るので、ブログでインストール方法を管理することにしました。

ffmpegの用途は、拡張子がmpg/mpeg/mp4/m4v/avi/mov/wmv/3gpである動画ファイルをflvフォーマットの動画に変換することです。

対象となる動作環境はCentOS 5です。

[gcc]
# yum install gcc

[mp3lame]
http://downloads.sourceforge.net/lame/
# tar zxvf lame-XXX.tar.gz
# cd lame-XXX
# ./configure
# make
# make install

[git]
# wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-X.noarch.rpm
# rpm -ivh epel-release-5-X.noarch.rpm
# yum install git

[opencore-amr]
# git clone git://opencore-amr.git.sourceforge.net/gitroot/opencore-amr
# cd opencore-amr
# make
# make install

[automake]
# yum install automake

[libtool]
# yum install libtool

[gcc-c++]
# yum install gcc-c++

[faac]
http://sourceforge.net/project/showfiles.php?group_id=704
# tar zxvf faac-X.X.tar.gz
# cd faac-X.X
# sh bootstrap
# ./configure
# make
# make install

[faad2]
http://sourceforge.net/project/showfiles.php?group_id=704
# tar zxvf faad2-X.X.tar.gz
# cd faad2-X.X/
# sh bootstrap
# ./configure
# make
# make install

[nasm]
# yum -y install nasm

[yasm]
http://www.tortall.net/projects/yasm/releases/
# tar zxvf yasm-X.X.X.tar.gz
# cd yasm-X.X.X
# ./configure
# make
# make install

[x264]
http://downloads.videolan.org/pub/videolan/x264/snapshots/
# tar jxvf x264-snapshot-YYYYMMDD-VVVV.tar.bz2
# cd x264-snapshot-YYYYMMDD-VVVV
# ./configure –enable-shared
# make
# make install

[xvid]
http://www.xvid.org/downloads.html
# tar xvzf xvidcore-X.X.X.tar.gz
# cd xvidcore-X.X.X/build/generic
# ./configure
# make
# make install

[a52]
http://liba52.sourceforge.net/downloads.html
# tar zxvf a52dec-X.X.X.tar.gz
# cd a52dec-X.X.X
# sh bootstrap
# ./configure
# make
# make install

[ogg]
# yum install libogg-devel

[vorbis]
# yum install libvorbis-devel

[subversion]
# yum install subversion

[ffmpeg]
# svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
# cd ffmpeg/libavcodec
# patch -p1 < ffmpeg.patch
# cd ../
# ./configure –enable-gpl –enable-libmp3lame –enable-libxvid –disable-ffplay –disable-ffserver –enable-libfaac –enable-libfaad –enable-libx264 –enable-shared –enable-nonfree –enable-libvorbis –enable-pthreads –enable-libopencore-amrnb –enable-libopencore-amrwb –enable-version3 –disable-demuxer=v4l –disable-demuxer=v4l2 –disable-indev=v4l
# make
# make install

最後に変換テストです。

$ setenv LD_LIBRARY_PATH /usr/local/lib
$ ffmpeg -y -i test.avi -f flv -vcodec flv -acodec libmp3lame -r 25 -b 1000k -ab 64k -ar 44100 -s qvga test.flv

Leave a Reply