Monday, June 8, 2009

Compiling Mencoder for Windows

Mencoder is a command-line tool for creating multimedia files. It allows you to convert video from one format to another. When used together with OGMRip, mencoder helps you to rip DVD into a video file that's convenient to watch on computers. Note that the instruction herein explains how to compile Mencoder for the Windows platform, not Linux.



MinGW must be installed first (Look here for how). Once you have MinGW, launch MSYS (rxvt) from the Start menu and type the following commands.




  1. PNG and JPEG


    PNG depends on zlib compression library. Download the zlib source from zlib.net and compile as follows:

    tar xzvf zlib-1.2.3.tar.gz
    cd zlib-1.2.3
    ./configure --prefix=/mingw
    make
    make install

    Now get the PNG library here and compile it as follows:

    tar xzvf libpng-1.2.34.tar.gz
    cd libpng-1.2.34/
    ./configure --prefix=/mingw --disable-shared
    make
    make install

    Download the source for JPEG library, compile and install JPEG as follows:

    tar xzvf jpegsrc.v7.tar.gz
    cd jpeg-7
    ./configure --prefix=/mingw
    make
    make install


  2. libdca Library


    Download the libdca source from videolan.org and compile it like this:


    tar xjvf libdca-0.0.5.tar.bz2
    cd libdca-0.0.5
    ./configure --prefix=/mingw
    make
    make install


  3. OGG, Vorbis and Theora


    The source for these libraries can be obtained from xiph.org. Compile them like this:

    ./configure --prefix=/mingw --disable-shared
    make
    make install


  4. Libcdio Library


    Download the libcdio source from here. Compile and install libcdio as follows:

    tar xzvf libcdio-0.81.tar.gz
    cd libcdio-0.81
    ./configure --prefix=/mingw --disable-shared
    make
    make install


  5. Live555 library


    The Live555 library is used to decode streaming media. Get the live555 source from here and compile it as follows:

    cd /mingw/lib
    tar xzvf live.2009.07.28.tar.gz
    cd live
    ./genMakefiles mingw
    make


  6. LAME


    LAME is an MP3 encoder. This library allows Mencoder to encode DVD sound into MP3 audio. Download LAME from lame.sf.net and compile it as follows.


    ./configure --prefix=/mingw --enable-expopt=full

    make

    make install


  7. TwoLame


    TwoLAME is an MP2 audio encoder. Get the source from twolame.org and compile it:

    ./configure --prefix=/mingw CPPFLAGS='-DLIBTWOLAME_STATIC'
    make
    make install


  8. XviD


    In case you didn't know, XviD is the most popular video encoder used in creating movie files found on the P2P networks. With this library, mencoder can rip a DVD into XviD video. Get the XviD source from xvid.org and compile as follows:


    tar xzvf xvidcore-1.2.2.tar.gz

    cd xvidcore/build/generic

    ./configure --prefix=/mingw

    make

    make install

    In addition, change to the /mingw/bin directory and copy xvidcore.a to libxvidcore.a.


    cd /mingw/lib

    cp xvidcore.a libxvidcore.a


  9. FAAC


    FAAC is an MPEG-4 AAC audio encoder. Get the source (faac-1.28.tar.gz) and unpack the package. Then, edit Makefile.am:

    SUBDIRS = include libfaac

    Also, edit the line beginning with AC_OUTPUT in the file configure.in:

    AC_OUTPUT(libfaac/Makefile include/Makefile Makefile)

    Then, compile FAAC like this

    sh bootstrap
    ./configure --prefix=/mingw --enable-static --disable-shared
    make
    make install


  10. x264


    x264 is yet another good video encoder. x264 requires YASM to build an optimized executable. So get yasm and save it as /mingw/bin/yasm.exe. Then, compile x264 like this:


    sh configure --prefix=/mingw --extra-cflags="-DX264_VERSION=20090608"

    make

    make install


  11. Compiling Mencoder


    Now you're ready to compile mencoder. Download the MPlayer source snapshot from mplayerhq.hu and unpack it. Then, type the following commands into the MSYS window to produce the executable mencoder.exe.


    CPPFLAGS='-DHAVE_INT32_T -DLIBTWOLAME_STATIC'./configure --prefix=/mingw --enable-runtime-cpudetection --enable-static --enable-theora --yasm=/mingw/bin/yasm

    make mencoder

    strip *.exe

    mv -iv mencoder.exe /c/Windows

    This produces a static executable mencoder.exe and copies it into the C:\WINDOWS folder.




If you'd like to try my mencoder build, download it from here. Its filename is MPlayer-svn-r30521-snapshot-3.4.5.zip.

2 comments:

  1. Hmmh, this used to work great in my previous Win2000 machine, but the current (November 2011) build using Win2003 and multicore CPU does not work. The old version of mencoder (snapshot mplayer-export-2010-04-02) does not generate mencoder.exe and does not show any error... the make just exits withoug generating any exe files. A new snapshot of mplayer doesn't compile (it stops when it does not find git to get new ffmpeg snapshot or something)

    ReplyDelete
  2. Success! Version 1.0rc4 (MPlayer-1.0rc4.tar.gz 23-Jan-2011 15:24 12M from mplayerhq.hu) compiles successfully with these instructions on my new Win2003 machine! I used MinGW-5.1.6.exe to install MinGW.

    ReplyDelete

About This Blog

KBlog logo This blog seeks to provide a collection of interesting pictures found on the Web. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

Powered By Blogger