mplayer and vdpau in portage

I was hoping to write a lengthy post about VDPAU support for MPlayer in the portage tree, but since my harddrive crashed this week and I’m still recovering from that, a small announcement will have to suffice for now.

I just added a new ebuild to the tree this week for MPlayer, which has support for the much talked about VDPAU which comes with nvidia video cards and binary drivers.  If you don’t know what that is, it is probably most simply described as XvMC for more codecs: MPEG1, MPEG2, MPEG4 (H264), WMV, VC1.  The player offloads a lot of CPU decoding to the video card instead of your processor, meaning cheap video cards and cheap computers can playback HD without any hiccups.

In theory, at least.  I don’t know how well it works since I haven’t been able to test it much, and whenever I do, I can’t get it under 50% CPU anyway.

Anyway, you are free to try it of course.  The latest mplayer ebuild is 20090226.28734.  The naming scheme changed to reflect both the release date of the snapshot (Feb 26 2009) and the SVN revision from upstream (28734).  There is a “vdpau” use flag you’ll need to enable on the ebuild, and you’ll need  v180.22 or higher of nvidia-drivers.  In this case, nvidia is releasing updates with new drivers, so the more recent the better.

Here’s some cool stuff to read about VDPAU and what it can do:

NVIDIA 180.35 Driver Update Brings Changes

HD Video Playback With A $20 CPU & $30 GPU On Linux

Wikipedia entry

MythTV Wiki: Supported Cards

nvnews forum thread: mplayer and vdpau – see the third post for samples to test and mplayer command lines.

Oh yes, using it is pretty much a matter of mplayer -vo vdpau foo.wmv.  You may or may not need to use the -vc argument.  I haven’t looked closely.  See “mplayer -vc help | grep vdpau” for a reference, or the man page.

As far as the mplayer ebuild goes, there have been a lot of changes.  I’d been queuing them up for a good while waiting to push them live.  I had hoped to have a finished document accompany the release, but I haven’t given much time to it, and since VDPAU came out, I figured it would be better to release the ebuild.

It’s currently masked, but won’t be for long.  One nice thing it does is it splits up the real use flag into two: real and realcodecs.  I found that some users were confused and thought that they had to enable the realcodecs use flag to get any support for real codec playback, but that was never the case, as libavcodec always had support for some.  Now, the real flag will enable the internal support, and realcodecs will still use the external binary ones (not recommended).

Also, since libdvdnav got accepted into the mainstream build, we no longer have to rely on a masked, external dependency, so the dvdnav use flag is unmasked, available, and enabled by default.  You can playback DVDs browsing the navigation menus by using mplayer dvdnav:// instead of mplayer dvd://.

Other use flags that were added were faac, faad, and tremor.  If you want native support for AAC playback, just enable the aac use flag.  If you want to use the external libraries instead (faac and faad), then just disable the aac use flag and enable the other ones.  Tremor is the internal support for Vorbis playback.

The last change to the ebuild is that now lots more use flags are enabled by default.  I found out that a lot of people were going in #mplayer complaining that their builds weren’t working when really it was just not compiled with much in it.  As a result, I’ve changed it so it will enable just about every internal library and external codec.  That should make things simpler for users who want things to “just work” out of the box.

That’s it for now.  I’ll be bumping the ebuild again, soon, and regularly as long as the VDPAU development in mplayer keeps moving at a hectic pace.

in retrospect: picking a mini-itx board

I’ve been having problems with my little Mini-ITX motherboard ever since I got it.  It’s been much more of a handful than I expected, and nearly all the problems wouldn’t exist if I had gone with hardware that I was more familiar with and sure of its capabilities.

As it is, here’s the places I’m having problems:

Video: I have to use the latest 2.6.29-rc vanilla kernel to even get OpenGL working, along with an unstable system of ~amd64 with latest X and intel drivers.  Even with all of that, there is some nasty redraw issues on motion of any kind when playing back video.  It just draws about half the picture one second, and the other half immediately after.  Pretty noticable.

