AVI Reader

Authors: Michael Schmid and Daniel Marsh
Source: AVI_Reader.java
Installation: This plugin is built into ImageJ 1.41b or later. Supported AVI files can be opened using the File>Open command or by dragging and dropping on the "ImageJ" window.
Description: This plugin opens uncompressed 8-bit and 24-bit AVI movies as a stack. The latest version, by Michael Schmid, adds support for YUV formats, the ability to specify the starting and ending frame, an option to convert to 8-bit grayscale, an option to open the movie as a virtual stack, along with many bug fixes.

PC users can use the free VirtualDub program to uncompress AVI files. Macintosh users can use QuickTime Pro to convert QuickTime movies into uncompressed AVI movies. Note that AVI files with audio tracks may fail to open. Install the HandleExtraFileTypes plugin and you will be able to open AVI movies with a ".avi" extension using File/Open or by using drag and drop.

Another way to open an AVI movie in ImageJ is to use VirtualDub (Windows only) to convert it to an image sequence and then open the sequence using ImageJ's File/Import/Image Sequence command. To create a sequence in VirtualDub, use the File/Save image sequence command, set "Minimum number of digits in name" to 3 or more, and check "Windows BMP" as the "Output format".

On Windows, the Video Capture Tool macro can capture and display video using the VirtualDub program.

Limitations:
  • Only a few formats are supported:
    • Uncompressed 8 bit with palette (LUT)
    • Uncompressed 8 & 16 bit grayscale
    • Uncompressed 24 & 32 bit RGB (alpha channel ignored)
    • Uncompressed 32 bit AYUV (alpha channel ignored)
    • Various YUV 4:2:2 compressed formats
    • PNG or JPEG-encoded individual frames.
    • MJPG (motion-JPEG)
  • Does not read AVI formats with more than one frame per chunk
  • Palette changes during the video not supported
  • Out-of-sequence frames (sequence given by index) not supported
  • Different frame sizes in one file (rcFrame) not supported
  • Conversion of (A)YUV formats to grayscale is non-standard:
      All 255 levels are kept as in the input (i.e. the full dynamic range of data from a frame grabber is preserved). For standard behavior, use "Brightness&Contrast", Press "Set", enter "Min." 16, "Max." 235, and press "Apply".
History: 2002/07/11: First version
2002/07/16: Opens 8-bit movies faster
2002/10/02: Bug fixes
2004/07/18: Better "this is not an AVI" error message
2005/01/24: Open AVI files using File/Open or drag and drop
2005/02/14: Uses file name as window title instead of "stack"
2005/10/20: Opens 32-bit (ARGB) AVIs
2007/10/19: Fixed bug that could cause "Map size(0)>=1" error; fixed progress bar

2008/04/29:

  • Support for several other formats added, especially some YUV (also named YCbCr) formats
  • Uneven chunk sizes fixed
  • Negative biHeight fixed
  • Audio or second video stream don't cause a problem
  • Can read part of a file (specify start & end frame numbers)
  • Can convert YUV and RGB to grayscale (does not convert 8-bit with palette)
  • Can flip vertically
  • Can create a virtual stack
  • Added slice label: time of the frame in the movie
  • Added a public method 'getStack' that does not create an image window
  • More compact code, especially for reading the header (rewritten)
  • In the code, bitmapinfo items have their canonical names
2008-06-08:
  • Support for PNG and JPEG/MJPG encoded files added
  • Retrieves animation speed from image frame rate
  • Exception handling without multiple error messages
2008/07/07:
  • Adds support for 16-bit grayscale AVIs created by MIL (Matrox Imaging Library), thanks to a patch by Reinhard Mayr
2009/03/06:
  • Jesper Soendergaard Pedersen added support for extended (large) AVI files, also known as 'AVI 2.0' or 'OpenDML 1.02 AVI file format extension'
  • With virtual stacks, reads the 'AVI 2.0' index (indx and ix00 tags).
  • Fixes a bug where too many frames are read.
2011/12/03:
  • Minor updates & cleanup for integration into ImageJ.
  • Multithread-compliant.
2011/12/10:
  • Based on a plugin by Jesper Soendergaard Pedersen, also reads the 'idx1' index of AVI 1 files, speeding up initial reading of virtual stacks also for smaller files.
  • When the first frame to read is > 1, uses the index to quickly skip the initial frames.
  • Creates a unique window name.
  • Opens MJPG files that do not contain Huffman tables.
See Also: AVI Writer plugin
Video Capture Tool macro

|Plugins | Home |