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

Audio and Video Capture using a Third Party ActiveX Control

Code and Documents

Attachment

Download All

Introduction

This LabVIEW snippet shows how to use a third party ActiveX component to easily capture raw/synced audio and video without the need for using imaging/camera control software, such as Vision or IMAQ.

Purpose and Functionality

The main function of this program is to show others how to use ActiveX components in the LabVIEW environment to perform real-time audio and video capture. This was accomplished by using a PCMCIA Cardbus video capture card, specifically, an Imperx VCE-PRO-F (flat) (www.imperx.com/frame-grabbers/vce-pro) along with the VideoCapX (http://www.fathsoft.com/videocapx.html) multimedia ActiveX component called videocap.oxc.

How to use the code

  • The ActiveX component videocap.oxc can be found by downloading a 30 day trial version of VideoCapX found from this website: http://www.fathsoft.com/videocapx.html. You will want to download the trial version so that you can write and try out your LabVIEW application before purchasing the Lite version of the software, which is $99.
  • Open a new VI and place an ActiveX container on the front panel. The steps to do this are listed on this webpage: http://zone.ni.com/reference/en-XX/help/371361B-01/lvhowto/creating_new_controls_in_a/.
  • Place an Automation Open function onto the block diagram and wire the ActiveX control to the Automation Refnum input along with the local reference location of the ActiveX control.
  • Refer to the Audio and Video ActiveX snippet below. Add a Property Node to the block diagram and wire it to the Automation Refnum output. When you will now be able to see and select all of the available properties of the ActiveX component. Right click on the Property Node and select the CapFileName property and specify where you would like to save the avi or wmv file.
  • Next, in order to connect to the video device, add another Property Node to the block panel and set the Connected property to True. Next, define the video capture rate by using the CaptureRate property. If you would also like to capture audio, set the CaptureAudio property to True. You can then preview the video in real-time by setting Preview to True.
  • If you would like to have video text to display date, time, month, or a title/caption overlayed onto the video, select the SetTextOverlay property and expand it by selecting the edge of the Property Node and dragging it down. For this snippet, I used a time stamp to display the date and time as the Caption. All properties and methods are listed in the VideoCapX.pdf file below.
  • To start audio and video capture, add an Invoke Node to the block panel and select the method StartCapture. You can put an indicator onto the front panel to show that the video is recording by setting the IsCapturing property to True.
  • The snippet does not show it, but you can place this into a for or while loop and use the StopCapture method to end the capture at a specific time.

Snippet attached below

Audio and Video ActiveX Snippet.png

Brenda Novar

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

Comments
Paulinho
Member
Member
on

Hello,

I just bought the software Videocapx lite 3 6.3, but now I have a problem!
Using the videocapx 30 days software trial, I accomplished the goal of recording audio and video from a  video camera  using a USB grabber with  a preview screen for the program. But now,  using the the new software I can´t run the same program. 
Now I have a conflict with the preview and the recorded video, The preview works fine but I cant record the video.
when the programs run the preview works but when it is supposed the record the program is only able to capture 1 or 2 seconds of video.
The only way I can capture  video  and audio is without using the preview option!
Hope that you can  help me out with this problem? If you need more information just let me know!
I attached the vi of the program on labview!
Thanks for your time and help!
Nicolas Soria.

Dan_Alias
Member
Member
on

This is in concept exactly what I want to do.  I'm using a Epiphan VGA2PCIe frame grabber.  However, I'm hoping to use a free Activex Object.  I'm not sure of the redistribution rights of the Videocapx lite.  Has anyone found an ActiveX object that works for Directshow compatible frame grabbers or USB cameras, etc. that is free or open source, etc?  I think that the MSVidCtl *may* be able to do it but I'm finding the help a bit convoluted.  All I want is to see what I see in My Computer > Scanners & Cameras >  VGA2PCI V2P81125  preview on my LabVIEW VI.  I had initially thought that this would be very easy and that the ActiveX container would be just the thing.  But now I've found that every Directshow ActiveX object that I've found costs money.  Any tips would be apprecaited.

Thanks,

-Dan

SanderB
Member
Member
on

I posted a VI to capture video and sound and write it to avi here

https://forums.ni.com/t5/LabVIEW/activex-VideoCapX/td-p/3188632

It seems to work fine.

Contributors