What about Movies?
In the latest days I've writing some code to investigate about how hard or easy would be to extend blueMarine capabilities to manage movies in addition to photos.
While my personal interest and volunteering efforts about blueMarine are primarily photo-oriented (I'm really a still photographer!), some modules are involved in my business and a customer asked me about movies for a digital asset management application. So I did some preliminary investigation work.
A first part of the work consisted in just a big refactoring of blueMarine for a better design. In a few words, while up to a few weeks ago the "Photo" module, with its main class
PhotoDataObject, was a central point in blueMarine (e.g. with the Thumbnail, Gallery and Trip modules depending on it), a good IoC refactoring made it possible to have everything depending on the pure
DataObject (which is a NetBeans API class).
PhotoDataObject is now just an extension that other modules aren't aware of (with the exception of a few remaining portions that will be fixed soon), so at the moment blueMarine can manage every kind of datum for which the creation of a thumbnail has a meaning. This of course include movies.
The problem is now about what Java offers in this field. Chris Adamson and Chet Haase blogged in the last months about this topic (1, 2, 3). While I invite you to look at their posts for more details, the conclusion is that at the moment Java is severely lacking a working API for movies. The Java Media Framework (JMF) had a bad fate and is considered dead. Other "branded" APIs, such as QuickTime for Java, are going to die since Apple's attitude towards Java seems oriented to just support the standard platform and nothing more. As you can read in Chet's blog, Sun is working to recover, but no earlier than Java 7, which is two years from now and not an option for me.
Chris' conclusion is to look at existing native libraries (such as ffmpeg or GStreamer) and use a Java wrapper around them (this is only a part of Chris' conclusion, the part which is relevant for me).
Searching around, I've found Ken Larson's FMJ project, which sounds to be directed in that way. Ken's work - for what I've understood after a very quick inspection - includes an implementation of the JMF specs together with wrappers for some existing libraries, including ffmpeg, QuickTime and others. In the end its
Player implementation, with some cut and paste from the examples code, allowed me to quickly create a "MovieViewer" module which is the analog component of the "PhotoViewer": it can reproduce movies inside blueMarine (with some troubles still, for instance getting a strong blue cast in the image, which is probably related so some configuration problem on my Mac).
Of course this is not enough. Merely for cataloguing purposes, I need the capability of extracting still frames out of a movie, so I can build a thumbnail. Emmanuele's work with blueMoon, the plugin for astrophotographers, also needs the extraction of still frames; furthermore my personal still photos interests are expanding to "time-lapse photography", a technique about creating a movie out of a sequence of still photos taken at regular time intervals (see Thomas Kranzle's awesome work for an example).
For these reasons I've sketched out some experimental blueMarine modules (azureRiver) and a stand-alone library (Zephyr) which could be thought of as a Mistral extension for movies. The idea here is to wrap every existing API I need with a simplified interface. For instance, as Mistral allows to load, crop and compute the histogram of an image in just four lines of code:
EditableImage image = EditableImage.create(new ReadOp(new File("20030701-0043.NEF")));
image.execute(new CropOp(10, 10, 600, 400));
Histogram histogram = image.execute(new HistogramOp()).getHistogram();
Zephyr allows to extract still frames from movies as easily as:
EditableMovie editableMovie = EditableMovie.create(new File("mymovie.mov"));
EditableImage image = editableMovie.execute(new GrabFrameOp(1)).getFrame();
While in all my previous posts I published some more polished code, Zephyr is just the first step after the idea (in details: it's badly coded, it is only based on ffmpeg-Java, I've included only the Mac OS X Intel native library, etc...). My point is that I'd like to know what is other people's interest about this. While I'm strongly committed with Mistral and the still-photo parts of blueMarine, Zephyr is only focused to my current customer's interest - and he has still to decide, also basing on my investigation, if this thing should be really started or not. If some reader would like to join and take a primary role in this stuff, Zephyr could take off even if my customer decides for a "no-go". So I hope to get some feedback to this post!
PS If you would like to look at the code, point your Subversion client to https://azureriver.dev.java.net/svn/azureriver/trunk/src. If you would like to try the thing, download blueMarine 0.9.RC1, use the Plugin Manager to add the following Update Centers:
and download the stuff from them. Remember that thumbnail generation only works on Mac OS X Intel at the moment; the movie player could work also with other platforms (but I've tried it only with Mac OS X).