screen_capture_lite
screen_capture_lite copied to clipboard
Running the code
A couple questions:
- Can your code capture one or all monitors connected to the computer? I am running it now and it shows me a section of my monitor (but not the entire monitor). Is that because of the tiny_jpeg files?
- Can your code capture the mouse in the frame? Right now the code is generating pictures of mice but not the mouse relative to the rest of the frame on the monitor.
- Why do you have ScreenCapture_C_API.h? Why not write in pure C++? Why do you have a bunch of wrappers?
The example code captures the while monitor, parts of the monitor. I try to run through a couple of scenarios. The base case https://github.com/smasherprog/screen_capture_lite/blob/47defa25fd20048874f78b230a2bed17777eade2/Example_CPP/Screen_Capture_Example.cpp#L408
Should get you the whole monitor
Yes. I commented out everything that you have in main below:
std::this_thread::sleep_for(std::chrono::seconds(10));
The first image saved is indeed my full monitor (not sure about having several monitors) but I also get a bunch of parts of my monitor. What lines cause the code to save images of parts of the monitor? I want to make them stop.
I'm trying to figure out what the mouse callback does. It isn't putting the mouse on the image. It looks like it is saving the mouse in a separate small mouse-only image with printing its coordinates to console.
Yes thats correct. The mouse image is separate. Otherwise you would need to receive and handle an entire image of everything just because the mouse moved. So your application should combine the mouse on top of the thing its capturing.
Can you post an example of what you mean when u say, you get a bunch of parts of your monitor?
I ran your code and got 95 images. Here are the first 4. The first image is the full monitor. The rest of them are pieces of my monitor.
Perfect so thats correct. There are 3 callbacks })->onFrameChanged([&](const SL::Screen_Capture::Image& img, const SL::Screen_Capture::Monitor& monitor) {
})->onNewFrame([&](const SL::Screen_Capture::Image& img, const SL::Screen_Capture::Monitor& monitor) {
})->onMouseChanged([&](const SL::Screen_Capture::Image* img, const SL::Screen_Capture::MousePoint &mousepoint) {
})->start_capturing();
ICaptureConfiguration::onNewFrame: This will call back when a new frame is ready on the interval specified in SCL_SetFrameChangeInterval
ICaptureConfiguration::onFrameChanged: This will call back when differences are detected between the last frame and the current one. This is usefull when you want to stream data that you are only sending what has changed, not everything!
ICaptureConfiguration::onMouseChanged: This will call back when the mouse has changed location or the mouse image has changed up to a maximum rate specified in SCL_SetMouseChangeInterval
onFrameChanged WIll always start with the FULL IMAGE, then call you back sending only CHANGES. So, in theory, you can just use that for your purposes
The idea with the pieces is that you send only those and you can stitch them together on the other side. If you know that you are going to send everything ALL the time, then just use the OnNewFrame, if you know you are going to be streaming something that doesnt change all too often, then use the OnFrameChanged..
Both can be used at the same time, these are here solely for optimizations
Sending a 4k res pic on at a decent framerate will generate significant network throughput even with good compression. So, be carefull
Gonna close this as working as expected unless you have some additional info?