I tried getting a PCI nvidia card in there for more RAM and better picture, but the system will lockup anytime I use X or do something strenous with X.  I’m guessing that the card is drawing too much power and locking up the box.  I can’t get any logs or output of any kind the moment it freezes.  I could try a video card with less power draw, but don’t have any at my house, and I’m hesistant to try anyway.

ACPI: The thing is just buggy.  IRQ assignment is a bit whacked, and it’s sharing everything one one (audio, video), which I think may also contribute to the video problem.  Tinkering with the BIOS doesn’t have any effect.

Also, sometimes, when booting, the kernel will load the ACPI driver and then just stop.  The only way to work around it is to either shut it off and let it clear out and cool down and try again, or boot with acpi=off in the kernel command line.  I don’t want to do that, because that disables the CPU thermal monitors which brings me to my next problem.

Frequency Scaling: There’s no CPU frequency driver for my chip yet in the kernel, so it’s stuck running at full speed.  When it gets too hot, it’ll lock up the box, and I’ll have to power it down for a while.

I could whine about some other small stuff, but it doesn’t really matter, and you get small issues cropping up with any box anyway.  Even these “major” ones aren’t show stoppers.  I imagine the kernel will get a cpufreq driver soon enough.  The ACPI issues don’t really surprise me — the last MSI motherboard I owned had similiar issues and just would randomly flake out on me.  The power draw on the PCI card makes sense (I’ve tried lower power PCI cards, they work fine), and I get what I deserve for gambling on a video card I’ve never worked with before.

In short, the real problem that happened is that when comparing chipsets across the board when deciding what to buy, I totally threw out the variables of experience and known compatibility.  Most of them on my list (which I can’t duplicate right now, since my desktop is down at the moment) were all single-core VIA chipsets, with a few Intel Atom exceptions.  I have had, for a long time, a single core VIA C7 running at 1 GHz that has been chunking along at great speed and reliability (despite some onboard stuff giving out, it still works awesome) that, compared to the dual-core 64-bit 1.6 GHz Intel Atom one I got, should be considered worthless.  But, practically speaking, the first one works, and the second one doesn’t.

If I had to do it all over again, I’d have gone with the VIA.  But, I’m not really that regretful.  I knew I was taking a gamble, and I lost.  It happens.  Things will either get better and improve or I’ll get used to the way it is and make the best of it.  No big deal in the long run.  Besides, the experience is invaluable.

"oh yah, that whole blu-ray thing"

Here’s a post I’ve been meaning to write for a while.

I was at Hollywood Video the other night because I thought I’d stop in and see what there was to check out.  I go in there now and again just when I feel like watching something, but not sure what, and I’ll poke around.  I usually end up there for like 45 minutes trying to decide on something.  Anyway, I was looking around the new releases in DVDs, and not really finding anything, when I happened to stop by the blu-ray section.  I kinda stood there for a second, and then I remembered, “Hey, I can watch Blu-Rays on my PS3.  I totally forgot.”

I picked out a couple of movie and went on my way.  I know one was Dan in Real Life, and I can’t remember what the other one was.  Probably National Treasure 2.  I wanted to see the Goofy cartoon again (didn’t have it, either, denied!).

Up until this point, I had only seen one movie in Blu-Ray, and I was thoroughly unimpressed.  The first one I saw was 2001: A Space Odyssey, and while the picture was *nice*, it wasn’t 1080p-eyeball-popping nice.  Ever since then, I’d pretty much shrugged of the the format completely, ignoring everything I heard about it.  But then I watched these movies, and I’ve done a complete 180 on my position.

While it may not seem like a contender for a nice picture, Dan In Real Life looked absolutely amazing in 1080p HD.  I mean, wow.  I remember I was so blown away by how nice it was that I paused the movie quite a few times just to admire the picture.  In fact, it was so distracting that I wasn’t even paying attention to the movie half the time.

