Jump to content

simultaneous acquire and save video files


Recommended Posts

A producer-consumer architecture, with a queue of images to be saved by the consumer loop, is the first thing you should really try. Alternatively and asynchronously grabbing one image from each loop for either viewing or saving, like you do, wont bring you far. Also, rendering the preview image might be resource intensive and compete with saving, you may want to display only one every N images. Finally, AVI could involve compression codecs, which can also be computationally demanding; to maintain a given frame rate you might have to stream uncompressed images, or to choose a less demanding codec, to reduce the image size.

Link to comment
16 hours ago, ensegre said:

A producer-consumer architecture, with a queue of images to be saved by the consumer loop, is the first thing you should really try. Alternatively and asynchronously grabbing one image from each loop for either viewing or saving, like you do, wont bring you far. Also, rendering the preview image might be resource intensive and compete with saving, you may want to display only one every N images. Finally, AVI could involve compression codecs, which can also be computationally demanding; to maintain a given frame rate you might have to stream uncompressed images, or to choose a less demanding codec, to reduce the image size.

Thanks, I can achieve the result via use the producer-consumer architecture with a better frame rate. But now there is a question, everytime run the program it will automatically generate a .avi file and it always be a empty file(0 byte).Now I want to add a case structure, when the case button was pressed it save to a avi file.If it was not pressed,the empty file won't be generate. You can directly modify in the vi file,thanks!save to avi.png

Grab and save avi.vi

Link to comment

I don't see a producer-consumer in your VI. That is e.g. two loops, enqueueing and dequeueing image references, or something equivalent. You create an AVI file at start because your program does so, you might want to do it rather only after the button is pressed. And I would handle that with an event structure and a shift register propagating the file reference from one iteration to the next. Maybe you'd want to check some LV learning resource first?

Link to comment
On 2017/12/6 at 3:56 PM, ensegre said:

I don't see a producer-consumer in your VI. That is e.g. two loops, enqueueing and dequeueing image references, or something equivalent. You create an AVI file at start because your program does so, you might want to do it rather only after the button is pressed. And I would handle that with an event structure and a shift register propagating the file reference from one iteration to the next. Maybe you'd want to check some LV learning resource first?

Thanks, I had achieved the result using the  producer-consumer,you can see it in the vi file. But I wanna to pressed the Boolean 2-5 to create avi files, otherwise it while generate many empty file, but the present program can just be pressed once, because the corresponding while structure will be end up. When I want to modify file name to generate a new avi file, it cannot be run(because it just could run once).So now I have two questions:

1. How to modify the program to achieve  continuous operation to generate a new avi file?

2. The pixels are 1080*720, 30 fps, 20s could generate 2G data, how can I  achieve compression and transmission of videos,then decoding and saving the avi file?

save avi.vi

Link to comment
On 12/8/2017 at 11:44 AM, 花落阳关 said:

1. How to modify the program to achieve  continuous operation to generate a new avi file?

Basic LV programming question. One way is with event frames. You should only open the AVI file when the boolean changes from false to true and close it when it reverts to false.

Link to comment
  • 2 weeks later...
On 2017/12/10 at 1:13 AM, ensegre said:

Basic LV programming question. One way is with event frames. You should only open the AVI file when the boolean changes from false to true and close it when it reverts to false.

Now there is still some question with the program, it can not be wrote to avi, just the last frame,I don't know why. Help me modify it to run, thanks!

Grab and SAVE AVI.vi

Link to comment
1 hour ago, ensegre said:

Dataflow.The small loop runs only after the big acquisition loop ends. You probably have no choice but to communicate the avi file reference and the writing status from one to the other via local variables. Or a channel wire perhaps.

I just want to add three button(grab,save and stop).Press grab to start to display on the front panel, press save button to generate a avi file(not generate one when the button is not pressed),press again to end the save mode. Press stop to end the whole program, could you please help me modify it, I had tried many times. 

Link to comment
  • 2 years later...
On 12/19/2017 at 5:23 AM, 花落阳关 said:

I just want to add three button(grab,save and stop).Press grab to start to display on the front panel, press save button to generate a avi file(not generate one when the button is not pressed),press again to end the save mode. Press stop to end the whole program, could you please help me modify it, I had tried many times. 

Hi, I know this was posted a long time ago, but did you ever get this working? I am trying to write a .vi that does the exact thing you are describing. I'm having the same issue of only saving the last frame. 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.