Writing a Compressed AVI File with IMAQ Vision Acquisition Software

Updated Dec 20, 2023

Reported In

Software

  • LabVIEW Full
  • LabVIEW Base
  • LabVIEW Professional

Driver

  • NI-IMAQ

Issue Details

I am writing acquired images to an AVI movie file using the IMAQ driver API. I have noticed that this file grows very large after just a few minutes of acquiring images. How can I compress this movie to take up less hard drive space?

Solution

IMAQ 4.7.2 and Later:
Wire a string control or string constant to the Codec input of the IMAQ AVI2 Create VI:



The method of compression used  will depend upon the string that is connected to the Compression Filter or Codec input. The selection that you make must be an encoding algorithm, or codec, that is present on your system. The codecs that are available may vary from system to system, depending on what software is currently installed. 

IMAQ 4.7 and Earlier:
In order to write a compressed AVI file, you will need to wire a string control or a string constant to the Compression Filter input of the IMAQ AVI Create VI:

Additional Information

Codec Comparison
It may be useful to compare all of the codecs available on your system.  An AVI compressor comparison example is installed with the NI-IMAQ drivers, and is available in the LabVIEW example finder.
  1. Open the LabVIEW example finder (Help»Find Examples).
  2. Open the AVI Compressor Comparison example, located in Toolkits and Modules»Vision»Functions»AVI Compressor Comparison Example VI.
  3. Run the VI. The VI uses all available compressors on the system to compress a small test AVI. The results are given in file size, average write time, and quality.


For more information on supported codecs, see AVI Codec Support with AVI2 in NI Vision Products.