LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Video recording loops

Solved!
Go to solution
We are working on a program at the moment that we want the video to loop on a certain time period. When an external action occurs, we want the video to continue recording the time left that we specified, and save the avi file. For the time being we are just using the stop button in place of the external action. However, when we hit stop the video doesn't stop recording and save till after the next cycle. This means that it will overwrite the recording that we wanted to save. Our program is below. Any help will be greatly appreciated, thanks. We have LabVIEW version 8.0 if that helps anyone.
0 Kudos
Message 1 of 16
(4,248 Views)

PSU,

 

Right now, you are just using nested while loops to do a grab and save to avi. This is expected to do exactly what you are describing. If you want to only record video when an action has happened, I would reccomend an event structure.

 

The events would be whatever your action is (lets say a GO button) and a timeout. So, if nothing is pressed, or no events happen, the code just keeps doing nothing, and running in a loop. However, if the user hits the GO button, you will do exactly what your nested while loop does, and save your frames to an AVI for the elapsed time.

 

Also, as a side note, not that it matters:

Why did you change the conditional to "continue if true" and use a not or instead of leaving it as the default stop if true with an or. Both work, just curious.

Chris Van Horn
Applications Engineer
0 Kudos
Message 2 of 16
(4,239 Views)

Also, you don't want to keep initializing and closing inside of a loop, its poor coding, and will eat up resources.

 

Just initialize everything before your loop, and close everything after, the meat can all take place inside the loop though.

 

 

Chris Van Horn
Applications Engineer
0 Kudos
Message 3 of 16
(4,237 Views)
We don't just want it to record the video when an event occurs, we want it to save the looped recording after an event occurs, so that the steps leading up to the event are captured on camera.
0 Kudos
Message 4 of 16
(4,231 Views)
Solution
Accepted by topic author PSUstudent

Ahh, gotcha

 

I would try the attached screenshot to see if it does what you want, but you still don't want to put all of your initialization inside of the loop, thats just poor programming.

 

 

 

 

Message Edited by Chris_VH on 03-30-2009 02:23 PM
Chris Van Horn
Applications Engineer
Message 5 of 16
(4,220 Views)
Thanks, this helped us stop the video recording during the particular loop that we want it to. Currently it would basically work for the needs that we have. However when we click stop it immediately stops the recording as opposed to stopping after the specified time period.
0 Kudos
Message 6 of 16
(4,208 Views)

Ahh, if you don't want that, just remove the wire to the or.

 

This will force the loop to end on your last "recording" but won't stop it until the time has elapsed.

Chris Van Horn
Applications Engineer
0 Kudos
Message 7 of 16
(4,203 Views)
Which wire to the or do I need to remove. I tried removing the stop button to the or, and the program wouldn't stop at all when I pushed stop.
0 Kudos
Message 8 of 16
(4,194 Views)

You'll have to make sure that the button stays "depressed" by changing the mechanical action of it. 

 

"Switch when pressed" should work, but you'll have to wire up a property node changing it back to false at the end of the code. If you are just latching it or using "switch until released" the program wont see that its been triggered to true.

Chris Van Horn
Applications Engineer
0 Kudos
Message 9 of 16
(4,181 Views)

Chris_VH wrote:

Also, you don't want to keep initializing and closing inside of a loop, its poor coding, and will eat up resources.

 

Just initialize everything before your loop, and close everything after, the meat can all take place inside the loop though.

 

 


 
Just curious, what exactly does the "meat" consist of?
0 Kudos
Message 10 of 16
(4,148 Views)