Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Recording usb camera (IMAQdx) to AVI

I am writing a VI to capture a 30fps USB Camera to an AVI file.  I have read through the forums and have implemented a producer/consumer VI for the recording; however there are issues I am running into.

 

When I am ONLY capturing the camera frames (not outputting to AVI) I am getting the rough 29~30fps rate that I am suppose to, but when I add the producer/consumer queues to record to AVI, the rate significantly slows down my capture to ~18/~19 fps.  

 

If I can't get the correct fps, my AVI playback speed will not be correct....is anyone familiar on how to correct this or is it just not possible?  I attached the two VIs (recording and no recording)

Download All
0 Kudos
Message 1 of 27
(5,441 Views)

Hi altran,

I tested your code out on my machine, but I'm able to get a frame rate greater than 30 using both of your VIs (so this doesn't seem to be something inherent to your code).

What version of LabVIEW and Vision Acquisition Software are you working with?

What does your CPU usage look like for each VI when it's running? I'm wondering if the issue is that your processor is having trouble keeping up when both operations are running at the same time. When you ran your tests, did you have any other applications open besides LabVIEW?

Also, do you have another computer you can try this on? If so, do you see the (approximately) same frame rates in each case?

Regards,

Ryan K.
Product Manager, ATCA and BEEcube
National Instruments
0 Kudos
Message 2 of 27
(5,388 Views)

Ryan,

 

Thanks for taking the time to look at this.

 

I am using LabVIEW 2015.  I am using a 30fps camera.  Are you using the same? If so, you have to make sure the VideoMode is set to a 30fps mode as well.  No other applications were running.  I have tried on two other laptops.

 

CPU usage is around 22% (8 core)

 

 

What I also noticed is that the "Buffer Number Out" of the IMAQdx Grab2.vi  matches the "frame number" in the no recording case, which is correct.  But not in the recording case since it is slower.

 

0 Kudos
Message 3 of 27
(5,353 Views)

I'm using a Basler acA1300-30uc, so it is a 30 fps camera. It is USB3, which your camera may not be, but I wouldn't expect bus issues to cause the type of behavior you're describing. There's no VideoMode setting for the Basler camera, but the camera is set to the full 30fps acquisition rate.

Are you using Vision Acquisition Software August 2015 or February 2016? What OS is your computer running?

Ryan K.
Product Manager, ATCA and BEEcube
National Instruments
0 Kudos
Message 4 of 27
(5,331 Views)

2015,

 

running windows 7.

 

Are you able to get exactly 30fps? because running greater than 30fps would also be an issue with recording to AVI

0 Kudos
Message 5 of 27
(5,326 Views)

I just updated to Feb 2016, and no differences noticed.

0 Kudos
Message 6 of 27
(5,298 Views)

Due to the nature of the camera I'm working with, the actual framerate is 32 fps, but as long as the correct framerate is passed to the AVI Create function, it shouldn't be an issue.

What's the actual model of camera you're using?

Try benchmarking the time it takes the Grab and the Enqueue operation separately. How long are each taking to execute?

Ryan K.
Product Manager, ATCA and BEEcube
National Instruments
0 Kudos
Message 7 of 27
(5,291 Views)

It's a ELP-USBFHD01M-L21 USB camera.

 

Just wondering if you made any changes to the VIs?  In the recording VI, when I disable the bottom portion (AVI Write), the frame rate goes to ~29/~30 fps

0 Kudos
Message 8 of 27
(5,290 Views)

I was able to run the recording VI at the full framerate with no changes; since then, I have added in some error handling a couple of other things to try and get a better idea of what might be going wrong, but I haven't learned anything particularly useful.

To clarify, are you saying that if you just disable the AVI Write function (but leave the queues in place), you're able to get the full framerate? Or did you disable the entire bottom loop?

Also, try setting the Overwrite Mode of the acquisition to "Fail" (see below) and the let me know if the acquisition errors out (and with what error).

 

Capture.PNG

Ryan K.
Product Manager, ATCA and BEEcube
National Instruments
0 Kudos
Message 9 of 27
(5,267 Views)
the problem here is not CPU it is RAM
altran
could you tell us about your RAM usage ?
also could you tell about the images size that you capture from your cam?
also I have 2014 LV
could you send your vis in 2014 version ?
0 Kudos
Message 10 of 27
(5,263 Views)