LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

continuous video aquisition

Solved!
Go to solution

Hi! I'd like to capture video with my firewire camera @ ~30fps.

The record might be several minutes long but my memory runns out before reaching the first minute.

 

So I'm looking for the best way to buffer that amount of video to the hard drive before saving the final avi. 

I had several ideas on how to do this but I'm not sure what would be the best way in the end.

And if this works another wish would be to have a vi with which you can handle the hd-buffered video as if it's in memory (exept for the speed).

 

I'm mainly looking for inspiration, maybe someone has links to VIs that can already do this or similar work? My searches were without success...

 

Thanks to anyone that wants to help!

 

Christian Riedel

 

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

First, if you have not done so yet, make sure you read the tutorial on Managing Large Data Sets in LabVIEW.  It will answer a lot of your questions.  Next, you need to decide what video codec you will be using and how easy it is the call the codec DLLs from LabVIEW.  Some open source ones include Huffyuv, Xvid, and Theora. I have never tried to use any of these from LabVIEW, so can offer no real advice.  You can probably use the call library node to interface to the codec DLL.

 

I would recommend a producer/consumer architecture so that LabVIEW can take advantage of multiple processes and threads.  You can find examples of producer/consumer architecture in the LabVIEW help.

 

Good luck.  Let us know if you need more help.

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

Hi DFGray! Many thanks for your answer!

 

I want the get more in detail:

 

I wrote a labview programm that records and plays video (with IMAQdx, Vision Aquisition), the user can jump to single pictures, it loads, saves AVI, takes synchronous DAQmx signals ect...

 The handling of the memory is no problem, but it's just that it runns out (!) and I have to save to the hd to continue aquisition.

Now I'm looking for the best way to do that:

 

Needed is a routine that continuously saves to the hd from a ringbuffer in the memory.

Shoud I use the "Save to AVI" VI? Is it better to use direct access to dlls (i.e. mpeg encoding dll). Has anyone recommendations?

 

I thought about using the "Save to AVI" VI with huffyuv. I hope it works fast enough (Save to hd faster than aquire to memory). (DAQmx in the background)

Or is it better to save the video as variant or string data?

 

Next thing would be to handle that data.

The user must be able to play and skip through the video with minimised wait time and disturbance.

Would it be good to have a video codec that sets all video frames as key frames?

 

What file sizes should I use if the uncompressed data is lets say about 10GB?

1x10GB or 5x2GB or 100X100MB....?

 
QuestionsQuestions?Questions????

 

Really great would also be if someone knows libraries that already handle that kind of hd-buffering.

(It always best to copy and pasteSmiley Wink)

 

 

Many thanks & kudos to anyone that shares some experience !  

 

 

 

0 Kudos
Message 3 of 7
(3,694 Views)
Solution
Accepted by CtheR

I got everything to work very properly on my own. Took some time but it works now.

 

If someone likes some advice about this topic, feel free to PM me.

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

Hello, i'm so interest in you solution, because i have also a similar problem at my application as that one you already solved.

I have a firewire camera which has a framerate of 30fps, what i want to do is to get the camera continuously run and then to save each frame to the Harddisk. In the practice i have realized this application by using the IMAQdx Configure Acquisition.vi where i set the input "continuous?" to "single shot" and "the Number of Buffers" to a number as big as possible. Actually i could only set "the Number of Buffers" to 900 maximal, with higher number the vi will give a error message, because the memory runs out.

 

After reading some knowledge articles of NI i think i should use ring buffer, and buffer the a part of the whole date to harddisk while my camera grabs contineously. But i don't known how i can implement this procedure without interrupting the camera acquisition and losing any frames. is the queue VIs for that purpose? can i configure a ring buffer when i do sequence-acquisition. I know the grab-cquisition VI use the ring buffer, is it the right one i should take? 

 

 

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

Hi Tottiwin, sorry for answering so late.....

 

Well, the most important point is that writing directly to an avi file works perfect when recording with 30fps and without losing any frames.

For me it works even with one of the not so fast codecs such as cinepak.

 

I also thought it would be more complicated but it is as simple as that.....

 

So my main routine look somewhat like this:

 

imaq.png 

 

If you still have questions (but I guess you've figured it out on your own by now 😉 write again.

I'll be quicker with my answer this time I promise......(because I'm back at work -> more time to hang out in the LV forums.......)

 

Greets CR

 

 

0 Kudos
Message 6 of 7
(3,433 Views)
Thx, i think that must work, i will write here again when i implemented it and it works.
0 Kudos
Message 7 of 7
(3,411 Views)