Kristian's web log

March 28, 2009

VDPAU – 1080p with CPU cycles to spare

Filed under: /dev/random — Tags: , , , — kristian @ 20:00

I just went from Ubuntu 8.04 to 9.04 (through 8.10). For two reasons:

1. EXT4

2. VDPAU

In Ubuntu 9.04, the 180-series of drivers from nVidia is included. Doesn’t matter much? Well, it does have VDPAU. That means GPU-assisted decoding of h264. I’m currently playing a 1080p video on my Core 2 Duo 2.4GHz on battery power and it’s smooth. Very smooth.


kristian@kjeks:~$ while sleep 1; do cat /proc/cpuinfo | grep MHz; done
cpu MHz : 2000.000
cpu MHz : 800.000
cpu MHz : 2400.000
cpu MHz : 800.000
cpu MHz : 1600.000
cpu MHz : 800.000
cpu MHz : 1600.000
cpu MHz : 800.000
cpu MHz : 2000.000
cpu MHz : 800.000
cpu MHz : 2000.000
cpu MHz : 800.000

That’s my cpu clocking down to conserve battery and because the decoding isn’t taking place on the CPU any more. Mind you, the CPU usage is still pretty high, but the difference between 70-90% of CPU usage and 100% is the difference with decoding just in time and decoding just a bit too late.

One side note is that VDPAU doesn’t work while running Compiz. Yet.

To get this madness to work, nVidia has made a nice little script and patch to compile mplayer with the required support. Available from ftp://download.nvidia.com/XFree86/vdpau/, it’s surprisingly clean. These things have a nasty habit of doing Bad Stuff, but this really is as clean as it gets. It’s essentially just a few svn checkouts followed by patch -p0, ./configure and make. Not even make install. Oh yeah, if you’re doing this you obviously need patch, subversion and the ability to build mplayer.

After that, all you do is grab your favorite h264 1080p video and play it with mplayer -vo vdpau.

February 3, 2009

1080p under GNU/Linux

Filed under: /dev/random — Tags: , , , — kristian @ 19:15

I recently bought a 24″ monitor with 1920×1200 resolution, and suddenly found myself actually caring about HD. I assumed my Core 2 Duo E6600 (2.4GHz) combined with nVidia 8600GT would handle it…

Now, as it turns out, it ALMOST handles it. By renicing mplayer to -19, I can mostly get through the munin update that polls localhost + 3 virtual machines running on localhost without mplayer lagging. The framerate might take a bit of a dip, but I can live with that (after all, that’s a significant load spike).

For those who aren’t familiar with HD, 1080p refers to video with a vertical resolution of 1080 pixels, typically 1920×1080. The p indicates progressive scan, as opposed to interlaced. The codec used is typically H264, which is what I’ll focus on.

Anywa… I just discovered that nVidia released a driver as late as January 8th 2009 that contains support for GPU-accelerated h264 decoding. They even supplied ffmpeg and mplayer patches to enable it. As much as I dislike the proprietary aspect of nVidia, I must say that they have always been miles ahead of everyone else with their Linux drivers. This nvnews article announces the support for VDPAU, the API needed to do all this magic. It also points out that the support is preliminary, and that it’s not stable yet. But for any HD-loving GNU/Linux-user with an nVidia card, this is great news.

Back to my non-gpu-accelerated setup… While it currently works, I won’t say it works great. The cpu core with mplayer is resting neatly at 95-100% usage, and that’s not good. Additionally, I’m getting quite a bit of tearing, which I’ll look into. Hopefully, I can solve that with some vsync-tweaking… I am, after all, running compiz during all of this.

Powered by WordPress