views:

23

answers:

2

I've written the following script to help me get successive screencaptures. I'm able to get the screencaptures to happen in successive files, but not as fast as I'd like them. The sleep rate isn't recognized after a certain point.

What are the decimal limits for 'sleep'? If it can in fact go lower, is there something wrong with my script that is preventing the captures from happening at faster rate?

#!/bin/bash
while true; do
CAPTURE_FILE_NAME=`date "+%Y_%m_%d_%H%M%S.jpg"`
screencapture $CAPTURE_FILE_NAME
sleep .001
done
exit 0
+1  A: 

Haven't used a mac for a while, but try adding time in front of the screencapture command - it should output information about how long it takes to execute. Could just be that it cannot go as fast as you want.

developmentalinsanity
My Mac says it takes about .35 seconds to do a screencapture. So you won't be able to get any more than approximately 3 captures per second using this technique.
Barry Brown
That's the sort of thing I expected. I'd guess it depends on the OP's screen resolution and processor speed etc. how fast it can be done on their Mac.
developmentalinsanity
Barry: Ah, good to know, thanks!
Marc P
A: 

Based on your desired sleep time, you don't want a series of screencaptures, you want a video screen recording :) If you need to go higher than 30 fps, that will be tricky, but you can get a solid 30 out of ScreenFlow, as long as you have enough i/o bandwidth for it to write the uncompressed frames to disk during capture. I do this with a Mac Pro and two sata disks in raid 0, which is well fast enough for it to capture 1920 x 1200 at 30 fps.

Andre LaBranche
I was hoping to avoid having to buy any type of software so I could do this on any Mac computer. But I think I may have to go the video screencapture route! Thanks for the suggestion!
Marc P