Difference between revisions of "XvMC"

From ArchWiki
Jump to: navigation, search
(How do I add XvMC support to MPlayer?: - removed 'multimedia' for the /var/abs path)
m
Line 1: Line 1:
 +
''This guide allows [[NVIDIA]] video card users to enable XvMC support for [[MPlayer]] (as the default MPlayer build for Arch Linux does not support XvMC). It involves using ABS to recompile MPlayer.'' ''Required readings: [[ABS]], [[makepkg]].''
 +
[[Category:Graphics (English)]]
 
[[Category:X Server (English)]]
 
[[Category:X Server (English)]]
 
[[Category:HOWTOs (English)]]
 
[[Category:HOWTOs (English)]]
 
== Introduction ==
 
== Introduction ==
<br>
+
In layman's terms, XvMC allows the video card to handle processing of certain video features. Particularly, features that have the tendency of heavily depending on the CPU. XvMC acceleration takes the load off the CPU, thereby reducing processor requirements for video playback. It is often used in HDTV video playback scenarios.
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.
+
 
<br>
+
<br>
+
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.
+
<br>
+
<br>
+
This guide is aimed for the Arch Linux beginner. '''NOT''' for the Linux beginner.
+
<br>
+
<br>
+
 
== Known Limitations ==
 
== Known Limitations ==
<br>
+
There are a few considerations to keep in mind:
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.  
<br>
+
* ''ffmpeg12mc'' is the only codec you can use with XvMC. Attempting to try any other codec will result in a fatal error message.
<br>
+
* Calling Mplayer/GMplayer from the commandline is required.
* 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.
+
* XvMC is buggy and prone to cause issues under various circumstances.
* '''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.
+
<br>
+
== What do I need? ==
+
<br>
+
* 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.
+
<br>
+
  
== How do I add XvMC support to MPlayer? ==
+
==Requirements==
<br>
+
* An NVIDIA video card that is known to support XvMC. (ie: GeForce 4MX, GeForce FX series, GeForce 6xxx and GeForce 7xxx series. Any other older cards will not work. Also note that GeForce 8xxx and later no longer support XvMC)
Firstly, you need to open a terminal or command line window and log in with root permissions. So type:
+
* Installing the [[NVIDIA|proprietary NVIDIA driver]] is required for XvMC to work.
<br>
+
 
<br>
+
==How to add XvMC support to MPlayer?==
su
+
1. Install the required dependencies as root:
...and enter your root password.
+
  # pacman -S cvsup libxvmc unzip libcaca --asdep
<br>
+
'''cvsup''' is required for downloading the source and the ever important {{Codeline|PKGBUILD}} file for ABS.<br>
<br>
+
Next, you need to install the required dependencies. Type this:
+
<br>
+
<br>
+
  pacman -S cvsup libxvmc unzip libcaca
+
<br>
+
'''cvsup''' is required for downloading the source and the ever important '''PKGBUILD''' file for ABS.<br>
+
 
'''libxvmc''' is the required library for compiling XvMC support.<br>
 
'''libxvmc''' is the required library for compiling XvMC support.<br>
'''unzip''' is required during the build process. To uncompress required files called by '''PKGBUILD'''.<br>
+
'''unzip''' is required during the build process. To uncompress required files called by PKGBUILD.<br>
 
'''libcaca''' is a dependency that is required for compiling MPlayer.<br>
 
'''libcaca''' is a dependency that is required for compiling MPlayer.<br>
<br>
+
2. Sync the ABS tree:
The 2nd step is to sync your PC with Arch Linux's CVS. So type:
+
  # abs
<br>
+
3. Copy {{Codeline|/var/abs/extra/mplayer}} to a temporary working path.
<br>
+
$ cp /var/abs/extra/mplayer ~/devel/abs/mplayer
  abs; cd /var/abs/extra/mplayer
+
4. Edit the PKGBUILD:
<br>
+
$ cd ~/devel/abs/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.)
+
  $ nano PKGBUILD
<br>
+
::4.1 Add the XvMC library to the dependency list:
<br>
+
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.<br>
+
<br>
+
Using your favourite text editor (using vim in this case), edit '''PKGBUILD'''. So type:
+
<br>
+
<br>
+
  vim PKGBUILD
+
 
+
<br>
+
Now, you will see a bunch of scary stuff. Scroll down a bit, and you'll see the following:
+
<br>
+
<br>
+
depends=('libxxf86dga' 'libxv' 'libmad' 'libungif' 'cdparanoia' 'gtk2'\
+
        'codecs' 'sdl' 'lame' 'libtheora' 'ttf-bitstream-vera' 'xvidcore'\
+
        'libgl' 'smbclient' 'aalib' 'dbus-glib' 'jack-audio-connection-kit')
+
<br>
+
Add ''' 'libxvmc' ''' (press '''Insert''' to enter stuff in vim), such that it looks like this:
+
<br>
+
<br>
+
 
  depends=('libxxf86dga' 'libxv' 'libmad' 'libungif' 'cdparanoia' 'gtk2'\
 
  depends=('libxxf86dga' 'libxv' 'libmad' 'libungif' 'cdparanoia' 'gtk2'\
 
         'codecs' 'sdl' 'lame' 'libtheora' 'ttf-bitstream-vera' 'xvidcore'\
 
         'codecs' 'sdl' 'lame' 'libtheora' 'ttf-bitstream-vera' 'xvidcore'\
 
         'libgl' 'smbclient' 'aalib' 'dbus-glib' 'jack-audio-connection-kit'\
 
         'libgl' 'smbclient' 'aalib' 'dbus-glib' 'jack-audio-connection-kit'\
         ''''libxvmc'''')
+
         '''libxvmc''')
<br>
+
::4.2 Add the XvMC configure flag:
What you've done here, is add the XvMC library to the dependency list.
+
./configure --prefix=/usr --enable-gui --disable-arts --enable-x11 \
<br>
+
    --enable-runtime-cpudetection --enable-sdl \
<br>
+
    --enable-theora --confdir=/etc/mplayer \
Now scroll down a bit further until you encounter this:
+
    --enable-xvid --enable-gl --enable-tv-v4l1 --enable-tv-v4l2 --enable-largefiles \
<br>
+
    --disable-liblzo --disable-speex --disable-openal --disable-faac \
<br>
+
    --enable-smb --enable-aa --disable-fribidi --disable-libdv --disable-musepack \
  ./configure --prefix=/usr --enable-gui --disable-arts --enable-x11 \
+
    --language=all --enable-lirc --disable-dvdnav --disable-esd '''--enable-xvmc'''
      --enable-runtime-cpudetection --enable-sdl \
+
{{Note|The relevant parts are bolded. Do not replace the rest of the dependecies, or flags, for the ones listed here; they are examples.}}
      --enable-theora --confdir=/etc/mplayer \
+
5. Compile the package:
      --enable-xvid --enable-gl --enable-tv-v4l1 --enable-tv-v4l2 --enable-largefiles \
+
  $ makepkg
      --disable-liblzo --disable-speex --disable-openal --disable-faac \
+
6. Install:
      --enable-smb --enable-aa --disable-fribidi --disable-libdv --disable-musepack \
+
  $ pacman -U mplayer-1.0rc1-4.pkg.tar.gz
      --language=all --enable-lirc --disable-dvdnav --disable-esd $EXTRAOPTS
+
7. Finally, edit {{Filename|/etc/X11/XvMCConfig}} (create if it does not exists), and add:
<br>
+
Add '''--enable-xvmc''' (press '''Insert''' to enter stuff in vim), such that it looks like this:
+
<br>
+
<br>
+
  ./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
+
<br>
+
Now press '''ESC''' to exit vim's '''INSERT''' mode. What you've done here, is add XvMC support when you compile MPlayer.
+
<br>
+
<br>
+
Save and exit out of the text editor. In vim, type:
+
<br>
+
<br>
+
:wq
+
<br>
+
The forth step is to compile MPlayer and build it into a Arch Linux package. Its easier than it sounds! :-) Just type:
+
<br>
+
<br>
+
makepkg
+
<br>
+
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.
+
<br>
+
<br>
+
Once done, you'll end up with something like this on the screen:
+
<br>
+
<br>
+
  ==> 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)
+
<br>
+
The fifth step is to install it! Type this:
+
<br>
+
<br>
+
  pacman -U mplayer-1.0rc1-4.pkg.tar.gz
+
<br>
+
If its successful, it will look something like this:
+
<br>
+
<br>
+
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
+
<br>
+
The sixth step is to create a text file that points to the correct XvMC file in the Nvidia driver package, so type this:
+
<br>
+
<br>
+
vim /etc/X11/XvMCConfig
+
(vim will create a new file for you if one doesn't exist).
+
<br>
+
<br>
+
In this file, (press '''Insert''' first before typing in vim), add this:
+
<br>
+
<br>
+
 
  libXvMCNVIDIA_dynamic.so.1
 
  libXvMCNVIDIA_dynamic.so.1
(This file is actually part of the proprietary Nvidia driver package!)
+
{{Note|lbXvMCNVIDIA_dynamic.so.1 is part of the nvidia driver package. Backup before any modifications}}
<br>
+
Check the list of available mplayer video drivers:
<br>
+
Press '''ESC''' to leave vim's '''Insert''' mode. Save and exit vim text editor. Type:
+
<br>
+
<br>
+
:wq
+
<br>
+
Exit out of root permissions. So type:
+
<br>
+
<br>
+
exit
+
<br>
+
The final step is to verify that MPlayer has XvMC support, so type:
+
<br>
+
<br>
+
 
  mplayer -vo help
 
  mplayer -vo help
<br>
+
The following entry should appear among the list:
You will see a list of video output drivers. The one you want to see appearing in that list, is this:
+
<br>
+
<br>
+
 
  xvmc    XVideo Motion Compensation
 
  xvmc    XVideo Motion Compensation
<br>
 
  
 
== How do I use MPlayer with XvMC enabled? ==
 
== How do I use MPlayer with XvMC enabled? ==
<br>
+
It must be started from the command line:
You must use it via command line.
+
<br>
+
<br>
+
'''EXAMPLE:''' Typing this will load up the video file '''foobar.mpeg''' with XvMC enabled.
+
<br>
+
<br>
+
 
  gmplayer -vo xvmc -vc ffmpeg12mc -fs foobar.mpeg
 
  gmplayer -vo xvmc -vc ffmpeg12mc -fs foobar.mpeg
<br>
+
'''gmplayer''' - Loads up the GUI version of mplayer, whereas using '''mplayer''' does not.
'''gmplayer''' => Loads up the GUI version of mplayer, whereas using '''mplayer''' does NOT. You can load either, depending on your needs.
+
'''-vo''' - Video driver: This is the only way of specifying '''xmvc'''.
 +
'''-vc''' - Video codec: The only compatible codec with XvMC is '''ffmpeg12mc'''.
 +
'''-fs''' - Optional: tells GMplayer to start in fullscreen mode.
 +
For more options, type {{Codeline|mplayer -help}}.
  
'''-vo''' => video output. We tell MPlayer to use '''xmvc'''.
 
 
'''-vc''' => video codec. We tell MPlayer to use '''ffmpeg12mc'''.
 
 
'''-fs => Use fullscreen mode.
 
