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

Melissa Linkert melissa at glencoesoftware.com
Mon Apr 27 18:55:12 BST 2015


Hi Simon,

> 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.

Thank you very much for the detailed report, and my apologies for the
delay.  I was able to reproduce the same error by running the above
ffmpeg command on the .avi file that you had previously submitted.

We are reviewing a fix for this now:

http://github.com/openmicroscopy/bioformats/pull/1762

which duplicates the previous frame any time an empty frame is
encountered.  This preserves the correct frame count and seems to match
the behavior of other software.

I would expect that fix to be included in the 5.1.2 release of
Bio-Formats.

Regards,
-Melissa

On Wed, Apr 22, 2015 at 11:34:58PM +0000, Simon Blanchoud wrote:
> 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 !

> _______________________________________________
> ome-devel mailing list
> ome-devel at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel



More information about the ome-devel mailing list