I’ve since rented a few more movies on Blu-Ray, and this is the conclusion I’ve come to: recent movies (past 2 to 5 years of release) look amazing.  Everything else looks like crap.

If you go to there are some good reviews on the movies, and it sounds like in some cases for older movies that the studios will just use the original DVD transfer and dump it back on Blu-Ray.  That’s a real shame, of course, especially considering the possibilities.

Picture quality aside, I would be normally jumping on this new format like a granny all over a yarn sale, but there’s one thing holding me back: the players.  Right now I’m using my PS3, and while the quality is great, the playback is annoying.  There’s no native support *across the board* for my very favorite feature: resuming playback position.  While this may seem annoying, the reality is that you can either pause your movie, or come back and go through all the forced menus and loading to get back to where you were, which can take seriously five minutes on some movies.

From what I’ve read on the situation, it seems like there are two types of movies out there: ones that play the data stream directly using the player, and others who use Java on the disc to start the player.  The movies that just start playback (Warner Bros.) work great.  I can stop it, and resume playback fine on my PS3.  The ones that use the fancy players, well, you’re stuck.  What happens is *some* of the Java players have an option to “bookmark” where you were in playback, so you can resume that way.  That may seem nice, but it still means that when you load the disc back up, you still have to go through all the forced advertisements, warnings (“You’re a Pirate”) and finally load and then navigate the menu just to get back to where you wanted.  Rawr.

Seriously, though, the nice picture quality *almost* makes up for it.  It’s that good.

I have been thinking a lot about what I want to do about the format, or how I want to integrate it into my collection.  While the playback solution is still slightly suboptimal, I’m not going to go full steam just yet.  I have, however, tenatively decided that I want to buy the movies on Blu-Ray that are really good for presentation value — the ones that you’d wanna watch on the big screen with the nice sound setup no matter what.  Those make sense to get, and most of the time I sit through those without a hitch anyway.

In fact, it’s one of those movies that got me thinking about the whole thing again.  I started watching TMNT on DVD last night, and I kept thinking “man, this picture is grainy.  It would look a lot better on Blu-Ray.”  In fact, I just about went to the store right then to go buy it on Blu-Ray because I wanted the better picture.  That’s one thing I’ve noticed with computer-generated animation on DVD.  It either looks really smooth (Clone Wars, A Bug’s Life) or kind of fuzzy and blurry like they did a poor job of compressing it.  I had to tone down my picture setting to a Cinema mode where it darkens the picture and forgives a lot of that stuff, taking some quality with it, but giving a nice glossy look overall (I love my TV.  It’s awesome.).

Oh, one other side note — I’ve written about this before, but TMNT is a great flick.  It really surprised me how well they developed each character and gave them some depth.  And I still think Splinter sounds like he’s drunk.

I wish I had a better sound setup.  I’ve been meaning to buy some decent speakers for years now, and I’ve been putting it off.  I could *really* see the sound quality go downhill with my stereo setup and two frontend bookshelf speakers.  I kept thinking, “I bet this would sound really nice in 5.1”  Ah well.  Someday.  I’ve never been that picky about sound, but I get a bit wistful when I don’t have it.

Anyhooms, I’m not really stating more than is pretty obvious — if you’re an early adopter than enjoys high quality audio and video, then Blu-Ray is for you.  Playback sucks, not just because of what I mentioned, but also because the players are still expensive, take a long time load discs, and need Internet connections and firmware updates.  Actually, I’m all for firmware updates — get the bugs fixed, yo — but I see the necessity of an ethernet connection in your living room a bit annoying.  I think you can burn some updates to disc, though.

Oh, and if you are looking for another awesome movie on Blu-Ray, Batman Begins totally delivers.  The picture is amazing, even though it’s a few years older.  Also, I know one thing people complain about is the price.  I never realized how high they were because I just always buy stuff online.  I did stop in Best Buy though and hardly everything was $30 or more.  Compare that to Amazon where it’s much cheaper.  Batman Begins for $18, TMNT for $19, Clone Wars $22, Kung Fu Panda $23, Sleeping Beauty $24, Wall-E $25.

