More video-from-images stuff

January 26, 2012 - Geekiness

A couple of years ago I did a blog post on making a video from a load of labeled jpg images (http://www.hannahdee.eu/blog/?p=136) and this post is by way of an update to that. The technique there works fine if your images are numbered & padded with leading zeroes, and in the right order, don’t have any gaps, etc. But it won’t work if there are gaps, and it won’t work if the images are numbered consecutively without leading zeroes (e.g. image1.jpg image2.jpg […] image10.jpg […] image100.jpg).

It turns out that you can feed mencoder the list of images to encode in a file, which gets around all of these problems – just get the list of images into a file …

ls -1 *.jpg > list.txt

… Then sort the file…

And here some magic occurs

… And then use mencoder to actually encode the video.

mencoder mf://@list.txt -mf fps=25 -o output.avi -ovc lavc -lavcopts vcodec=mpeg4

The magic bit depends upon which type of numbering or sort order your jpg files have to start with, but the unix command “sort” can probably handle it.

Then you can do nice time-lapse videos, like this one.

Leave a Reply

Your email address will not be published. Required fields are marked *