MovieIO - A Simple Video Library for ImageJ

Author: Wilhelm Burger (wilbur@ieee.org)
History: 2006/11/20: Initial version (unpublished)
2008/07/06: Several changes. Added documentation test plugin for QuickTime (QT_Test.java)
2010/04/16: Small fixes. Tested with new versions of JMF and QuickTime
Requires:

QuickTime, QuickTime for Java OR Java Media Framework (JMF).
Tested under Windows with ImageJ 1.43n, Java 1.6.0_17, QuickTime 7.6.6 and JMF 2.1.1e

Source: MovieIO.zip (available at http://staff.fh-hagenberg.at/burger/imagej/)
Limitations:

This is code aims at ImageJ plugin developers and is for demonstration only. Not all codecs work with all quality settings (must experiment!). QuickTime generally shows the higher reliability and better performance. It is thus recommended over JMF. This library is currently only tested under Windows XP (32 bit).

Installation: Download MovieIO.zip and expand to the plugins folder.
Description:

This software can be used to read and write video files frame-by-frame under the control of a simple loop, using a single ImageProcessor object. No callbacks or events are used. The library does not rely on stacks and thus has only modest memory requirements. Videos of arbitrary length (even HD formats) can be processed. Here is a typical code sequence to illustrate how a video file is read and processed frame by frame:

String path = "AppleQtSample.mov";
MovieReader mr = QtMovieReader.openMovie(path);
ImageProcessor ip = mr.createImageProcessor();
int frame;
while ((frame = mr.getNextFrame(ip)) >= 0) {
  //process and/or display the frame contained in ip ...
}
mr.close();

The library is implemented in 2 versions - JMF and QuickTime -, which can be used alternatively or together. If only one version is used, the other package can be easily removed. The following installation details are assumed:

  • <ImageJ> is ImageJ's root (installation) directory
  • QuickTime is installed (part of Apple's iTunes)
  • JMF is installed.

The following Java class libraries (jar/zip files) are required:

The library consists of three packages:

  • movieio: common components
  • movieio.jmf: JMF implementation
  • movieio.qt: QuickTime implementation

The following video formats (VideoOutputFormat) appear to work for writing videos (default file extension for AVI is "avi" and for QT is "mov"). The results were inspected using Microsoft's Media Player and Apple's QuickTime Player, respectively. Only a limited (tested) set of file format and codec combinations are supported. They can be specified using the enumeration constants listed below to avoid runtime errors caused by unsupported formats.

With JMF (see file JMFVideoOutputFormat.java):

AVI_RGB
AVI_H263
AVI_INDEO32
AVI_INDEO41
AVI_INDEO50
AVI_CINEPAK
QT_RGB
QT_MJPG
QT_H263

With QuickTime (see file QtVideoOutputFormat.java):

QT_RGB *
QT_YUV *
QT_RLE *
QT_BMP
QT_SORENSON
QT_SORENSON3
QT_CINEPAK
QT_JPG *
QT_MJPG *
QT_MJPGA
QT_MJPGB
QT_H261
QT_H263
QT_DVCPAL
QT_DVCNTSC
QT_MPEG4

* recommended formats

Demos:

ImageJ plugins:

Testing:
      JMF_Test.java: IJ plugin for testing the JMF installation.
      QT_Test.java: IJ plugin for testing the Quicktime installation.

Opening (reading and processing) videos frame by frame:
      JMF_MovieReaderDemo.java
      QT_MovieReaderDemo.java <--- preferred!

Writing videos frame by frame (PlugIn creating a random RGB image):
      JMF_MovieWriterDemo.java
      QT_MovieWriterDemo.java <--- preferred!

Writing movies frame by frame (PluginFilter dumping the current RGB image):
      JMF_MovieWriterFromImage.java
      QT_MovieWriterInteractive.java <--- preferred! (interactive version)

Reading and writing simultaneously (transcoding)
      QT_MovieTranscodeDemo.java

See Also:

Java Media Framework
Apple QuickTime / iTunes / QuickTime for Java:
     http://developer.apple.com/Java/Reference/1.4/Java14API_QTJ/
     http://developer.apple.com/mac/library/documentation/QuickTime/RM/MovieBasics/MTEditing/A-Intro/1Introduction.html
      O'REILLY - "QuickTime for Java: A Developer's Notebook"
      QuickTime Movie Opener
      QuickTime Movie Writer
      QuickTime Movie Player

|Plugins | Home |