I'm writing a screen capture module using the Robot class. I'm taking screenshots of the application every x milliseconds and writing them to disk. After screen capture is finished, I'm compiling the screenshots to video with FFMPEG.
However, writing images to disk is extremely slow and grinds my application to a halt. What am I missing? Is there a better way to write a simple screen capture module?
Edit: I've tried several ways of writing the images to disk, and all are very slow. I've been sticking with the following, due to its ease of use:
ImageIO.write(bufferedImage ,"jpg", file);
Or encode the image into video format right when you capture the image, and avoid writing the large temporary file at all. Full code using Xuggler can be found here:
Xuggler Screen Capture Demo Code