Search code examples
javascreenshotawtrobot

java-cursor flickering when i take many screenshot


I am trying to take many screenshot in Java using Robot class in order to record my screen. The problem is, when i take it at 15 fps-30 fps the cursor is flickering. How can I solve the problem ? I am working with Java 7 32 bits.


Solution

  • Screen flickering may be caused because you are taking the screenshot too fast.

    You should use some kind of timer to control the speed of your application, and make it run at around 60 frames per second.

    Secondly, professional screen recorders normally have back buffers that stores previous screenshots, and only take a screenshot of the portion of the screen that actually changed.

    Let's suppose you take a screenshot of your desktop. If you don't move your mouse or don't do anything, future screenshots may not be processed, because no changes were detected. If you move your mouse, only the portion of the screen that changed may be printed, and the rest should be the same as the previous screenshot.