One last thing (this is it, really), one other nice thing Blu-Ray has is that it actually supports 7.1 surround sound.  There are very few movies that support it right now (err … maybe not.  I fail), but it does beat the 5.1 surround sound limit that DVDs have, if you’re into the whole “let’s turn my living room into a jungle of speakers and wires” thing.

Good times.  I think I’ll go to Best Buy anyway.  Not wanting to wait beats out Amazon and low prices again.  Who would’ve guessed. :)

gpnl redesign

I sat down this morning and jotted down some notes as to what I want GPNL to cover.  One thing I realized is that one reason development has stalled is because my original goals of what it should do has always shifted.  The more features I want to pile on, the more it spins out of control, and makes it harder to do any one thing effectively.

So, I decided I want to keep it simple — I’m going to focus on having it just analyze the contents of ebuilds, and nothing else.  I’m not going to try and do anything fancy like dependency trees to see what’s puling in what.  I’ll let someone else figure that out.  I’m just going to import all relevant information about an ebuild, plus the actual contents itself to make it easy to search for strings across the board, and then display everything.

That, in itself, is actually really easy to accomplish.  Everything is already in the metadata cache, so I just have to parse it all which is also incredibly simple.  One of the things that made me go off on a tangent last time was that I realized that the metadata would tell what eclasses were inherited, which was one of the few things I hadn’t coded to figure out on my own.  With that, I kind of got dreams of all this cool stuff I could do, and instead didn’t really go anywhere.  And then I end up with stupid bugs like the database not even pulling in local use flags.  Gah.

So, that’s what I’m going to refocus on and *then* go from there once all that is taken care of.  I can’t remember off the top of my head any QA issues that could be checked for when you just have just the ebuild statistics, but then again, I can’t remember *any* of the QA stuff I originally wanted to check for when I started writing this thing, it’s been so long.

stats and direction

I briefly glanced over Donnie’s post on how to improve stuff in Gentoo, and while I can see how some ideas might stir up a bit of controversy, I kind of can agree and see things from a different angle.

I think that the real issue at hand is that we have a lot of people working on a project (for whatever reason they will), but we have no real idea of what areas are being heavily focused on, or which areas or are of real importance. I see one simple solution as keeping things the way they are (things work relatively fine), but laying onto the existing framework some tools to help us find out specifically what areas are getting neglected, which are getting showered with attention, and which ones could use some tender lovin’.

Sadly, two of my own projects which I’ve neglected due to time constraints and passing interest would help to quantify a lot of that stuff.

The reason that I think statistics will help is because we can see what is popular and what direction users are going, instead of developers assuming they know the trends.

Some things are pretty obvious — people will migrate to the most popular tools, for example, and everyone will rely on the basic system and desktop tools. It’s easy to place importance on those affected packages because, well, everyone uses them. The next question to be raised could be — what’s the second most important or popular area?

The problem is that there is a lot of packages out there, and they don’t carry the same weight. You can make arbitrary goals like “let’s get 90% of all bugs fixed in a timely manner,” but then you are putting every ebuild and package on the same playing field — they are all of equal importance and priority. It just doesn’t work out that way. It’s applying a statistical approach (low percentage of open bugs) to a practical problem (most important fixes first).

I could be really optimistic here, but again I just think we need some kind of data based on what users are installing, using, keywording, masking and ignoring to help shed light on what the second tier of problem areas are. By second tier I mean, “not the big packages.”

As a developer, I know it’s easy for me to shrug off fixing “small” packages because they may seem irrelevant, useless or unpopular, but that’s just looking at things through my point of view and experience. What tends to happen sometimes is I’ll see the application mentioned in other places, blogs, forums, IRC, whatever, and it’s status changes in my mind that perhaps there are people that are really using this thing and have an interest in it’s maintenance. That’s a pretty poor source of input that actually does decide how I determine what I’ll be working on next.

