From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Video for Windows (avicap32.dll)

Code and Documents

Attachment

Download All

Overview

Very simple video capture and preview example. While obsolete by today's standards and might not be supported in future versions of windows (works fine on W7 32/64 bit and below), can be still usefull when simple frame grabbing required for quick inspection, OCR and such.

For more advanced video capturing needs native DirectShow required, which is on its way to be replaced by media foundation...

The windows you create by using the AVICap window class (avicap32.dll) can perform the following tasks:

  • Capture audio and video streams to an audo-video interleaved (AVI) file.
  • Connect and disconnect video and audio input devices dynamically.
  • View a live incoming video signal by using the overlay or preview methods.
  • Specify a file to use when capturing and copy the contents of the capture file to another file.
  • Set the capture rate.
  • Display dialog boxes that control the video source and format.
  • Create, save, and load palettes.
  • Copy images and palettes to the clipboard.
  • Capture and save a single image as a device-independent bitmap (DIB).

Description

Features:

Attached library provides guide lines and working example on following:

  • How to capture video with just couple clicks
  • How to get capture device name from registry
  • How retrieve image from clipboard and convert it to LabVIEW's image data
  • How to specify video format not listed by built-in dialogs but supported by camera

Cons:

  • native dialog doesn't support resolutions above 640x480
  • no editing capabilities for incoming frames
  • no feedback for actual frame rate (as result recorded framerate maybe inaccurate)
  • two-step video capture, capture->export (reflects older harddrives performance)
  • works with last or default capture device (selective or multiple devices interface maybe difficult to build)
  • no audio mixing, i.e. audio from devices with built-in audio only

Pros:

  • Easy to use dialogs
  • Built-in tolerance on device connect/disconnect (USB cord pulling)
  • Ability to specify and tune available video compressors
  • Dual mode (file and memory) frame grabbing support

Steps to Implement or Execute Code

Open WM_CAP - AM Capture.vi from attached llb. library and click "RUN" button.

LabVIEW AM Capture.png

Requirements to Run

Software

  1. LabVIEW 11.0 or later

Hardware

  1. Capture device

Additional Images

Video Capture Reference

-Artur

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Gerod
Member
Member
on

Is there a version for LV2009?

GriffinRU
Member
Member
on

Attached...

Gerod
Member
Member
on

Thank you. I will dowload it and try.

Gerod
Member
Member
on

Opening AM Capture I found it broken.

Missing object. The object "Start Asynchronous Call" does not exist in the previous version.

GriffinRU
Member
Member
on

Fixed, sorry for delay,

-Artur

bseguin
Active Participant
Active Participant
on

I know this is quite old thread, but is there anyone that was able to make it work in Windows 10?

Thanks

Benoit

Contributors