Making a timelapse in Linux

     Hey guys, I've done a lot of searching, trying to find a program I could use to take screenshots of my desktop, or even a window, at certain increments, so I could then make them into a timelapse video. I'm here to report I haven't found anything, but I've made, with a little help from a few websites, something that works just as well. I'm going to walk you through all the steps in this blog post.
     The first step is going to be installing scrot. sudo apt-get install scrot You might already have Scrot installed so you might not need to do this step.
     We'll be writing a little code, but nothing hard, and I'll give you all the code at the end, so you can just jump there and copy and paste it all if you really want.
     Let's open a terminal and type this code. scrot you've just taken a screenshot of your desktop, by default it will have saved to your Home folder folder. We could do everything through the terminal, but it's a little easier if we just go ahead and make a script that we can run.
    Open your favorite text editor, I'll be using Gedit, but you can use anything, it doesn't matter.
     We'll start by typing #! /bin/bash all bash scripts start with this, that I've ever come across anyways, not sure what it means, or why it's there, but we'll use it anyways.(If it was a python script we'd have #! /bin/python). Next we hit enter and type
while true; do
     scrot
     sleep 10s
done
     Save the file as something with the .sh extension. Right click on the newly created file and pull up the properties, go to the permissions tab and check the box that says Allow executing file as a program, and close the properties box. Double clicking on the file will now prompt Run in Terminal, Display, Cancel, Run. Run it through the terminal the first time, this will enable us to see any potential errors, and make it easy to stop the screenshots from being taken.
     If everything runs correctly the terminal shouldn't display anything. The pictures will save in the same directory that the sh file is saved in. Here is the final working code.

#! /bin/bash
while true; do
     scrot
     sleep 10s
done 

     We can change how often it takes a picture by changing the number after sleep. Right now it takes a picture every ten seconds, we could have it take a picture ever second by changing it to 1s or to 15 seconds by changing it to 15 seconds. We can also do it in minutes, just change the s to and m, and yes, you could even do it in hours by changing the s to h.
     Could this script be better, sure, but it works. To use it just create the folder you want to save the images in, and put a copy of the script in that folder, run it in the terminal, you close it by closing the terminal, and then you can take the output, all the images and import them into KdenLive, Blender, or whatever program you are using, and have them all show for a frame of the video, and then export it as a video, and BAM you have a timelapse video.