Le Ralf, The Blog
All | Moods | Prog | Rants | Android | Projects | Trackday
Most recent entry: 2009-09-17 20:00:00 -- Generated on 2011-07-24 21:11:26 by Rig3 0.4-456
2009/09/17 TrackVideo Generator
π 2009-09-17 20:00 by Ralf in Projects
Last time I used Trackmaster on an Android phone and recorded some tracks and lap times. Trackmaster also recorded lots of useful info like speed acceleration, sampled roughly every second for each session.

Since I had also recorded some video of my track sessions, I decided to write a little piece of software to generate an overlay to put on top of my video.

At first I thought I'd do a plugin for Sony Vegas Platinium, the software I use to edit the track video. The only thing I found was how to create "generator plugins", which sounded fine. Finding the SDK and the information for it was moderately easy. However the plugin architecture uses a deprecated feature of DirectX. It's hard to find the relevant SDK bits (TODO: fish some links and update this). In the end I kind of made it work but then I never managed to get the generator receive a proper time field, and it was all in COM under my old Visual Studio 2005. I guess I could have used GDI+ to render the graphics or something and then generate the bitmap for the generator but it all sounded like more work than I was willing to put in it.

So I gave up and decided to write a standalone piece of software that would generate a movie file, and then use Vegas to overlay it. I considered both Java and C# and in both case I had a hard time finding a good library to generate movies -- you'd think MS would support a managed version of Windows Media Framework but no... Moving on, I finally found a simple managed wrapper on top of the AVI file API that does the job and used that.

It's in C# using C# Express and .Net 3.5, so anyone with Windows can reuse it. There's no DirectX or WMF used, so I'd hope it would work under wine for other platforms.

Bottom line is that after spending most of my time finding the right tools and libs, I did quickly get something working:

The projects lives at http://trackvideo.googlecode.com .

It's quite primitive yet, I need to add things like a preview, some docs on the internals, there are things to refactor in the code, etc. I also need to make it more configurable since right now most things are hard-coded in the source. Oh and I need to have a fancier output. But at least it's a good foundation.

Let's be clear: my goal is to make something that's good for me out of the box, yet reasonably configurable by others. And contributions will be welcome.


More pages: September 2009