toxi.in.process

Wednesday, April 26, 2006

JMF based video capture (teaser post)

I've got an imminent deadline for a prototype of my 1st serious camera tracking project and I just can't seem get QT4Java to play nicely (make that "consistently") on my dev machine. Sometimes it works. More than often it does not...

Yesterday I wasted almost a full day with (un/re)installing various versions of QT and WinVDIG, reading and hacking - then decided to throw in the towel and try my luck with the Java Media Framework to get a camera feed into my app...

Another 12 hours later, after wading through Sun's JMF docs and various failed experiments, writing and merging little demos scavenged from across the web, I've got it working: Me waving back at myself in B&W on screen as JMF captured (and processable) video with Processing.

Disclaimers (and hence the "teaser" subtitle):

  • So far only working under Eclipse

  • JMF only exists for Windows and Linux (no OSX, sorry Robert!)

I've done some preliminary speed tests with a 640x480 window size and my Philips ToUCam Pro capturing at 320x240 @ 15fps:

P2D (default renderer) 44fps average
P3D 52fps average
(*both fps counts over 1 minute) - I'm not sure if/how much this is faster than the default QT4Java solution...

Next steps are obviously to wrap this up in a library, but this probably won't be anytime until end of May since I want to do it properly. I might publish the existing code earlier, but it's currently using an Java interface mechanism for callbacks and so will only work outside the P5 IDE (e.g. in Eclipse)... watch this space!