Linux Sysadmin Blog

Compile Mplayer/Mencoder With Xvid and H264 Codec Support

- | Comments

Default Mplayer installation autodetects Xvid, H264 and other codecs. So if you have Xvid and H264 codecs installed your mencoder and mplayer should support it, unless you disable them during compilation.  In order to have your Mencoder and Mplayer support Xvid and H264 you need to install them first and then compile/re-compile Mencoder/Mplayer.

Install Xvid.

Xvid is a free software MPEG-4 ASP compliant video codec.

  • download the latest release from Xvid.org, during this time of post the latest stable release is 1.2.1.
1
wget http://downloads.xvid.org/downloads/xvidcore-1.2.1.tar.gz
  • Unpack tarball file:
1
tar xzpf xvidcore-1.2.1.tar.gz
  • Go to build/generic folder:
1
cd xvidcore-1.2.1/build/generic/
  • Build and install
1
2
3
./configure
make  
make install

Note:  At this point you can recompile your Mplayer/Mencoder to have Xvid support - in case you don’t want to have H264 support.

Install H264.

H264/x264 is a library for creating H.264 video. MPlayer sources are updated whenever an x264 API change occurs, so it is always suggested to use MPlayer from Subversion.  At this time of post x264 in on development release only.

Using GIT - download 1.6.1.

  • Get the latest x264 source using git:
1
git clone git://git.videolan.org/x264.git
  • Build and install:
1
2
3
4
cd x264  
./configure  
make  
make install

If you don’t have GIT and don’t want to install it, you can use the daily snapshot. * Download the latest snapshot(tarball) here:

1
wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20090113-2245.tar.bz2
  • Extract tarball
1
2
bzip2 -cd x264-snapshot-20090113-2245.tar.bz2 | tar xvf -  
cd x264-snapshot-20090113-2245
  • Build and install
1
2
3
./configure  
make  
make install

Compile/Re-compile Mplayer:

You can use the latest release version of Mplayer for Xvid only but there are issues during build on x264, as it is not updated. It’s better to re-compile Mplayer from their SVN.

  • Checkout the latest version:
1
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
  • Build and install:
1
2
3
4
cd mplayer  
./configure  
make  
make install

NOTE: This install process was tested on Centos 5.2.

Comments