Monthly Archives: June 2009

what i'm working on

I figure it’s time for another post that details just what I’ve been poking at recently.  Work has been really busy for me, and I’ve got a lot going on at home to, so I’ve been bordering on burned out for the last month, but somehow I’m still chugging along.  If anything, that explains the half-coherent posts I’ve been spilling out lately … they are more afterthoughts of notes rather than good posts.  Ah, well.  I figure at times it’s better to just get something documented at all.

So, in no particular order, here’s what I’m poking at:

mplayer-resume v1.8

I just finished coding this yesterday.  I’ve had 1.7 done for a long, long time and meant to push it into the tree, but never got around to it.  This version adds a feature that everyone I’ve heard from complains about — getting it to accept filenames with spaces in them.  I added a –filename option that you can pass to it, so there’s absolutely no confusion or guess work about what it should be.  There’s a few other things in there, but I’ll write that up in the changelog when I’m done.  I just have to rewrite half the documentation and package it and then I’ll be done.

trip

I don’t *think* I’ve made any mention of this yet, which is actually really surprising, because it’s a few tweaks away from being distributable.  trip is basically “tivo ripper” (original, I know), a little shell script that has a CLI frontend that will let you sync your list of files on your Tivo, pick which series and shows to download, then strips the DRM from them using tivodecode and leaves you with a happy MPEG2 video that you can do whatever the heck you want with.

I’m debating putting this one in the tree or not.  I realized that mplayer-resume is just a really tiny shell script, and it probably shouldn’t have gone in the tree to start with … but oh well.  I don’t really think I should pull it out now.

There’s no timeline on pushing this one out, though.  It’s mostly done, but I don’t really feel like packaging it.  If someone wants a copy though, drop me an email and I’ll send you a tarball.

drip

drip is my console interface for ripping all my TV shows, that I’ve been working on and off for years.  This thing is a total mess and a packaged release will probably never see the light of day — not because the code is crappy, but because there are so many complexities to it, way too many options for customizing it that I’d have to support, and such an incredibly small audience of people that would want it either.  As such, it works great for me.  Basically what I do is I first archive my discs.  I’ll grab all the relevant disc info I can just by reading the DVD (disc id, disc title, tracks, chapters and lengths), then I have a web frontend where I specify what I just archived (episode names, which tracks to ignore, which are bad, etc.) and then I use the console app to rip the episodes to the harddrive, and mux them into Matroska with all the relevant metadata stored in the database by the frontend.  It works really great.  Maybe I’ll add some screenshots sometime.

Anyway, I’ve been working on that for a variety of reasons.  The first is that now that I’ve got ffmpeg reading Matroska metadata and hacked mplayer to pull it back out, when I actually mux the episodes, I have drip create the XML file of the global tags.

The other thing is that I’ve started looking more closely at specifying exactly which season an episode is on.  What happens is that DVD sets released as a complete series, it’s pretty common for one disc to have the end of one season and the start of another.  I’ve always had drip setup assuming that one disc would only hold the same season all the way throughout, so I’m having to once again cast aside my old assumptions and fix half the database schema.  That’s a bit of an undertaking, and I’m putting it off right now.

gentoo stuff

Gentoo is keeping me busy as well, though I haven’t been doing as much as I’d like to, mostly because of all my little projects keeping me busy.  In fact, just in writing this, I keep thinking of more I need to add to this list.

I have gotten the bug again to work on finishing the rewrite of importing the portage tree into postgres.  That whole project is unnamed, but it’s basically the backend to my packages website and GPNL.

Every single time I open this thing up and start hacking on it again, I’m totally blown away by how much faster and more efficient it is.  When I first started on the rewrite, I really picked a much cleaner design implementation, for the code and the database, and it is just so much easier to hack on.  The first one was a total stumbling of the dark that I was coding while I was researching what I could do, and it is just a nasty mess.  This one, the format has been specific from day one, and it’s a total breeze working on it.  I can’t wait to get it done.  I know I’ve said this a lot, but once it’s finished, up and running, it will be soooo much more  portable, and able to handle a lot more stuff.  I’ve already got a few ideas planned on what to do with it once it’s ready to go, but I’m keeping them under wraps.  I’m really excited for it though.

mini-itx madness

I haven’t said a peep about the new Zotac I got.  Initial review is very positive, though.  I want to be fair and not write about it right after I got it, instead putting it through the paces for a few weeks, after the novelty has worn off.

It’s working fine though, and one thing I want to do is setup the image on a USB stick.  No more onboard SSD IDE drives.  That would be really nice, since a USB drive would be so much easier to update since I could pull it out easily of the clients.