<br>
 
<br>
 
For more options, just type '''mplayer -vo help''' in a terminal or command window.
 
<br>
 
<br>
 
'''REMEMBER: This only works with MPEG1 and MPEG2 files!'''
 
<br>
 
<br>
 
To test MPlayer with XvMC, head over here and download a video:
 
<br>
 
http://www.leadcodecs.com/Download/MPEG-Videos.htm
 
<br>
 
<br>
 
 
== References ==
 
== References ==
<br>
+
XvMC (from MythTV wiki) <br>
'''XvMC (from MythTV wiki)'''
+
<br>
+
 
http://www.mythtv.org/wiki/index.php/XvMC
 
http://www.mythtv.org/wiki/index.php/XvMC
<br>
+
 
<br>
+
MPlayer 1.0rc1 + XvMC Nov 2006 <br>
'''MPlayer 1.0rc1 + XvMC Nov 2006'''
+
<br>
+
 
http://www.murga-linux.com/puppy/viewtopic.php?t=13216
 
http://www.murga-linux.com/puppy/viewtopic.php?t=13216
<br>
+
 
<br>
+
Using older machines for HDTV video playback <br>
'''Using older machines for HDTV video playback'''
+
<br>
+
 
http://www.penlug.org/twiki/bin/view/Main/LinuxHardwareInfoNvidia5200
 
