LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Grab and save AVI video in LabView

Hello,

 

I've made a program for grabbing AVI videos, see attachment. My problem is the speed of the saved video. It's to fast. I've tried to adjust both the frames per second input (Video speed control) and the loop speed. But it doesn't help.

Any tips or solutions?

 

br,

paalbrok

0 Kudos
Message 1 of 6
(3,894 Views)

Please include a Snippet of your code, or attach your VIs, so that we can better assist you. We are here to help, but won't spend all day recreating your code from scratch.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 6
(3,867 Views)

You are doing the Grab and the AVI Write sequentially, so the loop time needs to be the Grab Time + the AVI Write Time.  LabVIEW is a Data Flow language, which means you can (and, in this case, should) do tasks in parallel.

 

Look up the Producer/Consumer Design Pattern (there's a template for it when you do a File/New...).  This structures your code as two parallel loops, a Producer (being the IMAQdx Grab) and a Consumer (the AVI Write), connected by a Queue (of Images).  With this architecture, you should have no problems with timing.

 

Bob Schor

0 Kudos
Message 3 of 6
(3,855 Views)

Setting the frames per second should dictate the play back speed. So with 10 FPS if you collect 100 frames it should playback for 10 seconds. My first step would be to make sure that this is working correctly. Run your VI for a little bit and the loop counter should tell you how many frames you have at the end.

 

The delay of 42ms in the loop is probably not going to get you what you want. It should be something very low like 5ms, and then you can check to see if the image changed or if the camera buffer changed before recording it to your AVI. Also, doing that daqMX stuff inside the same loop might make your acquisition take longer. If you you acquire half as many frames as you meant to, then the video will playback 2x too fast, which could explain your problem.

0 Kudos
Message 4 of 6
(3,837 Views)

I'm pretty sure that if you use a proper Producer/Consumer Design Pattern, you don't need any Delay function in either the Producer (Camera Grab) or Consumer (Write AVI) loop.  It's been a few years since I looked at my old code, but I'm pretty sure we told the Producer to start the Camera at 30fps and then (in the Loop) simply enqueued the most recent image, with the "clock" provided by the camera's frame rate.  The Consumer, of course, ran as fast as it could once frames were present, which meant that once it got going, it also ran at 30 frames/second.

 

BS

0 Kudos
Message 5 of 6
(3,821 Views)

Interesting answers. Thank you, guys. I'll have a look at it on monday.

0 Kudos
Message 6 of 6
(3,805 Views)