Unlocking the full video potential of your video card

Have you ever wondered what the ‘video’ plugin is for? A short answer is that it does video accelleration through Compiz. But what does this all mean? Well we have to start with a few little explanations.

Compiz, at it’s core is a really simple openGL loop which takes textures which it was provided by the GLX_EXT_texture_from_pixmap extenstion and manipulates them using openGL functions. This works surprisingly well in most cases, as your desktop works as it once did – with 3D effects. There are only 3 shortcomings to this however:

  1. Your desktop is really an openGL ‘image’ of sorts (Made up of textures and surfaces). Applications and X are unaware of this image being manipulated. Therefore, animated objects cannot be clicked on (clicks are registered in the wrong place). Positions of textures and windows are synced up with the X server after animations are completed – making everything mildly sane for X
  2. When windows are not really rendered to the X server to display to the screen, but a ‘dummy’ is rendered there (like a blue or black patch), Compiz cannot get the texture of that window. Instead, that window is rendered directly to the screen and when Compiz is transforming the object, but part of the object is not transformed – resulting in flickering and blueness.
  3. The process in which Compiz goes through to get the texture can make some high-performance stuff quite slow. The pixmap is drawn to the X server, the X server gets it (via AIGLX or Xgl or NVIDIA) maps it to a textures, which compiz then transforms. This means that the texture has to be refreshed constantly. This can result in slowdown of application performance – such as XV if it is redirected.

However, with the video plugin, there is a solution to problem 3 with video. Instead of drawing the video to the X server, why not use openGL functions that are built into Compiz to draw the video for us. This is where we can do some cool stuff.

So how do we get all this magic?

Well, firstly, enable the ‘video’ plugin. Now we need to get a patched version of mplayer. Firstly, download the mplayer 1.0rc2 source code from:


extract it …

Navigate to the directory ‘libvo’

Download this patch : http://smspillaz.googlepages.com/mplayrepatch.patch

Apply it with:

patch -p0 vo_xv.c mplayrepatch.patch

Configure and Compiz Mplayer (It takes a long time :D).

EDIT: The patch is by David Reveman, not me. Please make note of this if you plan to package a patched mplayer

Now open up a video. Experience the magic.

So what are some of the cool things we can do?

  • In AIGLX all video is redirected and all effects and be applied with NO SLOWDOWN 🙂
  • In Xgl, there is NO SLOWDOWN
  • We can run the video at any size without any noticeable slowdown
  • (It gets better :P)
  • Zoom into the video. Notice how the quality of the video gets better as you zoom in? (If you don’t notice this at first, make the window some really small size then zoon)
  • Use ‘stretch resize’ on the window and the video does not distort and stretch. It gets better 😛
  • Use normal resize on the window and you’ll notice that the scaling of the video is really smooth
  • No more washed out colors
  • Video shouldn’t contribute texture memory, so no more black windows with lots of videos open

Thats just some things. I’m sure there are plenty more.


Scaled up video. Notice how everything else it pixelly except the holy video 😀

Hopes that helped … a bit 😀

– SmSpillaz


