Save As AVI incompatibility

I am trying to save a Tiff image sequence, that was imported as a Virtual Stack, as an AVI (JPEG 6fps). I am trying both in ImageJ and Fiji and both produce AVI files that can no longer be read by Windows Media Player. I am trying this on Windows 7 64 bit and Windows Server 2012 64 bit. The Tiff images are approx. 3300 x 4300 pixels and are RGB. If I save the stack as an uncompressed AVI then WMP can play them.
I’m sure this was working very recently for reference.
I have also tried saving as PNG AVI and that fails to play too.
I have tried cropping the sequence down to 2000 x 1800 and the saved JPEG AVI works fine. The sequence is 9 frames long so the cropped AVI is approx. 5.9MB and the uncropped is approx. 20MB.

Thanks in Advance.

I am unable to duplicate this problem using ImageJ 1.50e/Java 1.8.0_45 running on Windows 10, using this test macro:

run("Fly Brain (1MB)");
run("Duplicate...", "duplicate range=28-36");
run("Size...", "width=3300 height=4300 interpolation=Bilinear");
path = getDirectory("home")+"test.avi";
run("AVI... ", "frame=7 compression=JPEG save=&path");

The test.avi file plays in the default Windows media player when I double click on it.

1 Like

Hi Wayne,

I have tried the process again in Fiji and still have an issue with the output AVI. I am running Fiji 2.0.0-rc-41 with ImageJ 1.50e26 on Java 1.6.0_24 (64 bit) on Windows 7 Pro 64 bit.

For info, this is the File Information from VirtualDub as I wanted to check the codec.
Frame size, fps (µs per frame): 3672x4287, 6.000 fps (166667 µs)
Length: 9 frames (0:01.50)
Decompressor: Internal Motion JPEG decoder (MJPG)
Number of key frames: 9
Min/avg/max/total key frame size: 2108029/2163132/2454017 (19012K)
Min/avg/max/total delta size: (no delta frames)
Data rate: 103830 kbps (0.00% overhead)

Sampling rate:
Sample precision:
Min/avg/max/total frame size:
Data rate:

I have tried cropping this odd sized sequence to 3300 x 4200 just in case that had any bearing but the resulting AVI still fails to play in Windows. I’ll try downloading the JRE 1.8.0_45 to check if that has any impact. In your example is that ‘Fly Brain (1MB)’ a standard example data set? Is it an existing AVI or Tiff sequence that I can download and cross-check?


@Andy_SSTL It seems you didn’t run Wayne’s macro.

Fly Brain (1MB) is one of the sample images accessible via File > Open Samples > Fly Brain (1MB). The command will load the image from

Ah, OK. I’ve now tried that script and it produces an AVI that fails to open too.
I tried my original data set to narrow down my issue and I loaded up just three frames from the sequence and tried different crop sizes until it worked. Eventually it seemed the cross-over for me was when I reduced the image width down to 2048 at which point it saved OK (I tried stepping down close to that so 2056 failed just in case it was linked to some issue around 8x8 JPEG block).
I also updated the JRE to 1.8.0_45 in keeping with Waynes just in case. I have the VLC Media player installed so I’m wondering if that has installed some JPEG compressors/codecs that are being used by ImageJ/Fiji?

Any thoughts?

FYI, I’ve repeated that experiment with Wayne’s script and get the same failure/success cross-over when I try width 2049 and 2048 respectively.

Widths that are a power of 2 plus 1 (65, 129, 257, 513, 1025, 2049, etc) seem to be a problem. This test macro creates an AVI that will not open correctly on Windows and OS X when you double click on it.

run("T1 Head Renderings (736K)");
run("Size...", "width=513 height=513 interpolation=Bilinear");
path = getDirectory("home")+"test.avi";
run("AVI... ", "frame=7 compression=JPEG save=&path");

Thanks Wayne.
Any ideas why it might be failing when I tried your original script creating an AVI at width=3300 though?

Does it also fail when using the Bio-Formats Exporter plugin? Or SCIFIO (File :arrow_forward: Export :arrow_forward: Image…)?

Using Wayne’s script to produce the 3300 x 4300 resulted in the SCIFIO export bombed with a java exception… io.scif.img.ImgIOException: io.scif.FormatException: C:\Users\GsAdmin\Desktop\nullflybrain: No supported format found.

and the Bio-format creating an AVI that WMP couldn’t play still (WMP v12.0.7601.18840)

I do not know why it might fail. AVIs with a width of 3300 created by my original script open fine on Windows 7 and Windows 10. It is only stacks that have a power of 2 + 1 width that fail.