X-Video Motion Compensation, or XvMC, is a part of The X Window System which allows video programs to offload motion compensation and iDCT (Inverse Discrete Cosine Transform) portions of MPEG2 decoding to the GPU hardware. XvMC can greatly reduce CPU utilization when playing back MPEG-2 video. In theory it should also reduce bus bandwidth requirements. Savings will be most dramatic with slow CPUs or when playing HDTV. SDTV will benefit as well, but most modern CPUs can already play back SDTV without XvMC. MythTV can be compiled to use XvMC for native playback. External players such as Xine and Mplayer can also be compiled to support XvMC.
Currently, only MPEG-2 is supported. This is usually a hardware limitation. As an exception, one of the Unichrome chips is capable of XvMC accelerated MPEG-4 playback, but the Unichrome driver doesn't support that functionality at the time of this writing.
- 1 Drivers
- 2 Application Support
- 3 Example CPU Savings
- 4 Tips and Tricks
- 5 Caveats
- 6 Alternatives
- 7 External Links
Each hardware video card capable of XvMC video acceleration requires a software driver to enable these features. Below is a list of the recommended software drivers and driver versions for each supported hardware type.
There are currently two X11 Nvidia drivers available: Open Source and Proprietary Binary. However, most, if not all people running an Nvidia card with MythTV use the binary driver. See below for an explanation of each driver. Recent NVidia cards have support for full MPEG2 offload (iDCT + MC), and even MPEG4 offload not addressed in XvMC. The GeForce4 MX and GeForce FX series cards also support full MPEG2 offload. The GeForce 4 (non-MX) series cards and earlier support only hardware motion compensation, not the more CPU intensive iDCT offload.
|Status||This driver is full featured and actively maintained and developed directly by Nvidia Corp. Unless otherwise noted, any mention of Nvidia hardware on the MythTV wiki, forums, or mailing lists usually imply the use of the binary Nvidia driver.|
|How to Obtain?||This driver is not included with the XOrg X11 Server for licensing reasons. It is available as a third party download. Usually your linux distribution will have a package available in RPM, Deb, ebuild, or other format.|
|Recommended Version|| As of 2006-04-7, the currently recommended driver version is: 1.0.8756 as it fixes the OpenGL Vsync issues present in earlier versions, as well as fixing the AGP + XvMC issues on 6200 series cards.|
Versions between 1.0.7676 and 1.0.8756 (exclusive) have broken OpenGL Vsync. These versions are still usable so long as OpenGL Vsync is disabled in mythfrontend's settings. One user, Trevarthan, reports that version greater than 1.0.8178 prevent a kernel panic while running mupen64.
I tested XvMC with the 8756 driver on a Geforce 6150 based motherboard (the Asus A8N-VM CSM) and it works fine with MythTV at about 10% CPU usage using a Athlon64 3200+ --Seanyseansean 11:04, 10 April 2006 (UTC)
|X11 driver name||nvidia|
|Chipset Availability||Nvidia Chipsets are widely available and can be found commonly on PCI, AGP, and PCI-e cards, as well as on motherboards with integrated video, though significantly less common on the latter.|
|Status||Basic functionality. Only supports 2D hardware acceleration. (no 3D/OpenGL acceleration)|
|How to Obtain?||Included with the XOrg X11 Server.|
|X11 driver name||nv|
"Unichrome" is the product name for the onboard graphics of Via chipsets. The Unichrome chips can provide MPEG processing beyond standard XvMC MPEG2 acceleration. This is called VLD (Variable Length Decoder) acceleration and is commonly referred to as XvMC VLD. XvMC VLD can provide full MPEG2 decoding, allowing MPEG playback with very low CPU requirements. Most chipsets are limited to 1024x1024 playback resolution, and thus cannot support HDTV. This includes many of the chipsets sold as "Pro" models, so take care to confirm HD support before purchase.
Support for MPEG4 and also IDCT/MC acceleration are currently in progress. The OpenChrome project has support for a broad range of chipsets.
CN400 and PM800 chipsets are reported to support HDTV resolutions on VGA/DVI outputs. These are usually referred to as "Pro" chipsets. Many Pro chipsets ship with TV encoder chips that are not capable of displaying HDTV resolutions. These chipsets can typically playback HDTV on VGA/DVI, but not TVOUT. Pro chipsets that include a vt1625 HDTV encoder are physically capable of displaying HDTV resolutions via Component and SVid/Composite outputs. However, the openchrome project does not yet support the vt1625 so this functionality cannot be used. Of the TVOUT interfaces mentioned above, only Component is actually capable of displaying HDTV resolutions. Composite and S-video do not have the bandwidth, so your HDTV video will be scaled to SDTV resolutions.
Trevarthan has tested HDTV on SP8000E and SP13000 EPIA boards which include a CN400 chipset. HDTV playback via VGA works without audio in Xine (a bug in Xine?). In mplayer, video and audio work, but playback isn't as smooth as in Xine, and the audio and video quickly lose sync. In MythTV 0.19, HDTV playback using XvMC VLD is broken. Audio can be heard, but the video appears as a blank or noisy dark blue screen.
SDTV playback on these boards works fine in Xine/mplayer/MythTV.
Trevarthan has also noticed considerable instability on the SP series boards with the CN400 chipset. The instability is much worse in Xine, but appears to be present in mplayer and MythTV also. It manifests as a complete hardware lockup. One of the openchrome project's developers, Ivor, has confirmed that this is a known issue with CN400 support.
|Status||2D, 3D and Xv supported in Xorg via driver for CLE266, KM400/KN400, K8M800/K8N800, PM800, P4M800, P4M800PRO, and CN400 chipsets. PM8X0 likely but not available yet.|
|How to Obtain?|| Included in recent versions of Xorg (6.9 and 7.0) (Newer chipsets supported in openchrome-svn first.)
minimyth is also a good source of openchrome support as it is designed to run on Via EPIA boards with Unichrome chipsets.
|Recommended Version||Xorg (6.9 and 7.0)|
|Chipset Availability|| |
The DeltaChrome graphics cards should fill this gap but aren't widely available yet.
A standalone card is currently available on PCI-e capable boards: S3_Chrome-s27 is it's current homepage.
The X11 i810 driver supports the full range of Intel integrated graphics chips. These are common in midmarket laptops and also on a number of motherboards. Their graphics capabilities are modest but underestimated by many. A binary driver containing additional functionality is available from Intel but the vast majority of the chipset's features are available from the in-tree driver. More updated information on Intel drivers/chipsets can be obtained from Intel
|Status||Full featured driver. Supports 2D and 3D hardware acceleration.|
|Supports XvMC?||YES (Supports offload of Motion Compensation, but most chipsets do not support the more CPU intensive iDCT. The G965 / GMA X3000 has full iDCT+MC hardware. Driver support for this is unknown. )|
|How to Obtain?||Included with both the X.Org and XFree86 server software.|
|Recommended Version||Unless you are having problems, use the driver included with your distribution. A "test driver" is available from the maintainer's page. It is updated every few weeks.|
|X11 driver name||i810|
|Chipset Availability||This chipset is used in some DIY motherboard kits but is more common in laptops. Its use in a MythTV setup is less than ideal due to limited decoding capabilities (see above), as well as incomplete TV-Out support in the X.org/XFree86 driver.|
The ATI display drivers for Linux do not support XvMC. Despite the fact that all Radeon hardware has support for MPEG2 acceleration, ATI has never provided access to these capabilities in Linux.
The following binary linux distributions support XvMC out of the box:
- Mandrivia 2006 Free
Before MythTV can make use of XvMC hardware support, it first has to be built with XvMC support.
For a more hands-on approach, one can compile MythTV directly from source.
XvMC depends upon the 'x11', 'xrandr' and 'xv' choices being enabled in configure. These are enabled by default, but you may want to specifically list them. The configure program checks for the correct libraries and files and the results are listed by the program when it exits.
If compiling manually for either nvidia, I810 or unichrome, use:
If you are compiling for unichrome-pro, use:
./configure --enable-xvmc --enable-xvmc-pro --enable-xvmc-vld
If you have the libXvMCW wrapper installed, then it will be automatically enabled by the configure program and all of the available library assets will be utilized. However, double-check your ./configure output during MythTV configuration state whether it says "yes" after "XvMC support" (or XvMC pro support) or not, since some distributions do not enable XvMC automatically regardless of XvMC library found in /usr/lib.
If installing MythTV on Gentoo Linux, make sure the "nvidia" or "unichrome" USE flags are set. This can usually be set on a per package basis in the following file:
After MythTV has been installed, it needs to be configured to utilize XvMC.
- Add your XvMC library module name to the /etc/X11/XvMCConfig file, creating a new one if necessary
- For binary Nvidia drivers, the contents of XvMCConfig could be "libXvMCNVIDIA_dynamic.so.1"
- In MythTV's frontend menus, please navigate to:
Setup -> TV Settings -> Playback
- Next, change the "Preferred MPEG2 Decoder" to "Standard XvMC"
- For the Via Unichrome chipset, select "Via XvMC"
- Make sure "Extra audio buffering" is checked.
That's it! XvMC should be enabled. Now play a few Recordings and see what happens. If problems occur, check the Tips and Tricks section below for more info.
MPlayer includes an XvMC output plugin. To use it, try this:
mplayer -vo xvmc -vc ffmpeg12mc
(assuming you are running mplayer with XvMC support compiled in)
- Note - unichrome support in mplayer requires a patch.
Xine's has two plugins for XvMC support, the first is named xvmc as you would expect, however to take advantage of XvMC acceleration on nVidia graphics cards using the nVidia binary drivers they have a seperate plugin named xxmc (xx instead of xv).
To use Xine with XvMC support for most graphics cards use:
xine -V xvmc
To use Xine with XvMC support nVidia graphics cards use:
xine -V xxmc
(assuming, of course, that xine has been compiled with XvMC support.)
Example CPU Savings
|CPU||RAM||Video Card||Content||CPU w/XvMC||CPU w/o XvMC||XvMC Deinterlace||Non-XvMC Deinterlace||MythTV Version||Notes|
|C3 Samuel 2 600Mhz||256MB||Via CLE266 w/ VGA Out to 960x600 (ws-LCD)||SD||45%-50%||100%||bob||No||svn rev 10180||This is a combined Front/Back-end system. Stable, reliable and smooth playback with XvMC, unusable without.|
|AMD Athlon 800||768MB PC100||Nvidia Geforce4 MX440||SD||15%-20%||45-50%||Bob/Kernel||Kernel||0.18.1||A little jumpy for ~15 seconds after entering LiveTV/Recording, then smooth.|
|933mhz P3 w/256k cache||512M PC133||128M Nvidia 5200 AGP 4x w/VGA Out to 1280x1024 CRT||SD||32%||40-46%||NO||NO||0.19 SVN fixes rev 9591||SD Playback is smooth and reliable. Frontend is remote via 100BaseTX and complains of constant prebuffer pauses. Using nvidia driver version 8756 and OpenGL VSync. XV picture controls ON.|
|933mhz P3 w/256k cache||512M PC133||128M Nvidia 5200 AGP 4x w/VGA Out to 1280x1024 CRT||HD 1080i||100%||100%||NO||NO||0.19 SVN fixes rev 9591||This machine is too slow for 1080i, even with XvMC. 1080i is choppy and unwatchable. Frontend is remote via 100BaseTX and complains of constant prebuffer pauses. Using nvidia driver version 8756 and OpenGL VSync. XV picture controls ON.|
|AMD Duron(tm) 950||512MB||GeForce4 MX 440 AGP 8x||SD||12-14%||28-32%||No||No||0.19||Slackware 10.2 I needed to add a newer version of the X11-devel package to get the xvmc include files.|
|1 Ghz AMD TBird||256MB DDR||64MB GeForce4 MX 440||HD (1080i)||65-70%||100%||Bob||Bob||LFS & compiled .19 fixes branch||OSD is in B&W, but 1080 is smooth and watchable, with the occasional stutter when switching channels on live, or the OSD is on. Frontend still complains of the occasional prebuffer pause. Without XvMC, HD stutters a lot.|
|VIA C3 Nehemiah 1GHz||20%||Unknown||Unknown||Unknown||can hardly play mpeg2 without XvMC|
|Via C3 Nehemiah 1.33GHz||1GB||VIA CN400||SD||25%||90%||Bob||Unknown||0.18.2, 0.19|
|AMD Athlon XP 1600||1GB DDR||Nvidia 6800LE||SD||15%||25%||Unknown||Unknown||N/A, tested with MPlayer|
|AMD Athlon(tm) XP 1900+||512 MB||NV25 [GeForce4 Ti 4400]||SD||55%||44%||Bob||Kernel||0.19||Debian Unstable Nvidia 8178. Picture stuttered after 0.18.1 -> 0.19 upgrade, tried XvMC fixes picture, but uses more CPU (?) Using ChromaKey Hack with success. Prebuffer pause only at begining of watching TV.|
|2 Ghz Celeron||512MB DDR||128MB NVidia 6200 AGP 8X||HD (1080i)||65-70%||100%||Bob||Bob||FC4 & ATRPMS 0.18.1 / LFS & compiled .19 fixes branch||OSD is in B&W, but 1080 is smooth and watchable, with the occasional stutter when switching channels on live, or the OSD is on. Also had to turn on NvAGP to get XvMC working with this video card. Frontend still complains of the occasional prebuffer pause. Without XvMC, HD stutters a lot.|
|2 Ghz Celeron||512MB DDR||64MB GeForce4 MX 440||SD||12-14%||22-24%||Bob||Bob||ATRPMS 0.18.1||AverMedia M179 tuner card, NVidia driver 7676, OSD is B&W|
|Athlon XP 2000+||512MB PC2700||GeForce4 MX440||SD||13%-19%||25%-28%||NO||NO||0.18.1|
|Athlon XP 2000+||512MB PC2700||GeForce4 MX440||HD||52%-62%||99%+||NO||NO||0.18.1|
|Intel P4 2.26||512MB||GeForce 5200||1080i||50%||100%||Bob||Any||0.19||1080 unwatchable without XvMC. 720 and below are OK withouth XvMC|
|AMD Athlon XP 2400||512mb DDR 3200||Nvidia FX 6200||HD (1080i)||20-25%||80%||BOB||Unknown||0.18||of course XvMC still likes to lock on "prebuffer" a lot|
|AMD 2500+||1GB||FX5500 256MB||HD||50%||99%+||Unknown||Unknown||Unknown|
|Sempron64 2500||256 MB PC 3200||FX 5200||HD||30%||90%||Bob||Bob||0.19||FC4 i386 build (still can't get x64 build to install properly). 1080 content unwatchable without XVMC, 720 / 480 content watchable w/o XVMC. With XVMC: 1080 watchable while also recording two additional 1080 channels.|
|P4 @ 2.67GHz||512 MB PC 3200||FX 5200||HD 1080i||45%||95%||Bob||Bob||0.19||FC3 ATRPMS NVidia 7676. Unwatchable without XVMC; slight, but occasionally noticable audio stutter with XVMC.|
|Athlon XP 2800+||512 MB 3200||GeForce4 MX440||SD||7%-8%||9%-10%||Bob||Bob||0.19||Gentoo kernel 2.6.15 with NVidia 7676 driver. Tried 8178 driver, but CPU usage went to 85%|
|2.93Ghz Celeron D||1Gb DDR 3200||128M Nvidia FX 5200 AGP 8x w/TV OUT to 800x600 SD TV||SD||8-12%||10-14%||NO||NO||0.19||SD Playback is smooth and reliable. No complaints!|
|2.93Ghz Celeron D||2Gb DDR 3200||256M Nvidia 6200 AGP 8x w/DVI Out to 1360x768 LCD||SD||14%||17%||NO||NO||0.19 SVN fixes rev 9591||OSD is in B&W, but SD is smooth and watchable, with a very brief stutter when switching channels on LiveTV. No prebuffer pauses. Without XvMC, SD playback is smooth. Using nvidia driver version 8756 and using OpenGL Vsync. Can't reliably run Bob deinterlace for unknown reasons. XV picture controls ON.|
|2.93Ghz Celeron D||2Gb DDR 3200||256M Nvidia 6200 AGP 8x w/DVI Out to 1360x768 LCD||HD 1080i||50%||100%||NO||NO||0.19 SVN fixes rev 9591||OSD is in B&W, but 1080i is smooth and watchable, with the occasional stutter when switching channels on LiveTV, or the OSD is on. Frontend still complains of the occasional prebuffer pause. Without XvMC, HD stutters a lot. Using nvidia driver version 8756 and using OpenGL Vsync. Can't reliably run Bob deinterlace for unknown reasons. XV picture controls ON.|
|Athlon 64 3200+||768MB PC2700||GeForce FX 5200||HD 720P||20%||51%||Bob||No||Pre 0.19 SVN||Running in 64 bit mode, with NVidia 7676 driver|
|Athlon 64 3200+||768MB PC2700||GeForce FX 5200||HD 1080i||42%||70%||Bob||No||Pre 0.19 SVN||Running in 64 bit mode, with NVidia 7676 driver|
|Athlon 3200+||512MB PC3200||GeForce FX 5500||HD 1080i||45%||100%||Bob||Bob||Pre 0.19 SVN (8922)||720p Playback with NVidia 7676 driver. Significant stuttering w/o XvMC.|
|Athlon 64 X2 3800+||512MB DDR400||GeForce 6150 on-board an Asus A8N-VM CSM||HD 1080i||20%||50%||Bob||Kernel||0.19||XvMC has some glitches. Perfect without XvMC.|
|Athlon 64 2400+||512MB DDR266||Nvidia FX5200 & Asus A7V-266EX||SD||20%||70%||Bob||Kernel||0.19 svn||Picture quality is flawless, no problems. Slight errors and pauses with HD material (CPU 100%)|
|AMD Sempron 3400+||768MB PC3200||Nvidia Geforce 6100 onboard (410)||HD 1080i||75%||100%||Linear||none||0.19.129||FC5, unwatchable without Xvmc, needs latest Nvidia drivers (8756) for onboard 6100. %75 is just to play, takes another ~%10 to record the HD from the firewire on an LVM. OSD is in color, overlay causes slight audio corruption but goes away once the overlay stops.|
|AMD Athlon XP 3000+||512MB PC3200||Nvidia FX5200||HD 720p||~33%||~70%||Bob||Bob||svn 10469||As above, audio stutters when OSD is diplayed but otherwise smooth and nice looking. Using Chromakey hack for color OSD.|
|AMD Athlon XP-M 3000+ (2.2GHz)||768MB PC133||Nvidia 6200 128MB DDR||HD 1080i/720p||55/38%||100/90%||Bob||Bob||0.20 svn 11499||1080i: studders badly w/o XvMC. Minor tearing even with OpenGL sync. Displayed at 1080i w/o bob fails to consistently order interlaced fields correctly. 720p: perfect displayed at 720p w/ or w/o XvMC. Monitor: 1080i/720p/480p CRT.|
|AMD Athlon XP 3000+||512MB PC3200||Nvidia FX5200||HD 1080i||~70%||100%||Bob||Bob||svn 10469||Stuttering w/o XVMC, but with XVMC smooth and nice looking.|
|AMD Athlon XP 1600+||512MB||Nvidia FX5200 AGP||HD 1080i/HD 720p||~60-80%||100%||Onefield||Onefield||0.19-fixes 10686||Haven't tried Bob deint yet. HD stutters badly without XVMC, with XVMC 1080i plays back perfectly.|
|AMD Athlon XP 2500+||1GB||FX5200 256MB||HD||33.5%||67%+||Bob||Bob||0.19-fixes Knoppmyth R5C7||Using latest Nvidia drivers 1.0-8756|
|AMD Athlon XP 3200+||512MB PC3200||FX5500 256MB||HD 720p/1080i||30-40%||99%||Bob||No||0.19-fixes||Nvidia driver: 8774. B/W OSD w/ audio stuttering during OSD. Turning off "extra audio buffering" reduced audio buffer underruns. Not using NvAGP (enabling it made my CPU 90%+). Other than OSD problems, XvMC works great!|
|AMD 64 3500+ (2.2GHz)||1024MB DDR 400||nV 6600GT 256MB||SD||~24%||? (will check later)||Linear blend||0.20+SVN09-10-2006||nVidia drivers: 8774. The cpu is running at 1000MHz (cool 'n' quiet activated) during the whole time watching tv, so it is 24% @ 1000MHz. No audio buffer underruns with and without "extra audio buffering". I have to enable the "interleaved Normal" mode while watching tv to watch it perfectly. "Auto(E)" doesnt recognize the tv input as interleaved.|
|AMD Athlon XP 2500+||1024MB DDR 400||nV 6200 128MB||SD/HD||Bob||Bob||svn rev 11529||Have to disable OpenGL vsync to handle 60fps progressive or 30fps interlaced (w/ bob deinterlacing) content. OpenGL vsync works fine with 24/30fps playback. OpenGL vsync with 60fps playback causes stuttering w/ prebuffering pauses, but only when OSD is not displayed - seems like a bug?|
|(Please add your example Hardware stats here!)|
Tips and Tricks
XvMC sounds like a dream come true for those wanting to play HD content with a slower system, but unfortunately it's not always perfect. Even with XvMC and low CPU usage, many still experience problems with prebuffering pauses, mild to moderate audio or video stuttering, problems with the OSD, and other issues. If their CPU is fast enough, many simply turn off XvMC as a last resort. But this guide hopes to help the reader make the most of XvMC and avoid frustration. Here are some suggestions that may help:
Prebuffering Pause or stutter with Nvidia
- Try disabling OpenGL VSync (this is a parameter that you can set when compiling mythtv from source - it defaults to off in v0.19)
- Try using the 'nvidia-settings' control panel to disable Video Texture Adapter and/or Video Blitter Adapter "Sync to VBlank" checkboxes (on the "X Server XVideo Settings" page)
- Try setting this in your "Device" section in your xorg.conf:
Option "NVAGP" "1"
Note, some users have had better success setting NVAGP to 2 rather than 1.
- Use BOB (2x framerate) deinterlacing
- Try disabling 'Use video as timebase' (TV Settings -> Playback)
- Try using 'Seperate video modes for GUI and TV playback' to set your resolution to match the resolution of the recording.
If you are using MythTV version 0.18 and you experience severe OSD stutter or flicker when XvMC is enabled, try upgrading to 0.19. The OSD flicker is fixed for the author in 0.19 with an Nvidia FX 5200.
Greyscale OSD (NVidia 4 & 5)
MythTV version 0.19 ships with a hack to enable full color OSD with XvMC enabled on Nvidia 4 & 5 series cards ONLY.
(i.e. Nvidia FX 5200 is a 5 series card, 6000 is a 6 series card)
WARNING: if you have a non-nvidia card or an nvidia 6 or 7 series card this hack won't help. The nvidia 6 and 7 series cards lack the chroma keying and color & contrast adjust features that the older 4 and 5 series cards had.
That is why this guide refers to this feature in 0.19 as a "hack".
(Thanks to Daniel Kristjansson, the author of the chromakey code, for this info!)
If you have an nvidia 4 or 5 series card, please read on:
The hack is disabled by default. The code change is described here.
To enable the hack under 0.19, do this:
- Make a change to your xorg.conf file. Add this to your Devices section:
Option "XvmcUsesTextures" "false"
- Make a change to the "settings" table in MythTV's MySQL database. You can access your MySQL mythconverg database from the command line like this:
mysql -u root -p mythconverg
You will be prompted for a password. If you don't remember setting one up, try just pressing the ENTER key.
Here is the SQL statement you should use to make the change:
INSERT INTO settings SET value='UseChromaKeyOSD',data='1',hostname='yourhost';
But change 'yourhost' to the hostname that your frontend is running on. If you're not sure what your hostname is, run `hostname` on the command line to find out.
- Now restart X11 (for the xorg.conf change to take effect) and your frontend (for the SQL change to take effect) and see if it works!
Greyscale OSD (Unichrome)
The hack for Nvidia cards described above and shipped with MythTV version 0.19 will also work if you are using a Unichrome chipset. The hack has been verified on a Via EPIA M10000 board with the CLE266 chipset with viaXvMC enabled.
Use XvMC For HD Only
To use ffmpeg as your decoder for all content less than 720x*, insert a row into settings where value = 'UseXvMCForHDOnly' and data = '1' such as with the following SQL command:
INSERT INTO settings (value,data,hostname) VALUES ('UseXvMCForHDOnly', '1', 'yourhost');
Naturally, substitute your frontend's host name for 'yourhost'. Be sure your frontend has PreferredMPEG2Decoder set to Standard XvMC.
- BOB and onefield are the only Deinterlacing methods that work with XvMC.
- Picture in Picture, or PiP, doesn't work with XvMC.
- Editing a video is difficult to impossible with XvMC.
- Stepping though the video frame by frame can cause artifacts with XvMC.
There are alternative methods for hardware assisted MPEG-2 playback of standard definition video: