25
\$\begingroup\$

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.

\$\endgroup\$
3
  • \$\begingroup\$ I haven't seen that. I can delete this question and post my answer there. Is that ok? \$\endgroup\$ Jun 4, 2013 at 20:08
  • \$\begingroup\$ I am not even sure if this is the best stackexchange site for this. I just want to share what I did. \$\endgroup\$ Jun 4, 2013 at 20:09
  • \$\begingroup\$ 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. \$\endgroup\$
    – anarcat
    Jul 30, 2018 at 23:49

6 Answers 6

13
\$\begingroup\$

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.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Using this yields an error for me, as it considers latter .jpg files like output file. I get File '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 with ffmpeg -f concat -i files.txt output.mpeg. \$\endgroup\$
    – anarcat
    Jul 30, 2018 at 16:32
  • 3
    \$\begingroup\$ With other ffmpeg versions the following version works without trying to override images: ffmpeg -pattern_type glob -i "picture*.jpg" output.mpeg \$\endgroup\$
    – Patrick R.
    Feb 4, 2019 at 9:31
10
\$\begingroup\$

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.

\$\endgroup\$
3
  • \$\begingroup\$ For the segfault it would be useful to know your version of ffmpeg. \$\endgroup\$
    – Unapiedra
    Jun 4, 2013 at 21:22
  • \$\begingroup\$ 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 \$\endgroup\$
    – Rob
    Jan 8, 2018 at 17:12
  • \$\begingroup\$ in your ffmpeg command, -sameq option now is replaced with -qscale 0 \$\endgroup\$
    – Sang
    Jan 20, 2018 at 0:34
3
\$\begingroup\$

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.

\$\endgroup\$
2
\$\begingroup\$

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

\$\endgroup\$
0
\$\begingroup\$

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

\$\endgroup\$
0
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ That guide is from 2014. OpenShot has proved a lot over the last few years, it is now a lot more reliable. \$\endgroup\$
    – vclaw
    Jul 31, 2018 at 0:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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