LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Record avi file in the loop?

Solved!
Go to solution

Hi

 

I would like to create an avi file each time when I want. My camera is working all the time. I would like to make avi files all the time when I want without stopping the application and starting it again. I would like to change the name of the avi file too. I try to use IMAQ AVI2 Create, IMAQ AVI2 Write Frame and IMAQ AVI2 Close. When I put IMAQ AVI2 Create outside of the main loop I can create avi files but with the same name. On this way I overwrite the previous avi file with the new one. I would like to use IMAQ AVI2 Create in the main loop thus creating avi files with different names without overwriting them.

 

Could you please help me to resolve the problem?

0 Kudos
Message 1 of 3
(2,691 Views)
Solution
Accepted by topic author tiho

You can do this with an event structure handling events, or probably a state machine with suitable states (Init, Wait, Acquire, Close) or similar.

 

You just want some way to have your loop iterate over and over, but without calling every piece of code you write each iteration.


GCentral
Message 2 of 3
(2,683 Views)
Solution
Accepted by topic author tiho

Your Camera puts image data in buffers at some frame rate (say 30 fps).  At some point, you say "I want to save frames in an AVI", and at some other point you say "I want to stop this AVI".

 

What are the steps to create an AVI?  There are basically three:

  1. Open the AVI (giving it a unique name, based on some user-defined naming convention).
  2. Write out buffers of images from the time the user said "Save AVI" until the time the user says "Stop AVI".
  3. Close the AVI file.

It takes a little bit of time to open (and maybe to close) an AVI, during which time a few frames may be acquired.  However, you aren't saving frames, you are saving the contents of buffers.  If you have sufficient buffers, you can "save everything".

 

The process of capturing images goes at a fixed rate, while the steps in creating the AVI file run at varying speeds.  You need to code this as two parallel loops -- the Camera loop running at 30 fps and a State Machine to handle the three phases of creating the AVI outlined above.

 

Bob Schor

Message 3 of 3
(2,646 Views)