LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

continuos acquisition video and record video in AVI format

Hello,

 

I want to make a continuos acquisition of video with a webcam and record video in AVI format with a number of frames per second equal to 60, and with a possibility to choose the period of acquisition in the window '' front panal '' but the problem is that when I selected an acquisition time of 1 minute supervision

video takes a time of 1 minute but I get an AVI video recorded with a duration of 15 seconds !!

 

0 Kudos
Message 1 of 7
(3,237 Views)

You record for one minute, using a TimeStamp to stop the recording loop.  Note that the recording loop is "clocked" by the IMAQdx Grab function, which "waits" until it gets the next image from  the camera.  You do not specify (in your code) the frame rate of the camera -- let us assume that it is 15 fps.  You record for 1 minute at 15 fps = 900 frames, and write these to an AVI file.  When you play the AVI file back at its "saved" rate of 60 FPS, it takes 900/60 = 15 seconds to play.

 

I think that your code is basically working (although I don't like using Timestamps as "timing" indicators, as you are doing), but the camera is recording at a rate 1/4 the speed of the playback rate.  Can your camera record at 60 fps?  Where do you set the Camera Attributes to deliver that speed?  Have you configured it in MAX?

 

Bob Schor

0 Kudos
Message 2 of 7
(3,188 Views)

Thank you for the answer, but I did not understand your answer, I think if you can give me an example it will be better.

0 Kudos
Message 3 of 7
(3,161 Views)

How do you know the frame rate of the camera while it is recording?  You can get an estimate of this from your code by wiring an indicator to the While loop index ("i").  You know the time of your recording (because you stop the loop after some amount of time) -- let's say that it is 1 minute = 60 seconds = 6000 millisecond ticks.

 

Please compute (and tell me) the following:  Frame Rate = Index+1 / Recording time.  So if i = 899 when the loop ends, and you recorded for 1 minute, you would compute 899+1/60 = 15 Frames/second.

 

What are the actual numbers when you run your program?

 

Bob Schor

0 Kudos
Message 4 of 7
(3,146 Views)

I change the program as you told me (the program is given below), and I get for i = 899 a recorded video with a duration of 15 seconds.

 

0 Kudos
Message 5 of 7
(3,130 Views)

the program :

0 Kudos
Message 6 of 7
(3,127 Views)

I'm sorry, you didn't understand what I wanted you to do.  You might have "done the right thing", but I can't be sure.  Your original program (as I understood it) recorded images from the camera for a fixed period of time that you set (so you knew the recording time) -- what I wanted to know for the original camera was (a) what was the recording time and (b) how many frames were taken.

 

The second program that you just attached does the opposite -- it records a fixed number of frames (a better way to do this is to use a FOR loop and just wire 900 to N in the upper left hand corner).  If you are going to record a fixed number of frames, then I want to know how much time it takes to record.  You can do this by doing something like what is shown below (with the FOR loop example).

Time of Recording.png

I realize that this is in the "wrong" version of LabVIEW, but it just involves adding two Tick Count functions to your Camera loop.  If it does say that Delta-t = 15000 (15 seconds), then the main question, "Is the camera recording at 60 FPS", is answered as "Yes".  In any case, we should have enough data to make your code work as you want it to.

 

Bob Schor 

0 Kudos
Message 7 of 7
(3,116 Views)