my qt media gui

Yet another unnamed project … not that I really have anything to show for it anyway.  But basically as I’m learning Qt / C++, I’ve decided to just take the basic elements from MythVideo and write my own frontend to my media library.  That’s coming along.  Still learning a lot.

seekrit projects

I’ve got two things in the works that I’m really excited about, totally unrelated to everything mentioned above, but I don’t wanna say anything about them.  I’ve decided I’m not going to unveil them until they’re done this time.  Yeehaw. :)

Alright, that’s enough for now.  Back to work.

1 Comment

Filed under Computers

mplayer and matroska metadata, part two

Man, what a week it has been.  I have been plugging away at a lot of stuff, and the bug to get my whole media setup tweaked even more has really bit me bad.  I’ve been working on nothing but for a while.

The coolest thing is that two of my patches got submitted upstream, one for mplayer, and one for ffmpeg.  In both cases, they needed to be changed a bit, but I’m still happy with the results.  The ffmpeg one was the patch I wrote about previously, to have the LAVF demuxer pull out all the metadata that’s in the Matroska container.  That’s in there as of revision 19184.  Thanks, aurel. :)

There’s no way currently of cleanly pulling it out of MPlayer for display, though my hack works just fine.  The demuxer for mplayer needs a new function to iterate through all the metadata that’s available, and add it to the demuxer info.  Currently, it’s only pulling out a few named keys specifically.

Here’s a screenshot of how it looks where I’m pulling it out, in this case I’m just using it as an OSD menu screen display.

The actual documentation on how to access the OSD menus and work them is pretty non-existent.  I’ll try and write some up and get it submitted when I get a chance.  In the meantime, if you want to see what my menu configuration looks like, have at it.  I haven’t cleaned it up at all.

Leave a comment

Filed under Matroska, MPlayer

mplayer and matroska metadata

I’ve been playing with Matroska in general a lot more, seeing what I can do, and in the past week and a half, I’ve found some really cool things. I’m completely braindead after staring at the mplayer code all day, so if I come across a little confusing, now you know why. It’s one of those instances where I wanna get this documented though, if nothing else than for a small marker of a pretty big milestone for me. :)

I’m too tired to lay this down in story format, so I’m just gonna dump it out best I can.

The other week, I noticed that a new version of mkvtoolnix had come out (the tool to mux audio/video files into the Matroska container), and it totally flew under my radar. I started playing with it, and noticed some real improvements in speed, with regards to parsing MPEG-2 video. After playing around a bit, I started reading some more of the documentation, and found out about this excellent tagging system that the specification declares.

You can read all the gory details about it here, but basically, when building a Matroska file, you can create an XML file that has global tags that can store pretty much every metadata tag I could ever dream of possibly wanting.

I never really had the itch to pack much metadata into the container up until this time, when I realized just how much factual data I could stuff in there and not depend on the database for. Pretty much the only thing I really cared about was the title. In fact, all I wanted originally was to be able to get MPlayer to display the metadata title that was in the file.

Going off on a tangent here, I poked an open bug I have on MPlayer’s bugzilla, and Reimar, an mplayer dev, was kind enough to oblige me once more and updated the code so that I could pull it out. If you’re using a recent snapshot (for Gentoo, the 20090530 one has it), you can pull it out using “get_property metadata/title” in slave mode. If you wanted to display it on-screen, you would map a keypress event or LIRC event to this: osd_show_property_text “${metadata/title}”. Quotes and all.

Anyway, Reimar added that in for me (thanks, man), so I started poking around with mplayer’s features to see what else it could pull out for me. Now that I was going to be storing lots more data in the container, I wanted to be able to pull it out, too.

Jump forward a bit to today, where I woke up this morning and was determined to get it out somehow. My original plan that I had decided on was, since I can’t really hack on C code, to just work around the limitation by using a fifo for mplayer. I’ll spare you the ugly details, but basically I was going to have an event send a command to an external script that would query the .mkv file for the metadata tag I requested, and send a command back through the pipe to print that out to the screen. Quite a run around.

Well, I’ve tried before to grep the code of mplayer a bit to see if I could wrap my head around the stuff and see if I could figure it out for myself, but it hasn’t worked out real well. I decided to give it another whirl today, though. This time, however, my approach was a little bit different. Normally I would just search for keywords where I *think* mplayer would be doing what I would think it was doing, tinker with the code, recompile it, run it, and see what it does. A really slow process, but sometimes it works. And I really don’t mind spending the time on it, either.

