Example Programs

Showing results for 
Search instead for 
Did you mean: 

IMAQdx: Record Section of Grab to Record to AVI File


The example demonstrates how to save acquired images to a AVI video.



The example is based upon the standard Low-Level Grab Async example from the LabVIEW example finder.

The image acquisition is asynchronous since the IMAQdx Configure Acquisition is configured to use multiple image buffers and the image buffer is read with IMAQdx Get Image when an event has been triggered. To accomplish this a dynamic event has been created that triggers whenever the IMAQdx driver reports that a new image has been recorded.

The acquired images are then recorded into a AVI video file. AVI is a container format that can use different codecs with different characteristics regarding encoding and decoding speed as well as compression efficiency. Not every Windows system features the same set of possible video codecs, therefore the IMAQ AVI2 Get Codec Names function reads the available codecs so the user can decide which codec to use. For simplicity the example uses the first available codec.




  • LabVIEW 2012 Base Development System (or compatible)
  • Vision Development Module 2012 (or compatible)
  • NI-IMAQdx 4.0 (or compatible)


  • NI-IMAQdx driver supports the following buses and standards:
    Gigabit Ethernet Cameras Supporting GigE Vision, FireWire IEEE 1394 Cameras, USB 2.0 Cameras Supporting Microsoft DirectShow (often called 'webcam'), USB 3.0 Cameras Supporting USB3 Vision


Steps to Implement or Execute Code

  1. Open the attached file
  2. Select the path to the AVI file
  3. Select the camera name
  4. Run the VI
  5. Activate the Record button to start writing image frames to the AVI
  6. Release the button to stop recording


Additional Information or References

IMAQdx Low-Level Grab Async with AVI Recording - Front Panel.png


IMAQdx Low-Level Grab Async with AVI Recording - Block Diagram.png


KnowledgeBase: What Is the Difference Between NI-IMAQ, NI-IMAQdx, and NI-IMAQ I/O?


**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text 'NIVerified'. Read here for more information about the new Example Guidelines and Community Platform.**

Isaac S.
Applications Engineer
National Instruments