Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

What software can I use to take screenshots with a set interval? I'd like to take screenshots every 2 second or so. Command-line and GUI are both ok.

I'd prefer software that can also resize and compress each screenshot.

share|improve this question
1  
Good luck spying. –  Oleh Prypin Jun 28 '11 at 20:03
add comment

5 Answers

up vote 13 down vote accepted

Install scrot and then run this:

while true; do scrot & sleep 2; done
share|improve this answer
    
wouldn't that take 2 seconds + time scrot takes to run? –  Seppo Erviälä Jun 28 '11 at 16:31
1  
This seems to take a screenshot every 2,5 seconds on my system. I'd like something more precise. –  Seppo Erviälä Jun 28 '11 at 16:37
7  
@Seppo: use while true; do scrot & sleep 2; done. It'll background scrot (it runs scrot, but does not block until scrot is done) –  Lekensteyn Jun 28 '11 at 16:50
    
@Lekensteyn Thanks this is what I needed. –  Seppo Erviälä Jun 28 '11 at 18:02
2  
Thanks Lekensteyn, I edited my answer based on that. I didn't think a few milliseconds would make a difference but it takes 1/2 and would take even longer on a slower disk. Therei0s a risk here that on a very slow disk with a proper 2-second gap, it would be constantly writing to disk or worse still, it would fill up all the buffers until the system ground to a halt. @Seppo make sure whatever you're doing has enough time to write to disk. –  Oli Jun 28 '11 at 21:15
add comment

watch -n2 scrot

or

while true; do scrot -d2; done

share|improve this answer
add comment
while true; do import -window root /path/to/where/you/want/to/save/`date`.png; done
share|improve this answer
1  
You will need to install imagemagick for this to work. You can add a sleep command to the script to make it take the screen-shot every 2 seconds, as the question asks. –  Javier Rivera Sep 13 '11 at 16:40
add comment

As per an edit to your question:

import threading
    import os

    def capture(i):
        i += 1
        threading.Timer(2.0, capture, [i]).start()
        fill = str(i).zfill(5)
        os.system("scrot scrot-%s.jpg" % fill)
        os.system("streamer -o streamer-%s.jpeg -s 320x240 -j 100" % fill)

    capture(0)
share|improve this answer
add comment

You can use scrot to capture screenshot from command line and setup a cron job to use scrot to take a screenshot every n seconds.

share|improve this answer
    
cron wakes up only once per minute –  Seppo Erviälä Jun 28 '11 at 16:24
3  
cron is not precise enough to do something by seconds (it's accurate to the nearest minute - which is quite a big gap) –  Oli Jun 28 '11 at 16:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.