7. FFmpegのビルド・インストール


  • TortoiseSVNで最新ソースを取得する。C:\msys\srcをエクスプローラで開き、右クリックで「SVN Checkout...」をクリック。

ffmpeg001

  • 「URL of repository」に「svn://svn.ffmpeg.org/ffmpeg/trunk」を入力して、「OK」をクリック

ffmpeg002

  • ソース取得中。終わったら「OK」をクリックする

ffmpeg003

  • /mingw/include/sched.hを修正する

以下の記述を探す(この時点では、116行目にあった)

#if defined(__MINGW32__) || defined(_UWIN)
#if PTW32_LEVEL>= PTW32_LEVEL_MAX

これを以下のように修正する(間に1行追加する)

#if defined(__MINGW32__) || defined(_UWIN)
typedef int pid_t;
#if PTW32_LEVEL>= PTW32_LEVEL_MAX

  • C:\msys\src\ffmpeg\configureを修正する
# check for some common methods of building with pthread support
# do this before the optional library checks as some of them require pthreads
if enabled pthreads; then
    if check_func pthread_create; then
    :
    elif check_func pthread_create -pthread; then
        add_cflags -pthread
        add_extralibs -pthread
    elif check_func pthread_create -pthreads; then
        add_cflags -pthreads
        add_extralibs -pthreads
    elif check_func pthread_create -lpthreadGC2; then
        add_extralibs -lpthreadGC2
    elif check_func pthread_create -lpthreadGC2 -lwsock32; then
        add_extralibs -lpthreadGC2 -lwsock32
    elif ! check_lib pthread.h pthread_create -lpthread; then
        die "ERROR: can't find pthreads library"
    fi
fi

という記述を探し(この時点では、2006行目にあった)、最後のelifの直前に以下の記述を追加する。

elif check_func pthread_create -lpthreadGC2 -lwsock32; then
        add_extralibs -lpthreadGC2 -lwsock32

追加後は以下の通りとなる。

# check for some common methods of building with pthread support
# do this before the optional library checks as some of them require pthreads
if enabled pthreads; then
    if check_func pthread_create; then
    :
    elif check_func pthread_create -pthread; then
        add_cflags -pthread
        add_extralibs -pthread
    elif check_func pthread_create -pthreads; then
        add_cflags -pthreads
        add_extralibs -pthreads
    elif check_func pthread_create -lpthreadGC2; then
        add_extralibs -lpthreadGC2
    elif ! check_lib pthread.h pthread_create -lpthread; then
        die "ERROR: can't find pthreads library"
    fi
fi

さらに以下の記述(この時点では、2062行目にあった)を探す。

enabled libx264    && require  libx264 x264.h x264_encoder_open -lx264 -lm &&
{ check_cpp_condition x264.h "X264_BUILD >= 65" ||
die "ERROR: libx264 version must be >= 0.65."; }

これに「-lpthreadGC2 -lwsock32」を追加して以下の通りとする。

enabled libx264    && require  libx264 x264.h x264_encoder_open -lx264 -lpthreadGC2 -lwsock32 -lm &&
{ check_cpp_condition x264.h "X264_BUILD >= 65" ||
die "ERROR: libx264 version must be >= 0.65."; }

  • 以上の修正を保存する。
  • MSYSのシェルにて以下のコマンドを実行

cd /usr/src/ffmpeg
./configure \
--prefix=/mingw \
--enable-static \
--disable-shared \
--extra-version=i43z.com \
--enable-gpl \
--enable-pthreads \
--enable-libx264 \
--enable-libfaad \
--enable-libxvid \
--enable-libmp3lame \
--enable-libtheora \
--enable-libvorbis \
--enable-libnut \
--enable-libgsm \
--enable-avisynth \
--enable-postproc \
--enable-zlib \
--enable-avfilter \
--enable-avfilter-lavf \
--enable-memalign-hack \
--enable-runtime-cpudetect \
--target-os=mingw32 \
--cpu=i686 \
--arch=i686 \
--disable-debug \
--disable-ffserver \
--disable-ffplay \
--disable-network
make
make install

以上で、FFmpegのビルドは完了。ffmpeg.exeができあがっている。