Description:
This VI programmatically will press the print screen key, copy the clipboard image into an IMAQ image, then save it to an AVI. This will allow you to create an AVI recording of the LabVIEW environment. Please not there is a limitation that if you click on other applications this will not work; you must stay within the LabVIEW environment.
Steps to Complete:
1. Open VI
2. Select File Path with a .avi extension
3. Run VI
4. Stop VI
5. Navigate to the AVI you saved and open it.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Well, it suck's to be limited with keyboard events, right?
My example, let's you fly through windows, and even let you capture events which are supressed by printscreen or alt-printscreen btn.
-Artur
Hi Artur
Thank u for your very useful example and may i ask a question about the AVI file size.
i know the XVID filter is good for the compression but i can not got it in my computer although this filter have been installed on my computer. May i ask do you have experience that directly recall XVID sdk to use this filter and do not depend on labview. Or do you have other suggestion that can help me to got relatively small avi size and the video quality is just to watching.
Thanks
Daniel
Hello Artur
Thank you very much for your reply and i can got the ffdshow in the filter list.
But the captured avi file has some problem when i play the avi file. i am not sure whether my setup have any problem for i install the ffdshow in all default setup.
Thanks
Daniel
Hello Daniel,
Can you specify which code (VI) you use to capture video.
Looks like bit depth mismatch...
-Artur
Hello Artur
Please see the attached code PIC. The code(printscreen to IAMQ) is you once posted on the website. I am not sure whether my using method was correct or not. Why will cause this problem.
Thanks
Daniel
Daniel,
During capture image displays properly? If, yes then you have some problems with encoding. If, no then there is a problem with .net desktop screen capture.
I've checked .net desktop capture subvi under WinXP 32bit and Win7 32bit and 64bit, works properly.
-Artur
Hi Artur
The capture image was correct but when saved as AVI file,the output was incorrect. But when i use your another file that directly save capture image as AVI file and also use the same code. it was correct. So i think maybe the problem is on frame rate and the delay time.
Thanks
Daniel
Hello Daniel,
If during capture image display was correct, then problem is with Vision encoding. Timing shouldn't create such problem, it would only disturb data in time, there are better ways to capture desktops while preserving timing information, you can explore that later.
Now, looks like you have problem encoding data to AVI-file. From attached picture, looks like you are using 2nd generation AVI tools. I do not have 2nd gen installed on my machine (for various reasons), so -> Have you tried to capture uncompressed video or using different filter with the same code?
-Artur
Hi Artur
you are correct the problem is on the encoding. when i change the encode to the "Microsoft Video 1" the problem was solved.
Thanks
Daniel
Hello Daniel,
While it is fun to capture desktop with NI Vision (and learn how to overcome some bugs and/or shortcomings), but have you considered using VLC or Gstreamer for the same task? You can specify window of interest and scale with various compression formats plus you can add audio...
-Artur
P.S. Or depends on your application you can stream video over the network.

Hi Artur
Thank you give me a new method for this task. But when i install the VLC and want to insert ActiveX in labview, The labview will be crashed immediately. My labview was 2013. I am not sure whether my method have any problem or VLC can not be used in labview.
Second what you mean stream video over the network? you mean share the desktop to another computer?
Thank you very much that you give me great help.
Thanks
Daniel
Hello Daniel,
VLC's ActiveX crash in LabVIEW is known bug for sometime... Check this thread how to use VLC in LabVIEW.
And, yes you can stream your desktop or part of it with VLC over the network, i.e. from one computer to another.
-Artur
P.S. Same true for Gstreamer, I just haven't uploaded examples, yet...
and I think we should leave this thread alone
and continue on VLC thread or over private messaging.
Hi Artur
Thank you very much and i will study the VLC at first and if have some question that i will post on that thread and hope can get your help.
Thanks
Daniel
i need VI how to grab video and store in buffers please help me