Converting Still Images to Video

GoPro cameras have a time lapse setting which takes a series of still images which can then be converted into a time lapse video – here’s how to convert the images on a Linux box.

Install the tools

Older distributions use “ffmpeg”, but newer Linux distros (such as Ubuntu 14.04) might call it “libav”.  This blog post explains why.  Anyway, figure out if you’re in the ffmpeg or libav camp and install the package. e.g.

sudo apt-get install libav-tools

Assemble the images

ffmpeg (aka avconv) works well with image file names containing consecutive integers starting at 1. Let’s keep things simple and copy all the images we need into a temporary directory, renaming them in the process. For example:

TEMPDIR=temp
IMAGE_FILES="110GOPRO/G002*.JPG 111GOPRO/G002*.JPG"
i=1
for file in $IMAGE_FILES
do
  echo $file
  cp ${file} temp/$(printf "%05d.JPG" ${i})
  i=$((i+1))
done

Create the Video

Now it’s simply a matter of running ffmpeg, sorry “avconv”

avconv -f image2 -i temp/%05d.JPG output.mp4

or…

ffmpeg -f image2 -i temp/%05d.JPG output.mp4

Here’s one I made earlier:

The Wonders of avconv/ffmpeg

avconv can also be used to convert between images formats, such as this example:

for file in *.MTS
do
  avconv -i $file -strict experimental ${file%.*}.mp4
done
Bookmark the permalink.

Comments are closed