55 thoughts on “Unlocking the full video potential of your video card

  1. Hi,

    do you know if main distros like debian, ubuntu will apply this patch to mplayer to support c-f video plugin?

  2. Sam,

    You can apply the patch slightly more conveniently from the root directory of the mplayer src with:
    patch -p0 <mplayrepatch.patch
    as the folder name (libvo) is contained in the patch itself.

    That’s one of the reasons I rediffed it into unified diff format 🙂

    JTKirk: I know we shipped a patched mplayer in Mandriva 2008 which was just released.

    thoand: Not sure about VLC or Xine. Both would be nice tho’.

    Sam: Do you know of anyway to get this working with mplayerplugin? Last time I tried (pre-rc2) it didn’t work when the video is embedded into mplayer (I’d imagine it’s something to do with tweaking the root window?)


  3. I have a question, what does it need in order to work? Will it work without fragment shader? I have a 855gm card that support most of the things, but some things use shaders that are not supported. I believe the video plugin is one of the things that will not work with intel 855/915/950

    Anyone? Have tryed.worked?

  4. Hi,

    In my case, trying to use xv after compiling results in :

    “Error opening/initializing the selected video_out (-vo) device.”

    Any clue ?


  5. Thanks for this article. I wondered what that plugin was for, and since my video seems to work fine, I haven’t dicked with it. This will be an interesting thing to show my non-linux-using friends.

  6. now just to make it so that everything else doesn’t go pixelly either.
    zooming in on the desktop and finding nice high resolution text, icons, and window decorations would be stunning. And a great help for the visually impaired too.

  7. @colin : I imagine that it should work, considering that you have patched the actual output backend itself. Applications like Mplayer-plugin, KMplayer, SMplayer, *Mplayer all create a window for mplayer to display the video in.

  8. thoand : I believe that crdlb is working on a patch for the gstreamer vo_xv backend too. It’s not too hard, I think all that is necessary is to create a switch to feed the video to compiz if compiz is availiable – skipping the ‘having to render it to get and then compiz refreshes it’ step.

    Hopefully to, maybe one day we can get a GLX plugin which will allow us to feed openGL straight to compiz instead of having to redirect that too, although I’m told that it can be done in the DRI layer

  9. @Anonymous

    You’d think that wouldn’t you? I agree. Unf. when trying to use it with mplayer plugin it didn’t work – you just get a black window (or at least I do!) this was discussed on the compiz ML a while back.

  10. I installed it, but I can see the blue of the video overlay when I make the player transparent. It composites perfectly otherwise, but the blue shows through which is rather annoying. Any ideas? I’m using compiz from the gutsy repos on an intel 915GM with AIGLX.

    Also, a version for vlc would be really really really nice.

  11. Hi:

    I have patched the mplayer MPlayer-1.0rc2 succesfully, I have configure and make it, and I have the video playback plugin activated with the YV12 colorspace activated.
    When I try to play a video with the patched mplayer (-vo xv) I have a blue screen instead of the image. If I deactivated the video plugin, I have the normal vo video.

    What am I doing wrong? Thx

    by the way I have a intel 855gm graphic card

  12. Try to start compiz from the command line – most probably the video plugin cannot be loaded beause of some buffer missing or GL capability missing/not implemented. this is what i get with water plugin for example.
    If you somehow manage to make it work on the 855GM i will be the happiest guy in the world, coz i have 855 too and i want to use it but….

  13. Smspillaz: Yes to both. I can make the window transparent and the scaling trick you mention above also works beautifully, but when I do make the video transparent it has a blue tinge on it, I presume from some remnant of the overlay.

    Even so, this is awesome, better than using vlc with xshm. Keep up the great work!

  14. Smspillaz: I’m testing over remote display to our thin clients (dave_largo) and when I run mplayer with this patch applied all I get is a blue screen. Reverting back to the original build I get normal XV which works fine. I restarted on the command line and the video plugin seems to start with no errors. Hit me up on the IRC if you have time to help me debug. Video cards is ATI 9250.
    Thanks! Dave

  15. Oh and this appears to be broken under 16-bit color, gives pure blue instead of video. Which is bad for me since compiz runs much smoother under 16bit color than under 24bit on my intel 915GM.

  16. I have applied this patch, typed ./configure in de Mplayer main directore, typed make, then make install, but if I watch a video while Compiz Fusion is running, I get a Purple screen in Mplayer and VLC. I have enabled the video playback plugin.

  17. Hi, all!

    I’m using Gentoo and I using an 865 card. I could compile Mplayer rc2 with this patch but mplayer only shows the first frame of video. The good news is that it is composited and the sound plays ok, but the video keeps frozen on first frame. Is there something I can do about it, or it is my video card which is too old?? Thanks in advance.

  18. Whoops, sorry. It is a 855GM
    output of lspci:

    00:02.0 VGA compatible controller: Intel Corporation 82852/855GM Integrated Graphics Device (rev 02)
    00:02.1 Display controller: Intel Corporation 82852/855GM Integrated Graphics Device (rev 02)

  19. I have Intel 855Gm. Will this speed up things like running Mythtv Frontend? You can run mplayer for watching movies but I use the internal player mostly.

    Also will this speed up things if I am using AWN?

  20. Hi all!

    I tried with xorg-intel 2.1.1 and I have problems of my screen not being redraw correctly when I use compiz-fusion. Am I missing something? Is there some configuration I can do in compiz or xorg.conf? I changed the sync to vblank, refresh rate, detect refresh rate with no effect.

    Thanks in advance.

  21. Works great for me, thanks! It does mess up scaling in fullscreen mode though… it gets the monitor aspect wrong and cuts of parts of the picture at the sides (in a 16:9 movie on a 4:3 LCD).

  22. Hi, all!

    I found in a post about intel driver bug: https://bugs.freedesktop.org/show_bug.cgi?id=10912#c12

    Where Ian comments the same problem I was having. And voilà! It worked!!

    You have to put this line in your xorg.conf:

    Option “XAANoOffscreenPixmaps” “true”

    I hope it helps.

    After using that, my screen gets repainted ok and I could test mplayer patch…. and it worked!!! Perfectly.

    Unfortunately it only works on 24 bits and as was pointed out, it would be nice if it worked on 16 bits too as my chip (855/gm) doesn’t have good performance under 24 bits.

    Anyway, thanks for the excellent article and patch which could allow me to have mplayer composite’d!


  23. This is great! I have been able to switch from x11 output to xv output, which has completely solved my choppy video performance and best of all the tearing I was getting in video! I’m using gentoo and mplayer 1.0r2 with metacity and compiz-fusion.

    A few notes:
    1) For whatever reason a bug in compiz fusion was not loading the video plugin when using a gconf backend. I have to use flat-file ini configuration for it to load properly.
    2) Gnome-Mplayer breaks with this. All you get is a blue screen. I suspect this is because the patch discards (or loses the ability to redirect output to) the windowid that gnome-mplayer passes.

    I searched through the gnome-mplayer, mplayer, and patch source to see if there was anything I dare edit and fix but I’m pretty stumped (first time linux install, etc). Any help or ideas on this would be appreciated! I feel like gnome-mplayer is _so_ close to working!


  24. Works great with the commandline mplayer; will not compile with gui option i.e. ./configure –enable-gui (i.e. gmplayer) will not work. the patch creates a new video output mode that does not map to the gui video preferences screen; i.e. we are setting this ‘special’ xv video output mode not. Wonderful for demo-ing, but kinda impractical for everyday use; i.e. plugins, kmplayer, etc. Also, although this patch DOES work; I used it with the reveman ccsm/compiz plugin for ‘video’, unfortunately CPU usage is very high –> (AIGLX/Intel 845GM/Dual Core2Duo 1.6GHz x86_64 openSuse) CPUs are nailed up at 100% & 15% (CPU0/CPU1) while playing back a Windows HD 1280×720 video; Same HD video played using mplayer (xv output) on openSuse 32 bit with no compiz-fusion drives CPU utilization to only 30-40% on a uniprocessor pentium M 1.7 GHz. Just wondering why we’re not seeing any drop in CPU use? Scaling work Beautifully with this patch and the plugin BTW.

  25. it works for me but under compiz it’s not keep the video’s aspect ratio in fullscreen! but without compiz the original xv out works well
    anyone knows how to fix it?

  26. Hi all,

    I post this message because i have a similar problem and nobody can explain me what it may be ;

    I cann’t watch any .avi wih any video player

    I tried Kaffeine, Xine, VLC, Mplayer, i got always audio but a video blue sceen

    I can watch the video ONLY WITH VLC IF I START XINE FIRST (and let it open) ?

    Many thanks for a tecnical idée

  27. You need to get all the plugins for xine. This is applicable only to libxine1, the xine-lib install does not list any plugins.

    As well you should select the xvshm output module for kaffeine or X11 for VLC and it should work. My testing resulted in only those particular configs working.

    Please note that the xvshm is only for Kaffeine (the Xine parameters) and the X11 is only for VLC.

  28. I know of a mplayer bug which has the same effect. Mplayer is rely on
    an shmall (minimum shared memory) value of at least 32678. You can
    observe it by typing sudo more /proc/sys/kernel/shmall. On rare
    occassion it may be below 32678 thus mplayer is only playing audio.

  29. At the uninterruptedly of May and June 2010, Polish entrepreneurs will be masterful to submit applications quest of funding activities agnate to the start or increase exports. Smoothness companies contain the chance to buy a very imposingly grants to champion activities interdependent to admission into unassimilable markets.
    The highest amount of funding is 200 thousand. PLN! Our company junior to the in excess of mentioned fake provides consulting services, strengthen your applications and account in return funding.

    Below the Innovative Economy Operational Routine, Measure 6.1 choice be supported:

    – Participation in foreign marketing fairs as an exhibitor

    – Participation in organized trade missions wide

    – Search and passage of partners in the object market

    – Obtaining the needful documents for the introduction of products / services to the selected unfamiliar customer base

    – Advising on the event of the concept simulacrum of the entrepreneur in selected overseas markets.

    Subsidies UE

  30. Straight ahead strapped firmly into. Change had taken place really bonding to samantha made a mistake or someone became suspicious way up in my gina. To her sex partners it squeak with an erotic and musical sound ceiling. He frequently went deep in to debt to join his peers and supervisors. Deeply and wetly up between her legs to the back of the car when we left at the beginning of december was her boyfriend and they. A real stud work to a potential client who was interested in fashion wear for high school students. http://hotels-island-review.com – swingers nitro wisconsin swinger profiles

  31. hey there and thank you for your information – I have certainly picked up something new from right here.

    I did however expertise several technical issues using this web site,
    as I experienced to reload the site lots of times previous to I could get it to load properly.
    I had been wondering if your web hosting is OK?

    Not that I’m complaining, but slow loading instances times will sometimes affect your placement in google and can damage your high quality score if ads and marketing with Adwords. Anyway I am adding this RSS to my email and could look out for much more of your respective fascinating content. Ensure that you update this again soon.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s