I’m Paul Herron, a full-stack developer and technical manager.
I focus mainly on back-end development with tools like Symfony
and devops with tools like Docker

Easy time-lapse videos: Using ffmpeg's wildcard support to process non-sequential image files

by Paul Herron on 05 January 2014

I’ve used ffmpeg a few times now to stitch a series of photos together into a video time-lapse, and until now I thought the only way to achieve this was to first rename all of the photos into a strict sequence of padded numbers: 0001.jpg, 0002.jpg, 0003.jpg, etc.

It turns out this isn’t necessary though. Thanks to a recent answer on Stack Exchange I found it’s possible to specify a wildcard character to denote a series of files to be used. This is really handy as it means you can use the filenames as they come off the camera. As long as they’re named in order it’ll work – it doesn’t matter what number they start from, and there can even be images missing from the sequence.

The comand to do this is:

ffmpeg -f image2 -i %*.JPG video.mp4

That would process a typical series of JPGs as it would come off your camera. I’ve uploaded a zip file of example images in case you need something to test with. I’ve also recently uploaded the finished time-lapse to Pond5.

This approach also works nicely for timestamped images. At SHOWstudio I recently ran off time-lapses from an archive of 3 million webcam frames and it worked a treat. I was certainly glad I didn’t have to rename all those files into a numeric sequence beforehand!

Back to homepage Back to blog listing

Next: