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.
-
I haven't seen that. I can delete this question and post my answer there. Is that ok? – Frederico Schardong Jun 4 '13 at 20:08
-
I am not even sure if this is the best stackexchange site for this. I just want to share what I did. – Frederico Schardong Jun 4 '13 at 20:09
-
There is a similar question on askubuntu.com. The answers are mostly covered here at the time of writing, but that might change in the future, of course. – anarcat Jul 30 '18 at 23:49
Ffmpeg will do it. If you have images img001.jpg, img002.jpg, img003.jpg, ...
then on the command line do:
ffmpeg -i img*.jpg output.mpeg
There are more options given in ffmpeg --help
or man pages, or the web. These allow control over the frame rate and the output format.
-
1Using this yields an error for me, as it considers latter
.jpg
files like output file. I getFile 'DSCF6134.JPG' already exists. Overwrite ? [y/N]
- not so great. My solution was to generate a file list with\ls *.JPG | sed "s/^/file '/;s/$/'/" > files.txt
and then load it withffmpeg -f concat -i files.txt output.mpeg
. – anarcat Jul 30 '18 at 16:32 -
1With other ffmpeg versions the following version works without trying to override images:
ffmpeg -pattern_type glob -i "picture*.jpg" output.mpeg
– Patrick R. Feb 4 '19 at 9:31
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.
-
-
If like me you shot in 3:2 (my D750 stills are 6016x4016) and need it in 16:9 (for 4k video) 3840x2160 you can use FFMPEG to Pillerbox the video and pad black tram lines at the sides with this command - ffmpeg -i output.avi -qscale 0 -vf "scale=3840:2160:force_original_aspect_ratio=decrease,pad=3840:2160:(ow-iw)/2:(oh-ih)/2" output-final.avi - Video will be bigger but no loss of quality as this is downscaling – Rob Jan 8 '18 at 17:12
-
Blender is a good solution if you're dealing with motion timelapse (hyperlapse) or unsteady footage. It has motion tracking capabilities so you can choose a fixed point to track throughout the timelapse. You can also fix rotation issues.
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
Kdenlive can also generate timelapses using the Add Slideshow Clip
menu, as explained in this tutorial.
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.
-
That guide is from 2014. OpenShot has proved a lot over the last few years, it is now a lot more reliable. – vclaw Jul 31 '18 at 0:48