ra1nty / DXcam

A Python high-performance screen capture library for Windows using Desktop Duplication API
MIT License
457 stars 67 forks source link

start with fps of 30 and calling get_latest_frame is not delivering very smooth results #98

Open lovettchris opened 1 month ago

lovettchris commented 1 month ago

Here I'm dumping the time that each frame returns to me when I call get_next_frame and you can see it is not sticking to 30fps, it is regularly spiking to > 60 ms per frame. This is on windows 11 with NVidia 3090 GPU, with 3 monitors, but I'm only capturing a region on one monitor that is about 1000x600 pixels. Is there anything that can be done to improve this? The CPU is AMD Rizen-9 with 12 cores, and is no where near max load, so not sure what is going on, but if it's waiting for pixels to change, this is not the behavior I was expecting (or want) from get_latest_frame.

0.030761400004848838 0.03728559998853598 0.02669199999945704 0.06682059999729972 0.030030199995962903 0.0714159000053769 0.025916999991750345 0.06491899999673478 0.0654796000017086 0.03242600000521634 0.06438630000047851 0.06504270000732504 0.0334255000052508 0.06407029999536462 0.06516100000590086 0.03280329999688547 0.06502020001062192 0.06728479999583215 0.09685820000595413 0.03239870000106748 0.032260499996482395 0.03238910000072792 0.0647935999877518 0.03228559999843128 0.06508680000843015