http://www.penlug.org/twiki/bin/view/Main/LinuxHardwareInfoNvidia5200
<br>
 
<br>
 

Revision as of 08:03, 17 October 2009

This guide allows NVIDIA video card users to enable XvMC support for MPlayer (as the default MPlayer build for Arch Linux does not support XvMC). It involves using ABS to recompile MPlayer. Required readings: ABS, makepkg.

Introduction

In layman's terms, XvMC allows the video card to handle processing of certain video features. Particularly, features that have the tendency of heavily depending on the CPU. XvMC acceleration takes the load off the CPU, thereby reducing processor requirements for video playback. It is often used in HDTV video playback scenarios.

Known Limitations

There are a few considerations to keep in mind:

  • 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.
  • Calling Mplayer/GMplayer from the commandline is required.
  • XvMC is buggy and prone to cause issues under various circumstances.

Requirements

  • An NVIDIA video card that is known to support XvMC. (ie: GeForce 4MX, GeForce FX series, GeForce 6xxx and GeForce 7xxx series. Any other older cards will not work. Also note that GeForce 8xxx and later no longer support XvMC)
  • Installing the proprietary NVIDIA driver is required for XvMC to work.

How to add XvMC support to MPlayer?

1. Install the required dependencies as root:

# pacman -S cvsup libxvmc unzip libcaca --asdep

