Random Hacking: Windows Media Encoder and DirectShow
I’m a big fan of Vista Media Center, and a really big part of that is the fact that I can use an XBOX 360 as a really-nice media center extender. When learned that the fall update contained support for MPEG4 Advanced Simple Profile (that’s DivX to you and me!) in AVI’s I was quite ecstatic. I went out and bought a second Xbox360, and put it in the kid’s playroom… then I found out that meant thru the Dashboard…
I never use the Dashboard to play videos… I always do so from Media Center. Over the years, I have archived a bunch of shows in DivX format, so that my kids can watch their shows over and over again. I didn’t really want to go through the exercise of teaching my 5 yr old how to use the Dashboard, since she’s already a Media Center expert, and I certainly didn’t want to bother with setting up WMP to play the videos.
So, I thought, for what has got to be the 100th time, should I convert my videos to WMV? I’ve tried this in the past, and always ran up against one or more issues. Primarily, most of the tools for WMV encoding are designed to be interactive. Or they suck. Or Both.
So, last weekend I resurrected some batch file code I was using to play around with the Windows Media Encoder, along with the latest WMCMD.VBS and a handful of other tools, and cranked out a nice little script that strings together them all so that I could trans-code a bunch of them in a row.
After working through an interesting bug in the VBScript (the results of which are an upcoming post ), and managing to finally get past my problems with 5.1 audio, and the result was pretty darned good. As a matter of fact, it was *really* good.
…Which got me even more interested in making a tool that I could use without any interactivity at all, and use it to make all my videos in WMV.
So, even though my little batch solution worked pretty good, I started to work on a new tool in g# (a nifty little .NET-based script language I’m working on)… and found out that accessing some of the COM interfaces for DirectShow isn’t exactly a walk in the park.. Ah, so be it, I went to C#, and cranked out a tool that generated the .NET bindings for the COM interfaces the way I wanted them.
Having done all that, I’m reminds me of somethin’ my pappy told me… "There are three kinds of men: The ones that learn by reading. The few who learn by observation. The rest of them have to pee on the electric fence." Well, I think I ended up in the last category, but at least I learned somethin’… there’s a reason why there isn’t a lot of examples of DirectShow in .NET… but more on *that* on an upcoming post.
Anyway, so I’m now deep into crankin’ out a little automated trans-coder, in .NET, and when it’s done, I’ll see if I can post it on Codeplex, along with the source.
Y’all might be wonderin’, what in the name of creation I’m doin’ ramblin’ around today. Well, I dunno… just thought someone would like to know.