-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty pixel data on Windows #11
Comments
Did you find a solution or another library? |
@yurtemre7 I ended up using some code I found online. You can try other capture libraries like screenshot-rs. |
I've found that, for some reason, the first capture on Windows results in a blank (an entirely zero) frame with subsequent captures working correctly. frame 1frame 2code usedlet mut capturer = Capturer::new(1).unwrap();
let (w, h) = capturer.geometry();
// capture_frame_components is a modified version of capture_frame
// which returns a bgr Vec<u8> rather than a Vec<Bgr8>
let f1 = capturer.capture_frame_components().unwrap();
let f2 = capturer.capture_frame_components().unwrap();
// qoi has been converted to png for the images above
let p1 = Path::new("./frame1.qoi");
let p2 = Path::new("./frame2.qoi");
// using the bgr array directly for the qoi, causing the inverted colour as this expects rgb
let o1 = encode_to_vec(&f1, w, h).unwrap();
let o2 = encode_to_vec(&f2, w, h).unwrap();
File::create(p1).unwrap().write_all(&o1).unwrap();
File::create(p2).unwrap().write_all(&o2).unwrap(); |
Could this be related to how The Would it be possible to include checks, something similar to: // No image update, only cursor moved.
if (info.AccumulatedFrames == 0 || info.LastPresentTime.QuadPart == 0)
{
RETURN_ERR(DXGI_ERROR_WAIT_TIMEOUT);
}
// not interested in just mouse updates, which can happen much faster than 60fps if you really shake the mouse
if (info.LastPresentTime.HighPart == 0)
{
hr = _lDeskDupl->ReleaseFrame();
return false;
} |
The example code(taking average color of screen, exactly what I need) is running on GNU/Linux without any problem but on windows every pixel just returns 0. Happens on both a daily use Windows with drivers installed and a new VM with nothing installed. Is there some sort of windows-specific dependency I'm missing?
The text was updated successfully, but these errors were encountered: