HOWTO: Recompiling MPlayer / MEncoder on (K)Ubuntu Breezy
I've tried installing all the different versions of MPlayer / MEncoder in my Breezy but I feel disappointed by the fact that these versions aren't compiled to use latest processor extensions (despite their name...). So I've googled around and managed to rebuild the MPlayer / MEncoder packages as described below. Furthermore, I've added the H.254 support by installing the open source x.264 codec library from VLC.
1) Install development tools:
Code:
sudo apt-get install build-essentials
sudo apt-get install devscripts
sudo apt-get install subversion
sudo apt-get install nasm
Note that the subversion and nasm packages are needed to download and build x.264 sources from VLC repository. If you don't mind about it, you can skip subversion and nasm installation.
2) Install x.264 codec (optional)
Download latest SVN version from VLC repository:
Code:
svn co svn://svn.videolan.org/x264/trunk x264
Build and install the codec with the following commands:
Code:
cd x264
./configure
make
sudo make install
cd ..
3) Download MPlayer sources with all needed dependencies
MPlayer is in the multiverse section of Ubuntu repository, so please enable this section in the sources.list or directly in Synaptic. Then:
Code:
sudo apt-get source mplayer
sudo apt-get build-dep mplayer
4) Hacking debian/rules
This is a quick-and-dirty tip to enable missing processor extensions in the MPlayer/MEncoder build.
Code:
cd mplayer-1.0-pre7cvs20050716/debian/
vi rules
Find and remove all the '--disable-xxx' options where xxx is in (mmx|mmx2|sse|sse2|3dnow|3dnow2). Don't mind about what your processor actually support. By removing all the '--disable-xxx' directives you force the MPlayer build to be tailored to your CPU.
5) Building packages and install
Now you can rebuild .deb packages of MPlayer and MEncoder by:
Code:
cd ..
sudo debuild -us -uc
At the end of the build you will find all the .deb packages produced in the parent directory.
Code:
cd ..
sudo dpkg -i install mplayer-586*
sudo dpkg -i install mencoder-586*
Despite their name, as said before, mplayer and mencoder binaries now support all extensions of your CPU, as you can easily check by launching mplayer or mencoder without any parameter. On my Athlon 64 mencoder said:
Code:
MEncoder dev-CVS--4.0.2 (C) 2000-2005 MPlayer Team
CPU: Advanced Micro Devices (Family: 8, Stepping: 0)
Detected cache-line size is 64 bytes
CPUflags: Type: 8 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE SSE2
while on an Athlon XP:
Code:
MEncoder dev-CVS--4.0.2 (C) 2000-2005 MPlayer Team
CPU: Advanced Micro Devices Athlon MP/XP Thoroughbred (Family: 6, Stepping: 1)
Detected cache-line size is 64 bytes
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE
If you installed the x.264 codec before the mplayer building, you can check the codec presence in MEncoder by the following command:
It should display, among others, the following line:
Code:
x264 - H.264 encoding
That's all, folks....
I hope this can help anyone that is 'optimization-fanatic' as I am.
Bye.
Bookmarks