============================== MPlayer-MingW-Howto Overview ============================== This how-to help will guide Windows users to setup and build MPlayer from source. The steps includes setting up the MinGW toolchain, obtaining the necessary tools, downloading and installing required libraries from source and finally building MPlayer. The version numbers provided is as of writing. This guide also assumes users are already comfortable with using the command line interface for MSYS and the Command Prompt. TODO: 0. Is msysDTK still needed? 1. FAQs 2. Useful Links 3. Binary Codecs 4. dvdnav + libdvdread + libdvdcss 5. libcdio ============================== Table of Contents ============================== 1.0 Setting up MinGW 1.1 Getting MinGW and MSYS 1.2 Installing the toolchain 1.3 Updating the toolchain 2.0 Getting the required tools 2.1 Subversion (Version Control) 2.1 NASM (Assembler) 3.0 Libraries for MPlayer 3.1 Notes on Installing 3.2 Installing libogg 3.3 Installing libvorbis 3.4 Installing libtheora 3.5 Installing LAME 3.6 Installing xvidcore 3.7 Installing pthread-w32 3.8 Installing x264 3.9 Installing zlib 3.10 Installing libpng 3.11 Installing libungif 3.12 Installing libjpeg 3.12 Installing Live555 4.0 Building MPlayer 5.0 FAQs 6.0 Revision History 7.0 Useful Links ============================== 1.0 Setting up MinGW ============================== MinGW includes the GCC compiler, the various header files and libraries to build and compile applications. It is often used as a replacement for non-Free Microsoft tools. Along with MSYS, which provides bash and a host of other Unix utilities, will allow the use of the GNU toolchain on Windows. ------------------------------ 1.1 Getting MinGW and MSYS ------------------------------ * Automated MinGW Installer (138,705 bytes) http://downloads.sourceforge.net/mingw/MinGW-5.1.3.exe * MSYS: Minimal System (2,808,061 bytes) http://downloads.sourceforge.net/mingw/MSYS-1.0.10.exe * MSYS Development Tool Kit (10,299,560 bytes) http://downloads.sourceforge.net/mingw/msysDTK-1.0.1.exe ------------------------------ 1.2 Installing the toolchain ------------------------------ Install MinGW by using Automated MinGW Installer. * Select "Download and Install" * Choose "Current" or "Candidate". The Candidate release is newer. * At least "MinGW base tools" and "g++" must be installed. * Install it to "C:\MinGW" The installed MinGW includes: * GCC 3.4.2 (for current) or GCC 3.4.5(for Candidate) * w32api 3.10 * mingw-runtime 3.13 Now Install MSYS to "C:\msys\1.0". After the install, the MSYS installer will ask about the MinGW install. "Do you wish to continue with the post install? [yn ]" "Do you have MinGW installed? [yn ]" Answer "y" to both and give the path to where MinGW is installed for the next question. (Use c:/mingw if unchanged.) ------------------------------ 1.3 Updating the toolchain ------------------------------ Several tools will need to be updated for proper operations. While unpacking, it is important to preserve directory hierachy. * Bash 3.1 (551,123 bytes) to fix broken shell warnings. http://downloads.sourceforge.net/mingw/bash-3.1-MSYS-1.0.11-snapshot.tar.bz2 Unpack it to C:\msys\1.0 * binutils-2.17.50-20060824 snapshot (9,320,326 bytes) for proper MPlayer CPU-detection. http://downloads.sourceforge.net/mingw/binutils-2.17.50-20060824-1.tar.gz Unpack it to C:\MinGW ============================== 2.0 Getting the required tools ============================== These are the tools required to obtain and build MPlayer and its dependent libraries. ------------------------------ 2.1 Subversion (Version Control) ------------------------------ Subversion or usually known as SVN is allows MPlayer users to obtain the latest source and test it for themselves. It is also required to download the x264 library. SVN can be obtained from http://subversion.tigris.org/project_packages.html The precompiled binaries are sorted by platform. Download the Windows version and unpack them to place them in your %PATH% (eg C:\WINDOWS). If you prefer working with GUI tools, there is a GUI version called "TortoiseSVN" from http://tortoisesvn.net/downloads ------------------------------ 2.1 NASM (Assembler) ------------------------------ NASM, also known as the Netwide Assembler is a Free Intel x86 assembler. While not strictly required, it will be used to assemble some files for xvidcore later. Get the Win32 binaries from http://sourceforge.net/project/showfiles.php?group_id=6208 The stable version is 0.98.XX. Unpack them to C:\MinGW\bin ============================== 3.0 Libraries for MPlayer ============================== These Libraries are optional and are in no way essential but is recommended for MPlayer. This means MPlayer will still work without the following libraries but will lack certain functions provided by these libraries. ------------------------------ 3.1 Notes on Installing ------------------------------ After downloading the library source tarballs, unpack them with "tar jxvf foo.tar.bz2" or "tar zxfv foo.tar.gz". Libraries stated here is installed with: "./configure --prefix=/mingw && make && make install" unless stated otherwise. ON INSTALL PREFIX Most libraries will install fine with the standard "./configure && make && make install", but for proper MinGW installs, it is recommended that "--prefix=/mingw" be added when invoking configure so the installed library and headers will not conflict with MSYS versions. The resulting command to configure would look like "./configure --prefix=/mingw". ON SHARED LIBRARIES Many libraries have the option of building shared and static versions. For Windows users, shared libraries will mean dealing with .dll files. Programs linked to shared library will make use of the dll, while programs linked to the static version do not. The pros of using shared libraries will be that the resulting program will be smaller in size and more memory efficient, however this would also mean dealing with dll image base and problematic relocations. Novice users may want to avoid the use of shared libraries. To build shared library add "--enable-shared" while invoking configure. Some libraries require "-no-undefined" to be passed as LDFLAGS if they use an old version of libtool for the build system. To produce static libraries only, use "--disable-shared" instead. Most libraries can be built with "--enable-static --enable-shared", priority will be given to shared libraries. An example would be "./configure --enable-shared --enable-static --prefix=/mingw CFLAGS='-g -pipe'" ------------------------------ 3.2 Installing libogg ------------------------------ Requirements: None Used by: libvorbis, libtheora Download: http://downloads.xiph.org/releases/ Tarball: libogg-1.1.3.tar.gz Size: 403,467 bytes Release Date: 28-Nov-2005 Installed library: Shared and Static by default License: BSD Notes: This package is only needed if theora functionality is required. MPlayer can decode ogg vorbis audio with the built-in libtremor. sys/types.h and stdint.h may need to be included in ogg/ogg.h if libtheora is to compile properly. ------------------------------ 3.3 Installing libvorbis ------------------------------ Requirements: libogg Used by: libtheora Download: http://downloads.xiph.org/releases/ Tarball: libvorbis-1.2.0.tar.gz Size: 1,494,373 bytes Release Date: 25-Jul-2007 Installed library: Shared and Static by default License: BSD Notes: This package is only needed if theora functionality is required. MPlayer can decode ogg vorbis audio with the built-in libtremor. ------------------------------ 3.4 Installing libtheora ------------------------------ Requirements: libogg, libvorbis Used by: None Download: http://downloads.xiph.org/releases/ Tarball: libtheora-1.0beta2.tar.bz2 Size: 1,774,632 bytes Release Date: 18-Sep-2007 Installed library: Shared and Static by default License: BSD Notes: Errors may occur when compiling png2theora.c under MinGW, it is safe to ignore, "use make -i" to ignore. ------------------------------ 3.5 Installing LAME ------------------------------ Requirements: None Used by: None Download: http://sourceforge.net/project/showfiles.php?group_id=290 Tarball: lame-3.97.tar.gz Size: 1,328,058 bytes Release Date: 24-Sep-2004 Installed library: Static by default License: LGPL Notes: May require NASM for some assembly optimization. lame did not install lame.h, create a folder called lame in the mingw include folder and place lame.h there. GUI feature requires GTK 1.2 Histogram feature requires libcurses and termcap. ------------------------------ 3.6 Installing xvidcore ------------------------------ Requirements: None Used by: None Download: http://www.xvid.org/downloads.html http://www.xvid.org/Downloads.43.0.html Tarball: xvidcore-1.1.3.tar.gz Size: 739,591 bytes Release Date: 28-June-2007 Installed library: Static by default License: GPL 2 Notes: May require NASM for some assembly optimization. Install instructions (after unpacking and entering top level directory): cd build/generic ./configure --prefix=/mingw make make install mv /mingw/lib/xvidcore.a /mingw/lib/libxvidcore.a ------------------------------ 3.7 Installing pthreads ------------------------------ Requirements: None Used by: x264 Download: ftp://sourceware.org/pub/pthreads-win32/ Rarball: pthreads-w32-2-8-0-release.tar.gz Size: 331,327 bytes Release Date: 22-Dec-2006 Installed library: License: LGPL Install Instructions: Build with "make clean GC". Install by copying sched.h, pthread.h and semaphore.h to mingw include folder libpthreadGC.a copied to mingw lib folder as libpthread.a so x264 can find them later. Copy pthreadGC2.dll to mingw bin folder. ------------------------------ 3.8 Installing x264 ------------------------------ Requirements: libpthread Used by: None Download: svn://svn.videolan.org/x264/trunk x264 ftp://ftp.videolan.org/pub/videolan/x264/snapshots/ Tarball: size: Release Date: Installed library: Static by default License: GPL Notes: Check out sources with "svn co svn://svn.videolan.org/x264/trunk x264" This will create a folder called x264. Install instructions: ./configure --prefix=/mingw --enable-avis-input --enable-pthread make make install ------------------------------ 3.9 Installing zlib ------------------------------ Requirements: None Used by: libpng Download: http://www.zlib.net/ Tarball: zlib-1.2.3.tar.bz2 Size: 425,209 bytes Release Date: 18-Jul-2005 Installed library: Static License: zlib ------------------------------ 3.10 Installing libpng ------------------------------ Requirements: None Used by: None Download: http://sourceforge.net/project/showfiles.php?group_id=5624 Tarball: libpng-1.2.22.tar.bz2 Size: 614,414 bytes Release Date: 13-Oct-2007 Installed library: Static and shared by default License: zlib/libpng ------------------------------ 3.11 Installing libungif ------------------------------ Requirements: None Used by: None Download: http://sourceforge.net/project/showfiles.php?group_id=102202 Tarball: libungif-4.1.4.tar.bz2 Size: 482,222 bytes Release Date: 13-Oct-2007 Installed library: Static and shared by default License: MIT ------------------------------ 3.12 Installing libjpeg ------------------------------ Requirements: None Used by: None Download: http://www.ijg.org/files/ Tarball: jpegsrc.v6b.tar.gz Size: 613,261 bytes Release Date: 28-Jun-2001 Installed library: Static and shared License: Freely Distributable Notes: Shared build unavailable due to bug in libtool created by configure, unless hacked to do so. ------------------------------ 3.12 Installing live555 ------------------------------ Requirements: None Used by: None Download: http://www.live555.com/liveMedia/public/ Tarball: live.2007.08.03a.tar.gz Size: 449,193 bytes Release Date: 3-Aug-2007 Installed library: License: LGPL Notes: This is for rtsp streaming support. This package does NOT need installing. Install instrctions: genMakefiles mingw make ============================== 4.0 Building MPlayer ============================== The MPlayer can be downloaded from: http://www.mplayerhq.hu/design7/dload.html or svn://svn.mplayerhq.hu/mplayer/trunk Once downloaded and unpacked, invoke ./configure with --help to see a list of options. Interesting ones include: --enable-gui enable GMPlayer compilation (GTK+ GUI) --enable-color-console Colors only work within MSYS bash, not command prompt. Notes * Use "--disable-tremor-internal --disable-tremor-external" if you want to use the previously compiled libogg and libvorbis for ogg vorbis audio decoding. * Use "--enable-runtime-cpudetection" for automatic detection CPU optimization capabilities. * Use "--with-livelibdir=" to allow configure to detect live555 correctly. After configuring, check configure.log for any potential problems. If no, run make. After sometime, mplayer.exe and mencoder.exe will be produced. ============================== 5.0 FAQs ============================== ============================== 6.0 Revision History ============================== 02.01.2005 Sascha Sommer - initial revision 13.02.2005 Stefan Gürtler - Enhanced step 6 to include building/installing x264 Sascha Sommer - ogg/vorbis step can be skipped, --enable-runtime-cpudetection is only needed when using the executable on different systems other small fixes pointed out by Reimar Döffinger and Wen-King Su 14.08.2005 Stefan Gürtler - Update compiling of x264, live, libogg, libvorbis and libregif, download of libavutil, use MSYS Development Kit for cvs checkout, libtheora 16.10.2007 - Major rewrite, based on Stefan Gürtler's. ============================== 7.0 Useful Links ==============================