Anyway, I really don’t have any revolutionary ideas. In fact, it’s the same ones I’ve had before, and I just need a kick in the pants to get working on gathering data and compiling reports.

Also, I don’t want to toot my own horn or anything, but I just realized something interesting the other day. When I was first working on GPNL (Gentoo Packages that Need Lovin’), one of the first problem areas I highlighted was finding ebuilds that didn’t have any metadata.xml file attached with them. And there were quite a lot. I remember going through about 400 packages or so and adding them in there. What’s interesting is that the problem is completely non-existent now, and was actually eradicated rather quickly even then.

It’s small anecdotal evidence, I know, but I really do believe that small, easily fixed issues can be quickly snuffed out if exposed, tracked and indexed properly. There’s a lot of low hanging fruit out there to be picked.

next project

I’ve been thinking about what I want to work on next, since I’m actually finishing up a few things all at the same time.

All within the past little while, I’ve finished up three big projects, or at least come really close to where the status quo is gonna work out great. I got my new Mini ITX media frontend setup, and minus a few tweaks on the remote and configs, it’s good to go. I’ve been hacking on drip and dvd2mkv, my scripts to automate ripping and encoding both TV shows (drip) and movies (dvd2mkv). Oh, and I keep meaning to make mention of this, but I’ve given up trying to dream about getting those things in a “release” state. It’ll never happen. But if anyone is looking for a class to access a DVD through PHP, well, it’s all in SVN. And the third thing, crazy as it is, is that I’ve pretty much bought up all the DVDs (movies) that I’ve had on my wishlist for years. Again, there’s a few exceptions (like two) that can either wait or they are out of print so I’m waiting for the price to come down, but mostly … I’m done!

It’s been nice to go home and watch Buck Rogers in peace, and knowing everything just works, but now I’m wondering what I’m gonna work on next. And when I say next, I mean, which project am I going to finish that I’ve been putting off for so long.

The first one on my list is also the one that I’ve been putting off the longest by far: getting the last release of this scriptures database complete. I sat down this morning for a quick second and documented all the stuff I have left to do, and there’s really not much. Part of is verifying that the schema is correct on all the exports, and the rest is mostly just getting the documentation and changelogs written up. I don’t know why this release has been taking me so long. Some of it just seems a bit overwhelming. I tend to put a lot of pressure on myself to get this thing done right, because I really want it to look good and work without problems.

That shouldn’t take long though. Really, if I sat down, it’d take just a couple of hours to hammer out and get out the door. I still don’t know what’s next though. There’s a lot of Gentoo stuff I want to work on, but I’ve kind of been hovering for the past little while, not really committing to any one area. I’ve been trying to decide where I wanna focus my time on that, as well. There’s pretty much just two areas that I’ve kind of settled myself into: ebuilds and projects. Documentation used to be a third one, as I used to write a lot of stuff on the wiki, but now that it’s kind of gotten hit pretty hard, I lost interest in going back to it. I am, however, working on one official Gentoo doc right now, though I don’t want to promise anything since even that is going pretty slowly.

As far as the portage tree goes, I need to figure out what areas I wanna work on. I’m thinking about dropping out of the media-tv herd completely since I don’t even *record* TV anymore. It’s all about ripped DVDs these days. There’s still a lot of stuff I’d like to cleanup before I go though, and if I do stay on, it’d mostly be because I don’t wanna see stuff rot and be forgotten.

The projects, on the other hand, have always been something I’m interested in developing further. I’m talking about stuff like the packages website, GPNL, and the stats tracker. The packages frontend is about the only one I’m really satisfied with the way it is. All of them could use a lot of work though. GPNL hasn’t even come close to my original vision of what I’d like it to be. Part of the reason is because it’s just so hard to get metadata into the database, and it’s so time consuming to do trial runs and things that I’ve spent way more time writing scripts to collect data than analyze it. People keep asking me about the stats program, which I want to work on as well. The one that is currently online was really nothing more than a proof of concept to see if I could collect data remotely using shell tools, and how complex it would be. It turns out it was much simpler than I expected, so it’s given me a lot of ideas of where we could go with that. I think, though, that I probably won’t work on it until I get the other two finished up or at least advanced a bunch more though.

