LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating screen recording app with labview


@Andrey_Dmitriev wrote:

@constructionworker wrote:

I found  an example with Directx on the your suggest  but it only takes one picture of a screen.

I'm not sure but it seems like really faster photo capture with Directx.

 


This example is based on .net Wrapper, which is slightly obsolete and wasn't updated for last 12 years. My attempt to target it to latest .net framework and recompile in VS 2022 was just failed. In additional, some possible overhead could be expexted in managed/unmanaged code.

 

Most light weight and tiny recorder I've ever seen is here: https://github.com/WindowsNT/ScreenCapture.

Can be relative easy integrated with LabVIEW, but small warapper is still needed.


Of course, being recompiled is important for development.

I'm reviewing the C++ code, But to be clear I have to say that I can't find the port to create with labview.I have some experience in these matters, but very little indeed 🙂

0 Kudos
Message 11 of 24
(1,103 Views)

@constructionworker wrote:

I'm reviewing the C++ code, But to be clear I have to say that I can't find the port to create with labview.I have some experience in these matters, but very little indeed 🙂


You have to create new VisualStudio project with DLL and wrap the calls to something like that:

 

void LV_Start_Record(string *File; int Duration, int Format, ...)
{
    DESKTOPCAPTUREPARAMS dp;

    dp.VIDEO_ENCODING_FORMAT = Format; //MFVideoFormat_HEVC;
    dp.HasAudio = 0;
    dp.f = File;
    dp.EndMS = Duration;
    DesktopCapture(dp);
}

 

Could be a bit tricky with displaying progress (will need to provide feedback from recording loop) or with stopping recording, but imposible is nothing.

 

0 Kudos
Message 12 of 24
(1,098 Views)

I don't think I can do it on my own.I really don't know enough about this.It's really hard to come across the NI-Vision limit every time.

I need to get used to Labview In extras.So I don't know how it can answer with 3 screens.No need for a screenshot preview, I guess I'll still need a callback function to realize it's saved.This topic is starting to get tough 🙂

0 Kudos
Message 13 of 24
(1,084 Views)

At the risk of muddying the waters half way through a conversation. I have done this in the past using ffMPEG. You can call it using system exec and it will handle screen capture and file writing.

 

If you need a live feed in LabVIEW I have created two output streams in ffMPEG, one to a file and one to a UDP or TCP port on local host. you can then read this MJPEG stream in LabVIEW and convert it to IMAQ or a 2D picture.

0 Kudos
Message 14 of 24
(1,073 Views)

@Worle wrote:

At the risk of muddying the waters half way through a conversation. I have done this in the past using ffMPEG. You can call it using system exec and it will handle screen capture and file writing.

 

If you need a live feed in LabVIEW I have created two output streams in ffMPEG, one to a file and one to a UDP or TCP port on local host. you can then read this MJPEG stream in LabVIEW and convert it to IMAQ or a 2D picture.


No problem, we just collecting here all possible ways to capture the screen - could be useful for everyone!

Well, with ffmpeg can be done wit single command like

ffmpeg -f gdigrab -i desktop -c:v libx264rgb -framerate 24 -crf 20 -preset ultrafast output-file.mp4

the only question how to stop recording and get progress in LabVIEW. Any snippets are welcomed, of course.

0 Kudos
Message 15 of 24
(1,067 Views)

@Worle wrote:

At the risk of muddying the waters half way through a conversation. I have done this in the past using ffMPEG. You can call it using system exec and it will handle screen capture and file writing.

 

If you need a live feed in LabVIEW I have created two output streams in ffMPEG, one to a file and one to a UDP or TCP port on local host. you can then read this MJPEG stream in LabVIEW and convert it to IMAQ or a 2D picture.


Thanks for your suggestion.

We can definitely try all possible screen capture methods.  I have been doing research on the suggestion of Andrey_Dmitriev , but I have not come to a conclusion on how to do this with ffmpeg.

0 Kudos
Message 16 of 24
(1,053 Views)

By the way, when I test ffmpeg with 3 screens using the command below, I still get an output of 10 FPS.

I guess if I use "gdigrab" I will not get the required output FPS speed.

cmd /k ffmpeg -f gdigrab -i desktop -c:v libx264rgb -framerate 30 -crf 20 -preset ultrafast output-file.mp4

 

 

0 Kudos
Message 17 of 24
(1,008 Views)

There are also other options, but for me the only gdigrab was functional

https://trac.ffmpeg.org/wiki/Capture/Desktop

 

0 Kudos
Message 18 of 24
(991 Views)

 


@Andrey_Dmitriev wrote:

There are also other options, but for me the only gdigrab was functional

https://trac.ffmpeg.org/wiki/Capture/Desktop

 


I tested mine but I got errors like below.

constructionworker_0-1667842156641.png

 

 

I haven't been able to find a way to stop recording with labview anyway.

 I'm doing some tests, why is there no loss of FPS when I record screen with OBS studio.There is a strange situation.

 

0 Kudos
Message 19 of 24
(985 Views)

I found this example but can't compile

https://github.com/wsy2220/ffvi 

Do you think this will do any good?

0 Kudos
Message 20 of 24
(948 Views)