Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

drop frame rate when start saving avi file with GigE basler camera

Solved!
Go to solution

Hello all,

 

I use 2 Ace basler GigE cameras at 60 fps to capture animal locomotion. I experience randomly this kind of problem. When I start to record by a start/stop button and save the videos in the hard-disk sometime the frame rate drop to 20-14 fps and a skip 2 or 3 frame. After that the frame rate became stable to 60 fps. 

These are the overall settings and spec of the program:

- I use a producer/consumer loop (I never experienced a filling of the queue even when the drop frame rate occur)

- I fixed the bandwidth of the Intel 100 GigE card to 500 for each camera

- size of packet sent = 8000

- firewall disabled

- vi execution in highest mode

 

I observed that the dropping of the frame rate occur when the vi run for a while without interaction with the operator (the operator set others parameters in another computer, so the vi only acquire the videos without saving them)

 

I have attached the vi

 

Thank you for your help

 

Alex

0 Kudos
Message 1 of 9
(7,572 Views)

Alex,

 

Does this drop in frame rate occur with both cameras or does it only occur with the "left" or "right" camera acquisition loops.  I think what is happening is that your producer loop is overwriting the images before they get written to the AVI.  In addition there may be some memory conflicts as queues are generally not recommended for IMAQ Images.  Here is an explanation stating that instead of enqueuing an Image Object you are actually enqueuing a memory location to an image.   This means that when you produce a new image it is writing to the same memory location you are trying to read from when you write the frame to AVI.  This forum offers a possible workaround.

Regards,
Isaac S.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 9
(7,555 Views)

Hi Isaac,

 

thank you for your replay. The frame dropping occur with both cameras and even if I use only one camera. This happen above all when I let run the grabbing (without saving) alone, that means that I don't touch for example the mouse for a while ( 40-50 sec). So after  this time, when I push on the record button to save the avi file the fps drops and I have some skipped frames in to the saved video. I tried to change the configuration of the antivirus McAffee and now I experience an erratic fps during the record of the avi file (not during the grab only).

 I use windows 7. Could be a problem of operating system like some kind of sleeping mode? Or a problem connected to the writing the avi file into the hard disk or some problems linked to the access to the hard disk?

I use a very fast hard disk dedicated to saving the videos.

 

Thank you 

 

regards

 

Alex

0 Kudos
Message 3 of 9
(7,536 Views)

Sorry Isaac,

 

I tried your suggestion but never change

 

Alex

0 Kudos
Message 4 of 9
(7,531 Views)

Why bother using queues at all for this example? Unless you are processing things in parallel, you may as well just use the built-in queue that is the buffer ring that IMAQdx internally uses. You can make it any size and will give effectively the same behavior for your usage as queues would. The problem is that your code is using images as a pass-by-value datatype, not pass-by-reference. To use them in queues is significantly more complex than your code is designed.

 

Eric

0 Kudos
Message 5 of 9
(7,525 Views)

Hi Eric

 

the problem happen even if I use one camera in a simple configuration like that you can find in the attachement. After some time (abbout 20 or 30 sec) of grabbing without saving when I click on the record button the frame rate drop.

 

Thank you for your help

 

Alex

0 Kudos
Message 6 of 9
(7,511 Views)

Well, you have a few issues I can see...

- You are only using 3 buffers, so you aren't taking advantage of any buffering in the driver

- You are asking for the "Next" image, making any buffering not be used (since you always get the latest image). Since you probably want every image you should ask for them by sequential buffer number

- You are saving to an AVI file without any compression. This means your disk I/O is going to be really high. A color HD image might be 8MB/frame and 60fps would be almost 500MB/sec. A standard hard drive cannot keep up with that. Since there is caching/buffering in the disk subsystem involved, you'll probably see non-consistent behavior, but almost certainly the disk is having a hard time keeping up.

 

Hope this helps,

Eric

 

 

0 Kudos
Message 7 of 9
(7,501 Views)

Hi Eric,

 

I have a monochrome camera and I acquire an image of 8 bit for pixel, so I have 640x480 camera that is 2.5 Mb for each frame = about 150 MB/sec that would be fine for a HDD, I believe. 

I need to have a real time control because the video are synchronized to the analog data that are acquired by an another computer.

The dropping of the frame rate  happen only if the grabbing run freely for 20-30 sec after that I start the recording in a avi file. If I monitor the fps acquired and the fps processed I seen that during the drop the fsp acquired is ok (60 fps) while  the fps processed drops to 20 fps and after become again to 60 fps. I seen in this post "Lost GigE frames/buffers" that it could be a timeout problem... what do you think about?

 

Thank you

 

Alex

0 Kudos
Message 8 of 9
(7,495 Views)
Solution
Accepted by topic author alex_qc

Hi Eric and Isaac

 

finally the problem was similar to that indicated by Peter Westwood in his post "Lost GigE frames/buffers". I discover that the problem happen with the version of labview 2012. Indeed I tried with the 2011 version and I don't have any dropping. Thus, I do the same thing that Peter that is "I changed the program so that maintains a buffer number count (incrementing the buffer number  on each Grab) and specifies this buffer number to the Grab VI. This works well, even on occasions when the acquisition loop is occasionally momentarily delayed by up to a second or more, by (I suspect), Windows writing disk buffer contents to the disk, or doing some other housekeeping, " 

So even if the fps drop the program acquire the right frame and in the video I don't see any skipped frame

 

Best regards

 

Alex

0 Kudos
Message 9 of 9
(7,454 Views)