Also, a side note that just occurred to me. I don’t know about anyone else, but one thing that helps for me to get these things moving is knowing what kind of features people are interested in. I usually write these things so that I can fill a void — mine, to start with, but I’m always open to slapping on some useful features that I may not have thought of. Besides, it’s usually not hard once you have the base framework either. So, I need some ideas.

One last thing that’s been bugging me — I need to find a new domain name for this stuff. is too long to type. I can’t think of anything I like, either. Something short would be nice.

Ah, my, lots to do, and not sure of what to work on next.

media frontend

One thing I’ve been thinking about more and more lately, is that Myth is way overkill for what I’m using it for — effectively, just MythVideo and that’s it.

The only thing I use it for is a GUI interface to browse folders, display thumbnails of folders and files, and playback whatever I pick.

There’s gotta be something simpler out there, though I imagine I’ll probably just end up writing my own.

Now what’s a good easy GUI development library that wouldn’t be hard to learn?

new mini-itx

I spent part of the weekend setting up my new Mini-ITX and getting Gentoo on there. After so much time, I’d forgotten what a tedious task it is to setup a binary distro — there are so many small things to remember (like device nodes). Things are going well though, and everything so far is working without a hitch, except for some minor snags with X (Intel 945GC).

I ran into some problems because I originally used a stable tree with some really old drivers. DRI wouldn’t work at all, and it hated pretty much every resolution I threw at it. I just barely finished upgrading everything X-related to ~amd64 and so far it’s much smoother.

I’m working now on getting XvMC setup. It’s not a bare necessity, and it’s more of an attempt to see if I can get it done more than anything. I think I had it setup on my old VIA C7 with Unichrome before, but ended up ditching it because I couldn’t use any video filters. The same thing will probably happen here.

Technically, it’s working right now, but I’m not sure if everything is running correctly. The CPU will jump to ~30% on playback with MPlayer for an MPEG2 video, which is way too high. If it really is offloading the processing, it should be much closer to 3%. I’m not sure if MPlayer even supports it correctly, as the last time I tried it, nvidia was the only one it supported. I’m having some trouble finding some information about it, but I’ll keep plugging away.

One thing I did stumble on is that there is a bug in the mplayer ebuild (28058) where it is doing something wrong when building against libXvMC. The ebuild doesn’t work, but just unpacking the same tarball and configuring it with no arguments worked fine. I haven’t had time yet to investigate why, but I’m glad I found that. XvMC has always been one of those dark horses that I’m never sure what the status is. The whole thing could use some more documentation.

Anyway, aside from that minor issue, the only other problem I’ve run into is that the kernel doesn’t have a CPU frequency driver for my processor (Intel Atom 330). Everything else works great. The sound seems fine, though I haven’t really had a chance to test its quality yet. I’m still setting everything up, so it’s all hooked up to my desktop components still. I plugged it into my HDTV briefly just to verify that I could indeed get a fullframe X session, and that was about it.

I did have a nice surprise which was quite a bonus. I was doing some research on the CPU to see what it could do, and it turns out that it is 64-bit, not 32-bit as I originally assumed. I’d never even imagined that there were any 64-bit Mini-ITX boards out there, so it came as quite a shock to me. I had to rebuild the entire OS, but I didn’t mind. I actually let the Mini do most of the work, since it can handle the load by itself quite well. I still can’t get over the fact that this thing is fanless.

So, I’m almost there. Development has gone incredibly fast, especially compared to my last one. Getting a bigger hard drive made a nice difference, since I don’t have to worry about space anymore. I think it’s already up to 400 megs. I just need to finish getting some configuration stuff done, and then it should be ready to roll and then I can do some quality tests to see how nice the picture and audio really are. It’s a great little board, well worth the wait and and awesome deal considering the price. I can’t wait to put it into production. :)