それマグで!

知識はカップより、マグでゆっくり頂きます。 takuya_1stのブログ

習慣に早くから配慮した者は、 おそらく人生の実りも大きい。

ffmpeg をcygwinでコンパイルする。

Corei7マシンをwindowsに使っちゃったので、しかたなく、cygwin利用を継続している。最近はSetup.exeでCygwinを最新版にしたらなんかコンパイルが速いので、FFMpegコンパイルをしてみた。

入れたパッケージ

多分これくらいアレば大丈夫。(なんか余計なものもおおいけど)

apt-cyg install autoconf automake binutils gcc gcc-core gcc-g++ gcc-mingw gcc-mingw-core gcc-mingw-g++ gdb gettext gettext-devel git libgcrypt-devel libiconv libtool make mingw-runtime nasm patchutils pkg-config subversion ncurses expat libgcrypt curl wget zip unzip

コンパイルの流れ

  • ビルド用のGCCとか準備。
  • 必要なコーデックのライブラリを準備
  • ffmpegをインストール

yasmのインストール

#yasm
wget -O - http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz  |tar zxvf -
cd yasm-1.2.0
./configure --prefix=/usr
make && make install
cd

libx264のインストール

cd ~
git clone git://git.videolan.org/x264
cd x264
./configure --prefix=/usr --enable-shared
make && make install
cd ~

lameのインストール

wget -O - 'http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.4.tar.gz' | tar zxvf -
cd lame-3.99.4/
./configure   --prefix=/usr && make  &&make install

libfaacのインストール

wget -O - http://downloads.sourceforge.net/faac/faac-1.28.tar.gz | tar xzvf -
cd faac-1.28/
chmod +x ./bootstrap
./bootstrap && ./configure --prefix=/usr 
make && make install
cd ~

faacだけはgcc4でコンパイルしてる。

ffmpegをインストール

cd ~
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg 
./configure --prefix=/usr/local  --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac  --enable-libmp3lame  --enable-libx264 
make && make install 


できたーーーーーーーーー!!

cygwinビルドと、既存のmingwとの比較。

いまのffmpegは。windowsimagemagickについてきたものを使ってる。

takuya@host:~/ffmpeg$ which ffmpeg
/cygdrive/c/programfiles/ImageMagick-6.6.7-Q16/ffmpeg

オプション

takuya@host:~/ffmpeg$ ffmpeg.exe
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

FFmpeg version SVN-r23418, Copyright (c) 2000-2010 the FFmpeg developers
  built on Jun  2 2010 04:12:01 with gcc 4.4.2
  configuration: --target-os=mingw32 --enable-runtime-cpudetect --enable-avisynth --enable-gpl --enable-version3 --enable-bzlib --enable-libgsm --enable-libfaad --enable-pthreads --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libmp3lame --enable-libopenjpeg --enable-libxvid --enable-libschroedinger --enable-libx264 --extra-libs='-lx264 -lpthread' --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-librtmp --extra-libs='-lrtmp -lssl -lcrypto -lws2_32 -lgdi32 -lwinmm -lcrypt32 -lz' --arch=x86 --cross-prefix=i686-mingw32- --cc='ccache i686-mingw32-gcc' --enable-memalign-hack
  libavutil     50.16. 0 / 50.16. 0
  libavcodec    52.72. 1 / 52.72. 1
  libavformat   52.67. 0 / 52.67. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.20. 0 /  1.20. 0
  libswscale     0.11. 0 /  0.11. 0
Use -h to get full help or, even better, run 'man ffmpeg'

今回ビルドしたffmpeg

takuya@host:~/ffmpeg$ ./ffmpeg.exe
ffmpeg version git-2012-02-27-a4c22e3 Copyright (c) 2000-2012 the FFmpeg developers
  built on Feb 28 2012 04:01:16 with gcc 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
  configuration: --prefix=/usr/local --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libx264
  libavutil      51. 41.100 / 51. 41.100
  libavcodec     54.  4.100 / 54.  4.100
  libavformat    54.  1.100 / 54.  1.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 62.101 /  2. 62.101
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  7.100 /  0.  7.100
  libpostproc    52.  0.100 / 52.  0.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg’

若干コーデックが減ってるけど、まぁそりゃ入れてないので仕方ない。いままではビルドなんて無理だろう。と諦めてたけど、新しいCygwinとCorei7パワーで30分もかからない。便利〜。