I want to create a timelapse from a collection of pictures, under Ubuntu. I'd like to make HD videos, and ideally add a soundtrack.
First we rename all *.JPG files based on their creation date. Sometimes cameras change the file name or just ordering them is somehow not what we want. However, renaming them by the creation date always work:
jhead -n%Y%m%d-%H%M%S *.JPG
After that we put this list in a file:
ls -1tr | grep -v files.txt > files.txt
And then use
mencoder to create an
AVI video using 20 fps. Note that this will generate a huge video file, usually around the same size of all the pictures summed.
mencoder -nosound -noskip -oac copy -ovc copy -o output.avi -mf fps=20 'mf://@files.txt'
I usually take pictures for timelapse with the lowest resolution of my camera (5 MP), which has a 4:3 aspec ratio. To generate a proper 1080p video the image is first re-scalled to 1920 pixels of width and then I crop it to 1080 of height. This way I am not changing the photos' content, just cropping:
ffmpeg -i output.avi -y -sameq -vf scale=1920:1440,crop=1920:1080 output-final.avi
The reason I use mencoder to put the photos together is because I got a
segmentation fault with ffmpeg.
You may also be interested in the project timelapse-darktable. It makes it easy to post-process images with darktable and make a timelapse of the serie. Instructions of how to use it is found here: https://code.google.com/p/timelapse-darktable/wiki/generateTimelapse
You may use mencoder. Options are quite explicits:
- list all your images files.
If they all are in the curent directory with ordered names and you want the list in the file /tmp/files.txt:
ls -1 *jpg > /tmp/files.txt
- Use mencoder with the appropriate option.
If you want the output file to be /tmp/test.avi with 30fps:
mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4 -o /tmp/test.avi -mf type=jpeg:fps=30 mf://@/tmp/files.txt
According to the same site, Openshot has a similar functionality but does not recommend it because it is "way too buggy". Still, if it is your preferred video editor, you will be happy to know you can just drag and drop a sequence of properly named (001.jpg to NNN.jpg) files into an Openshot window to import them as a timelapse as well.