After looking around, searching, reading and experimenting, I ended up with a bunch of commands to quickly make high quality time lapse videos under Linux. One of the hardest (almost impossible) things to find, is software for photo deflickering so for solving this (or at least improve the results), I created my own little Perl script to compute and change the average luminance (brightness) of all of the photographs.
If some of the commands below are not working, you might need to apt-get install some extra software, but all of it is available in the repositories
A Quick Introduction to Time Lapse Videos
From Wikipedia: Time-lapse photography is a technique whereby the frequency at which film frames are captured (the frame rate) is much lower than that used to view the sequence. When played at normal speed, time appears to be moving faster and thus lapsing. For example, an image of a scene may be captured once every second, then played back at 30 frames per second. The result is an apparent 30-times speed increase. Time-lapse photography can be considered the opposite of high speed photography or slow motion.
How to take good pictures to compose a time lapse video afterwards
The rest of the steps might not be reproducable with compact point and shoot cameras.
First of all the camera needs to be very stable between shots to make the composition easy later on, therefore, a tripod needs to be used.
Choose how many total pictures need to be taken and set your camera to take one picture every some predefined interval (for example one every 5 seconds). This can be done either with computer software, or the camera itself. Some cameras have a built in intervalometer or they can accept external accessories.
Calculate Final Video Length
If you choose to take 300 pictures, and you make a final video running at 10 frames per second, then your video will be 30 seconds long (300/10=30s). At 25 frames per second, the same video will be only 12 seconds long (300/25=12s). It is a good idea to plan the desired length for your video beforehand, and take some more photographs to achieve a smoother movement with higher frame rates (especially when moving objects are near your camera).
For a good time lapse video, the camera needs to be set to Manual mode and choose a non changing Aperture (A), Shutter speed (S), ISO and Focus. This will reduce flickering (different brightness between pictures) a lot as the overall brightness of the pictures will not be changing between shots.
What I usually do, is that I put the camera on the tripod and take pictures in auto mode until I am satisfied with the result. Then I look at the chosen from the camera settings (A, S, ISO), change the mode to manual and use the same settings as the camera did in auto mode. The auto focus is used to focus on the main object properly, and before starting the intervalometer, I change it to manual focus as well as the other settings, because all of the pictures need to have exactly the same focus.
There are certain cases (sunset is one of them) that lighting conditions might change a lot during your shots, and a fixed set of A, S and ISO settings might not give good results after sometime. In this case, I always choose a stable Aperture to avoid changes in the depth of field (DOF), ISO and focus, and let the shutter speed vary (Usually the A or Aperture mode of your camera can do this). This technique will introduce more flickering because the exposure metering of your camera will calculate slightly different values sometimes.
Making the Video
This is the actual purpose of this tutorial. To show you how to use Linux to put everything together fast.
Make a new folder and copy all of your photographs taken for the time lapse into it. Make sure that your photographs have a unique filename with an increasing number, so that when you sort them, the first frame (with the lowest number) of your video comes first and last comes last. The default numbering (DSC_0001.jpg, DSC_0002.jpg,....) of most of the cameras will do fine.
cp /media/cf/* source_folder_of_pictures/
Resize the images first to 1920x1080 to get a Full HD output (all of the rest of the operations will be much much faster if you do this now)
Step 3 (OPTIONAL)
mogrify -path resized -resize 1920x1080! *.jpg
If you photos have noticeable flickering which is caused by slightly different exposure between taken photos, download the attached script, put it in the directory source_folder_of_pictures/resized/, make it executable and run it. The script will create a subdirectory "source_folder_of_pictures/resized/Deflickered" to store the processed photos.
sudo apt-get install libfile-type-perl libterm-progressbar-perl
chmod +x timelapse-deflicker.pl
Use ls to sort the files by their number.
ls -1tr | grep -v files.txt > files.txt
Use mencoder to combine all of the photos in one video without losing quality! This will create a big file as it will only put all of the JPG files together in a single uncompressed video. Change the "fps=15" in the following command, to match your frames per second you wish to get in the final video.
Note: Use ONLY ONE of the following 3 commands. I usually choose the first one to quickly check the result and then I re-make the video with the second or third command if I want to make some post processing in kdenlive.
Step 6 (OPTIONAL)
mencoder -nosound -noskip -oac copy -ovc copy -o output.avi -mf fps=15 'mf://@files.txt' # Very fast but does not create index so if you want to edit with a non linear editor do not choose this.
mencoder -idx -nosound -noskip -ovc lavc -lavcopts vcodec=mjpeg -o output.avi -mf fps=15 'mf://@files.txt' # Fast, it will create index, but it will re-compress the JPG files so some loss of quality will occur (insignificant, so you can safely bet on this)
mencoder -idx -nosound -noskip -ovc lavc -lavcopts vcodec=ljpeg -o output.avi -mf fps=15 'mf://@files.txt' # Slow, it will create index, it will re-compress the JPG file but with the highest quality options to provide lossless results (the final file will be larger than the total of the original files, but if you are a quality freak, then go for this one)
Here you might want to use a non linear editor like kdenlive (which is the best non linear video editor I have found for Linux so far) to add some music to your video and introduce some effects (like smooth fade from black in the beginning of the video or fade to black in the end), but remember to export in a lossless quality format like MPEG2 I-Frame only so that you won't get any significant loss of quality.
Use ffmpeg to compress the video into a high quality Full HD one.
avconv -i output.avi -c:v libx264 -preset slow -crf 15 output-final.mkv
You are done!
Congratulations! Enjoy and brag for your own time lapse video