cvsup is required for downloading the source and the ever important Template:Codeline 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.
2. Sync the ABS tree:

# abs

3. Copy Template:Codeline to a temporary working path.

$ cp /var/abs/extra/mplayer ~/devel/abs/mplayer

4. Edit the PKGBUILD:

$ cd ~/devel/abs/mplayer
$ nano PKGBUILD
4.1 Add the XvMC library to the dependency list:
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)
4.2 Add the XvMC configure flag:
./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
Note: The relevant parts are bolded. Do not replace the rest of the dependecies, or flags, for the ones listed here; they are examples.

5. Compile the package:

$ makepkg

6. Install:

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

7. Finally, edit Template:Filename (create if it does not exists), and add:

libXvMCNVIDIA_dynamic.so.1
Note: lbXvMCNVIDIA_dynamic.so.1 is part of the nvidia driver package. Backup before any modifications

Check the list of available mplayer video drivers:

mplayer -vo help

The following entry should appear among the list:

xvmc    XVideo Motion Compensation

How do I use MPlayer with XvMC enabled?

It must be started from the command line:

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

gmplayer - Loads up the GUI version of mplayer, whereas using mplayer does not. -vo - Video driver: This is the only way of specifying xmvc. -vc - Video codec: The only compatible codec with XvMC is ffmpeg12mc. -fs - Optional: tells GMplayer to start in fullscreen mode. For more options, type Template:Codeline.

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