This time, I did things a little bit differently. I found a file where I was sure that it was accessing matroska metadata, and I read the entire thing, and took copious notes, explaining to myself the whole time, basically what I thought the purpose of each major element was, trying to figure out the pattern to this. Now, bear in mind, that I’m still learning some C++ myself, and the C syntax is pretty similar (in fact … I still can hardly tell the difference, myself), so a lot of times I have a vague understanding of what it *might* be doing, but never enough to be sure … so there is still a lot of guesswork involved.

Anyway, after about 10 hours of going back and forth, making notes, testing code, printing out functions and variables and metadata, I got it figured out. And the final patch is something like 2 lines long, heh. All I did was add one if statement. But, that was enough to get me going, and it solved a nagging issue for me. But, what is far more valuable, is the fact that I’ve learned how I can go into this code and figure out how to fix things myself. That’s gonna really come in handy. I’m sure I won’t be submitting patches upstream anytime soon, but if I can get what I want hacked in there, and working, I’ll be happy as a clam.

For the record, the problem with the metadata was this: MPlayer has a single key=value pair that it assigns to metadata values with it is parsing it with the libavformat demuxer. That is normally well and good, except in the case of Matroska, the tags can be nested with similar names.

So, for example, say you have two target tags in your matroska container: Collection and Episode. If it were a TV show, let’s say it’s CHiPs. Great show, btw. Now, in the tagging specification, both of them can have a title. The title for the collection would be CHiPs. If you had a Matroska A/V file that was just one episode, then the title for that would be “Ponch Delivers A Baby on the Disco Floor” or whatever (which really does happen, I kid you not). They key for both of those would be “title”, but the values would be different. The LAVF demuxer just overwrites the old value and assigns it to whatever comes last. Kind of a problem.

So all I did was told the demuxer to prefix the key names with whatever the name of the target tag was (Collection, Season, Episode, etc.). That way you can have distinct key value pairs, but they are just more verbose. The metadata property names now are metadata/collection/title instead of metadata/title. Pretty simple, really.

That was the easy part. The second part, I haven’t figured out yet — how to get it out. The metadata is all in a separate object created by the LAVF demuxer, which I don’t know enough C to figure out how to access that outside of that class. So, I just hacked it to add it to the metadata myself in a rather ugly, but working fashion. Upstream probably wouldn’t be interested in that patch.

Another hard day’s work, and I’m still not done. And I’ve got a lot more to write about it, so I’ll just stop here for now. I’m gonna go port the patches to my frontends. :)

Edit: For reference, the clean version of the patch, a sample XML file of what I would mux in with an episode, and the ugly hack I personally am using to get it all out where my lack of C knowledge is very much publicly exposed.  Note that you have to use -demuxer lavf with mplayer for it to work.

4 Comments

Filed under Matroska, MPlayer

another new motherboard

Well, I finally picked something.  Huzzah!  Now I can move on with my life, now that indecision is out of the way.  I’m going to explain my thought process a bit in choosing this one, which has been known to fry the brains of many friends, so consider yourself warned.

I’ve been trying to pick out a motherboard again, and I came to a few decisions and realizations.  For one, I just need a simple replacement for the previous motherboard that totally crapped out on me, and I only want some basic playback features for standard-definition DVDs.  I also was not going to settle for anything but an Nvidia video card, so that already eliminated a lot of possibilities.  Basically I made a list of things I would like to have, and would use, right now, and then a list of things I would like to have sometime.

The list of things now was pretty simple and sweet: VGA (my TV has a port, I could use HDMI, but meh … who cares … then I’d have a free port that only a computer can use), 10/100 Ethernet, quiet, standard-def playback, IDE port and stereo sound (I never run stuff to my receiver, even when I could … besides that, I never watch movies on the HTPC, just TV shows).  The list of stuff I would want for the next-gen one, the future-proof edition as I like to call it, has this list of stuff: VGA + DVI or HDMI, Gigabit and/or Wifi (I might use powerline networking too, haven’t decided yet), fanless CPU, HD capable playback — which means at least a GeForce 8300, and both optical and coaxial SPDIF, because I can never decide which one I want to use (starting to notice a pattern yet?).

