Difference between revisions of "XvMC"

From ArchWiki
Jump to: navigation, search
m (What do I need?)
(How do I add XvMC support to MPlayer?: - removed 'multimedia' for the /var/abs path)
Line 51: Line 51:
 
<br>
 
<br>
 
<br>
 
<br>
  abs; cd /var/abs/extra/multimedia/mplayer
+
  abs; cd /var/abs/extra/mplayer
 
<br>
 
<br>
Depending on your internet connection speed you may need to wait a while. When it finishes, it will point you to the '''/var/abs/extra/multimedia/mplayer''' directory. (The location of where '''PKGBUILD''' file is.)
+
Depending on your internet connection speed you may need to wait a while. When it finishes, it will point you to the '''/var/abs/extra/mplayer''' directory. (The location of where '''PKGBUILD''' file is.)
 
<br>
 
<br>
 
<br>
 
<br>

Revision as of 06:20, 17 October 2009

Introduction


In laymen's terms, XvMC allows the video card (Nvidia ones in this case), to handle processing of certain video features (CPU heavy ones). It takes the load off the CPU, thereby reducing processor requirements for video playback. It is often used in HDTV video playback scenarios.

This guide is to allow Nvidia video card owners to enable XvMC support for MPlayer. (as the default MPlayer build for Arch Linux does NOT support XvMC). It involves using the Arch Build System (or ABS) to recompile MPlayer.

This guide is aimed for the Arch Linux beginner. NOT for the Linux beginner.

Known Limitations


There are a few things you need to be aware of:

  • The current implementation of XvMC for Nvidia cards does NOT support anything other than MPEG1/2 videos. Do NOT bother trying other formats like Xvid, it will NOT work.
  • ffmpeg12mc is the only codec you can use with XvMC. Attempting to try any other codec will result in a FATAL error message.
  • You can NOT use XvMC simply by running a desktop link calling for gmplayer. You MUST use the command line.
  • The proprietary Nvidia driver is required for XvMC to work.
  • XvMC is buggy and you may encounter issues under some situations.


What do I need?


  • An Nvidia video card that is known to support XvMC. (ie: GF4MX, GF FX series, GF6xxx and GF7xxx series. Any other older cards will not work. Also note that the GF8xxx series cards no longer support XvMC)
  • Nvidia proprietary driver installed and working.


How do I add XvMC support to MPlayer?


Firstly, you need to open a terminal or command line window and log in with root permissions. So type:

su

...and enter your root password.

Next, you need to install the required dependencies. Type this:

pacman -S cvsup libxvmc unzip libcaca


cvsup is required for downloading the source and the ever important PKGBUILD file for ABS.
libxvmc is the required library for compiling XvMC support.
unzip is required during the build process. To uncompress required files called by PKGBUILD.
libcaca is a dependency that is required for compiling MPlayer.

The 2nd step is to sync your PC with Arch Linux's CVS. So type:

abs; cd /var/abs/extra/mplayer


Depending on your internet connection speed you may need to wait a while. When it finishes, it will point you to the /var/abs/extra/mplayer directory. (The location of where PKGBUILD file is.)

The 3rd step is to edit the PKGBUILD file to include XvMC support. PKGBUILD is basically a configuration file used by ABS to simplify with customization of source-based software in Arch Linux.

Using your favourite text editor (using vim in this case), edit PKGBUILD. So type:

vim PKGBUILD


Now, you will see a bunch of scary stuff. Scroll down a bit, and you'll see the following:

depends=('libxxf86dga' 'libxv' 'libmad' 'libungif' 'cdparanoia' 'gtk2'\
        'codecs' 'sdl' 'lame' 'libtheora' 'ttf-bitstream-vera' 'xvidcore'\
        'libgl' 'smbclient' 'aalib' 'dbus-glib' 'jack-audio-connection-kit')


Add 'libxvmc' (press Insert to enter stuff in vim), such that it looks like this:

depends=('libxxf86dga' 'libxv' 'libmad' 'libungif' 'cdparanoia' 'gtk2'\
        'codecs' 'sdl' 'lame' 'libtheora' 'ttf-bitstream-vera' 'xvidcore'\
        'libgl' 'smbclient' 'aalib' 'dbus-glib' 'jack-audio-connection-kit'\
        'libxvmc')


What you've done here, is add the XvMC library to the dependency list.

Now scroll down a bit further until you encounter this:

 ./configure --prefix=/usr --enable-gui --disable-arts --enable-x11 \
     --enable-runtime-cpudetection --enable-sdl \
     --enable-theora --confdir=/etc/mplayer \
     --enable-xvid --enable-gl --enable-tv-v4l1 --enable-tv-v4l2 --enable-largefiles \
     --disable-liblzo --disable-speex --disable-openal --disable-faac \
     --enable-smb --enable-aa --disable-fribidi --disable-libdv --disable-musepack \
     --language=all --enable-lirc --disable-dvdnav --disable-esd $EXTRAOPTS


Add --enable-xvmc (press Insert to enter stuff in vim), such that it looks like this:

 ./configure --prefix=/usr --enable-gui --disable-arts --enable-x11 \
     --enable-runtime-cpudetection --enable-sdl \
     --enable-theora --confdir=/etc/mplayer \
     --enable-xvid --enable-gl --enable-tv-v4l1 --enable-tv-v4l2 --enable-largefiles \
     --disable-liblzo --disable-speex --disable-openal --disable-faac \
     --enable-smb --enable-aa --disable-fribidi --disable-libdv --disable-musepack \
     --language=all --enable-lirc --disable-dvdnav --disable-esd --enable-xvmc $EXTRAOPTS


Now press ESC to exit vim's INSERT mode. What you've done here, is add XvMC support when you compile MPlayer.

Save and exit out of the text editor. In vim, type:

:wq


The forth step is to compile MPlayer and build it into a Arch Linux package. Its easier than it sounds! :-) Just type:

makepkg


This is where you go off and do something else while it compiles and builds for you. Depending on the speed of your CPU, it will take a few minutes.

Once done, you'll end up with something like this on the screen:

==> Removing info/doc files...
==> Compressing man pages...
==> Stripping debugging symbols from libraries...
==> Stripping symbols from binaries...
==> Generating .PKGINFO file...
==> Copying install script...
==> Generating .FILELIST file...
==> Compressing package...
==> Finished making: mplayer  (Sun Jan 14 03:47:49 UTC 2007)


The fifth step is to install it! Type this:

pacman -U mplayer-1.0rc1-4.pkg.tar.gz


If its successful, it will look something like this:

loading package data... done.
checking for file conflicts... done.
installing mplayer... done.
==> mplayer now has optional lirc support, install lirc if you want to use it


The sixth step is to create a text file that points to the correct XvMC file in the Nvidia driver package, so type this:

vim /etc/X11/XvMCConfig

(vim will create a new file for you if one doesn't exist).

In this file, (press Insert first before typing in vim), add this:

libXvMCNVIDIA_dynamic.so.1

(This file is actually part of the proprietary Nvidia driver package!)

Press ESC to leave vim's Insert mode. Save and exit vim text editor. Type:

:wq 


Exit out of root permissions. So type:

exit


The final step is to verify that MPlayer has XvMC support, so type:

mplayer -vo help


You will see a list of video output drivers. The one you want to see appearing in that list, is this:

xvmc    XVideo Motion Compensation


How do I use MPlayer with XvMC enabled?


You must use it via command line.

EXAMPLE: Typing this will load up the video file foobar.mpeg with XvMC enabled.

gmplayer -vo xvmc -vc ffmpeg12mc -fs foobar.mpeg


gmplayer => Loads up the GUI version of mplayer, whereas using mplayer does NOT. You can load either, depending on your needs.

-vo => video output. We tell MPlayer to use xmvc.

-vc => video codec. We tell MPlayer to use ffmpeg12mc.

-fs => Use fullscreen mode.

For more options, just type mplayer -vo help in a terminal or command window.

REMEMBER: This only works with MPEG1 and MPEG2 files!

To test MPlayer with XvMC, head over here and download a video:
http://www.leadcodecs.com/Download/MPEG-Videos.htm

References


XvMC (from MythTV wiki)
http://www.mythtv.org/wiki/index.php/XvMC

MPlayer 1.0rc1 + XvMC Nov 2006
http://www.murga-linux.com/puppy/viewtopic.php?t=13216

Using older machines for HDTV video playback
http://www.penlug.org/twiki/bin/view/Main/LinuxHardwareInfoNvidia5200