[ome-devel] Empty frames in AVI recording makes Bio-Formats crash

Simon Blanchoud simon.blanchoud at otago.ac.nz
Thu Apr 23 00:34:58 BST 2015


Hi all,

I'm now working with a Leica stereomicroscope which produces AVI recordings (using the "Movie" functionality). These recordings cannot be read by the Bio-Formats (I've uploaded a sample recording using your QA platform), and, as a matter of fact, cannot be read by many readers properly.

Anyhow, I decided to convert it into a more standard AVI using FFMPEG using the following command:
ffmpeg -y -i M-flow1.avi -qscale:v 1 -c:v mjpeg M-flow1_1.avi

Which gives also the following information on the two video streams:
Input #0, avi, from 'M-flow1.avi':
     Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p(pc,
bt470bg/unknown/unknown), 544x408, 8203 kb/s, 100 fps, 100 tbr, 100 tbn,
100 tbc
Output #0, avi, to 'M-flow1_1.avi':
     ISFT            : Lavf56.25.101
     Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p(pc),
544x408, q=2-31, 200 kb/s, 100 fps, 100 tbn, 100 tbc

Now for the more interesting part. Turns out this file can be read nicely using the ImageJ plugin, however when I try to convert it into OME-TIFF using the command-line tools :
./bfconvert -separate M-flow1_1.avi M-flow1_1.ome.tiff

It crashes (String index out of bound). Turns out, 2 out of 3 frames are completely empty (i.e. not key frames I guess), which causes an issue in l. 438 of bioformats/components/formats-bsd/src/loci/formats/in/AVIReader.java :
String(plane, 6, 4, Constants.ENCODING).equals("AVI1") as plane is empty.

After looking around a bit, I have noticed two things:
  1. If the test for M-JPEG is carried-over between frames, the empty
frame will then cause another bug later on in the FileStitcher
  2. The conversion seems to work completely fine if the 0-length frame is skipped in l. 777 of AVIReader.java :
if (size > 0 || bmpCompression != 0) {
  i.e. effectively removing the bmpCompression part of the test.

However, I'm pretty sure that this test was there for a reason, and I clearly do not understand enough of JPEG compression to have a better insight on this topic.

I'm working on a Mac OS X 10.10.2 with the latest Bio-Formats from the GitHub repository (from Tue Apr 21 09:49:45 2015 -0500) and the FFMPEG 2.6 build with Apple LLVM version 6.0.

If you are interested, I can provide you with the aforementioned files.

Cheers,
Simon Blanchoud

PS: this is not extremely important for me as I now convert instead the AVI to a sequence of TIFF files directly using FFMPEG, and then stitch them back together into an OME-TIFF using Bio-Formats. But I thought you might be interested in that wee bug !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20150422/631ea39a/attachment.html>


More information about the ome-devel mailing list