I threw the whole fanless thing out the window, for one simple reason — I decided there’s no way for me to pick between which one I think I’m gonna like better, so I’ll just buy both.  Heh, that’s one way to deal with indecision.  Actually, there weren’t any fanless options except for the new Zotac ION-ITX boards, which just came out, and *nobody* has them in stock.  So, I couldn’t really buy one even if I wanted to right now.  Aside from that, though, I don’t like the idea of buying the very latest hardware, especially when it’s a new chipset thats just come out (Nvidia ION).  Not that I don’t think it would be exactly what I would need, it’s just that when you factor in my luck with a new design, things tend to go south pretty often.  I have the kiss of death when it comes to hardware.

So, I just did what I always do after weeks of research and comparison — I just kinda picked one at random that looked good, and could get here fast.  Works for me!  Actually, I’ve done a lot of looking at all the boards I was considering, so I’m pretty confident it will work out.  Specifically, the one I got was a Zotac NF6301-D-E Mini-ITX.  It’s not as powerful as similar stuff, and I could have gotten one with a lot less features, but I decided to at least make sure it has DVI on there, just in case.  Compared to my must have in the future list, it’s obviously pretty barebones.  I got a pretty low-powered CPU for it as well, an Intel Celeron 430 Conroe-L 1.8 GHz that only runs at 35W.  That may seem way too under-powered, but consider that on my VIA Mini-ITX I’m already watching SD with (pretty much) no problems at 400 MHz.  Whee!  So, yah, I’m not worried about speed.  For the fan, I got a Silverstone NT07-775, which is small enough to fit inside my case.  I guess we’ll see how it works.  I’m betting that the CPU will run slow enough and cool enough that it won’t generate a lot of noise.

I should get all the parts by Tuesday, so I’ll know by then how it’s all gonna work out. :)

1 Comment

Filed under Hardware

another new htpc mini-itx

I’m having a hard time deciding what to do to get my replacement Mini-ITX board for my HDTV.  I’m hoping that if I do a bit of a braindump, it might help me sort things out, and soliciting outside opinions wouldn’t hurt either.

The basic story is that, last time I bought a Mini, I did a lot of research on the VIA C7 boards and had a good one picked out, but at the last second changed my mind to get an MSI instead with an Intel Atom 330 (dual-core 1.6ghz with hypertheading).  I just saw all the fancy CPU features and went ga-ga, and ignoring it being from MSI, I picked that one.

I made a lot of assumptions with this board, and I’ve had a lot of problems since.  I won’t go into the details here, since that’s boring, and I’ve already covered it.

Now then, I’m looking at options for replacments, and it’s basically come down to two contenders: a Zotac Nvidia ION chipset with an Intel Atom, or another Zotac Mini-ITX board without an integrated CPU.

For reference, here’s the two boards I’m looking at: Zotac GF9300-D-E and Zotac IONITX-C-U.

As far as specs go, they are nearly exactly identical.  The only real differences is that the ION has a PCI-Express Mini slot, while the other has a regular one.  But aside from that, they both have onboard Nvidia graphics chipsets (ION: 9400M, GF9300-D-E: 9300M), so using VDPAU isn’t going to be a problem.

The difference I’m looking at is that one is fanless (the IONs all are) and the other isn’t.  Now, generally speaking, I hate background noise.  I sometimes can’t filter it out when I’m trying to pay close attention to something, as in watching TV or a movie, which is where this thing would be.  So having a fanless HTPC would be a top priority, but if it’s going to overheat with the Intel Atom, then I don’t want to risk it.

The alternative is to get the 9300M Mini, and put a low-powered Celeron in there with a quiet fan and hope for the best.  That CPU would come with speedstepping so I could throttle it down to pretty low.  My VIA at home runs at 800 mhz all the time and does perfectly fine for standard-definition playback, which is what my entire library is in now.  I’m guessing (and this is where problems start to form) that if I throttle it low enough, and it’s already a slow processor to start with, that the fan won’t be kicking into high gear much and it’ll be easier to ignore.

On the flipside, the argument for the Intel Atom is that, if I get one of the IONs with the Atom 230 instead of the 330, then it would run less hot to start with.  My MSI Mini-ITX at home is a 330 and is both a dual-core 64-bit and has hyperthreading.  Both the 230 and the 330 have hyperthreading, and run at 1.6 ghz on the ION, but only the 330 is dual-core.

I really can’t decide which one I should get, and have been bouncing back and forth between the two options for a while now.  Frankly, it’s driving me a little insane.  On one hand, I’m betting that the fan won’t be loud, and on the other, I’m hoping the CPU won’t run too hot and burn things out.  It’s a gamble either way.  Right now I’m leaning towards getting the 9300.  I figure I’d have more options with picking my own CPU and fan and being able to throttle it myself.

8 Comments

Filed under Hardware