LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

saving oversized videos

Hi,

I am using Labview 2015 and I need to save videos> 2GB in my experiments. We have made a loop in which it creates another file as soon as the labview reaches to its 2 GB capacity. Labview starts saving another AVI file with a new name. The problem is that I have missing data in between. I need videos of 20 min and almost 5 min of my recordings are missing. Does anyone know a solution to this problem? 

I have a 32GB Ram and 64bit operating system.

Thank you so much in advance,

 

Niki

Download All
0 Kudos
Message 1 of 2
(1,832 Views)

Am I correct that the problem you are having is a limitation on the maximum file size for an AVI created "all at once"?  I confess that the AVI's I've recorded are of "short" behaviors (5-10 seconds), so although I may record for 2 hours, I only save the "interesting behaviors" by creating a separate AVI for each one.

 

AVI files have an inherent limitation of 2 GB, and LabVIEW adheres to this limit.  However, there's no issue in creating multiple AVI files that record successive frames.  For (a simple) example, suppose a Frame took 1 MB, you were recording 10 frames/sec, so in 100 seconds you would record 1 GB.  You could record Frames 0-99 in "Block 0.avi", Frames 100-199 in "Block 1.avi", ... and Frames 1000-1017 (a "short" file) in "Block 10.avi".  I assume there is some non-LabVIEW routine that can "stitch" these AVIs together into some form of video that you can view, and it would (I hope) be a seamless view.

 

How hard is it to do this?  It is actually quite easy, using a Producer/Consumer Design.  I'll "hand-wave" you through it ...

  1. Configure your Camera for Continuous Acquisition, and create "sufficient" internal buffers (this takes some experimentation, but I'd suggest having 2 seconds worth of buffers to start with -- you can do tests to see when/if you lose any data as you vary the number of buffers).
  2. Start recording.  Your Consumer should be configured as a State Machine or Message Handler so you can "give it instructions".
  3. Send the Consumer an "Init AVI" message, passing it a Camera Refnum so it can query the Camera and extract Frames as needed.
  4. When you want to start saving frames as AVIs, send the Current Buffer to the Consumer as part of a "Start AVI" message.
  5. When you want to stop saving frames as AVIs, send the Current Buffer to the Consumer as part of a "Stop AVI" message.

All of the "Magic" happens in the Consumer (which I called "Video" in my routine).  Here's what happens in response to the various Messages:

  • Init AVI saves the Camera Refnum and sets up the AVI naming scheme, initializing it to "Block 0" (or however you choose your naming convention).
  • Start AVI actually doesn't need the Current Buffer, now that I think of it -- it can Query the Camera for the current buffer.  You need to keep track of two Buffer numbers -- Video Buffer and End Buffer.  Set Video Buffer to Camera's Current Buffer.  End Buffer is (for now) Current Buffer + AVI Frames (the size, in Frames, of the component AVI files).  We also set a flag, "All done", to false.  We then open the first AVI file using the current Name.
  • Save AVI saves the individual frames.  It looks at the Camera's Current Buffer.  There are three cases:
    • It is < Video Buffer (because it has just written this Frame, incrementing Video Buffer, but has not taken a new Frame).  Wait a few milliseconds (a frame's worth?), and give yourself the Save AVI Message.
    • It is < End Buffer.  OK, get the Image from the Buffer and write it to the AVI, incrementing Video Buffer.  Give yourself the Save AVI Message.
    • It is = End Buffer.  Call Next AVI.
  • Stop AVI sets End Buffer to the current Camera Buffer and sets "All Done" to True.  It then calls Save AVI (Next AVI does the actual stopping).
  • Next AVI closes the current AVI.  If "All Done" is True, we're all done and can exit the Message Handler (or get ready to save a new series of AVIs).  Otherwise, we open a new AVI file using whatever incrementing-naming scheme we adopted, and call Save AVI.

I've not actually implemented this scheme, but I'm quite sure it will work, as long as the Camera isn't shoving too many pixels down the I/O channel's throat.  Do test by taking a video of a stopwatch -- if you can get two or three sub-AVI's worth with no frame drops, you're golden.

 

Let me know how it works.

 

Bob Schor

Message 2 of 2
(1,768 Views)