MPlayer is one of my favorite media players. It is used with a frontend like smplayer, gnome-mplayer and MPlayerGUI to provide a good alternative to Windows Media Player. Although there are already several Win32 builds of MPlayer on the net, I like to build MPlayer on my own using MinGW compiler because I want to optimize my build for my CPU. So I installed MinGW and compiled MPlayer as follows.
Build ffmpeg statically or dynamically as shown in this post.
- (Optional) Compile the lzo library:
./configure --prefix=/mingw && make && make install
(Optional) Fribidi is a rendering library for right-to-left scripts, such as Arabic and Hebrew. If you are a speaker of such right-to-left languages, compile fribidi statically as shown below:
./configure --prefix=/mingw --disable-shared --disable-debug make make install
More information can be found here.
- Download JPEG source from ijg.org and complie JPEG:
./configure --prefix=/mingw --enable-static make make install
- Compile libPNG:
./configure --prefix=/mingw --disable-shared make make install
- Compile libiconv, Freetype, expat and fontconfig statically in that order:
./configure --prefix=/mingw --disable-shared make install
- Compile libdca:
./configure --prefix=/mingw make make install
- (Optional) Download DirectX headers from any of the following locations and unpack them in /mingw/include:
- Download the latest mplayer source (mplayer-export-snapshot.tar.bz2) and unpack it. (patch 1 and patch 2)
tar xjvf mplayer-export-snapshot.tar.bz2 cd mplayer-export-2010-02-07/
CPPFLAGS='-DFRIBIDI_ENTRY="" ' ./configure --prefix=/mingw --enable-runtime-cpudetection --enable-static --enable-theora --enable-fribidi --disable-ffmpeg_a --disable-gl --disable-vidix --yasm=/mingw/bin/yasm --extra-libs='-lfribidi'
The CPPFLAGS value allows fribidi to be linked statically.
- Build Mplayer:
After successful build, strip the executables:
Optionally, compress the executables with upx:
upx --best --strip-relocs=0 mplayer.exe upx --best --strip-relocs=0 mencoder.exe
Download MPlayer codecs from here. The MPlayer codecs for Windows platform has a filename like windows-essential-20071007.zip. Extract the codecs package and you'll get a folder "windows-essential-20071007". Rename it as "codecs" and move the "codecs" folder inside where mplayer.exe file is located.
Make sure that HOME environment variable is set to your personal folder(for example, C:\Users\Jocelyn). Upon the first run of mplayer, a new folder named
mplayerwill be created in your HOME folder. Copy codecs.conf to the
mplayerfolder. The "config" file stores default options for playing movie files. Open the "config" file and make changes as follows:
# Write your default config options here! cdrom-device=D: dvd-device=D: ao=dsound vo=direct3d font=C:\WINDOWS\FONTS\MALGUN.TTF framedrop=yes subcp=cp949
My win32 build of mplayer can be downloaded from here. It is recommended that the zip archive should be extracted in
Now, let's try mplayer. First, get a movie file ready. In the Command Prompt, type a command in the following form:
mplayer -vo direct3d -ao win32 -font C:\WINDOWS\FONTS\Tahoma.ttf -framedrop mymoviefile.avi
A new window will pop up with the movie playing inside it.
The next step is to get and set up SMPlayer.