Time Lapse Videos

From Seamonster

Jump to: navigation, search


Contents

Introduction

Seamonster maintains a few cameras that periodically capture images. We can create time lapse videos from those images using a free open source program called mencoder, which is part of the mplayer application. These videos are encoded using the xvid codec from libav at 1000 bits/second. We can probably do better, but that will work for now. There are definitely artifacts in the videos as they are currently being made.

This will also get easier when we start indexing our images in the postgres db.

How to create a Time Lapse Video

The Software

There are two scripts that are used to create the video. They both run by executing the command ~/bin/mkwebcamxvid as the seamonster user on nsrl1. This command takes one argument which is a regular expression describing the files to be included in the video. mkwebcamxvid calls another script called ~/bin/overlay that timestamps each frame with the date from the filename itself. This will work as long as the filename includes this information formatted like YYYYMMDDHHMM.

The output avi file gets stored in the current directory as out.avi. This should probably be changed to allow for a user defined output.

Specifying the files

Regular expression, what?

http://en.wikipedia.org/wiki/Regular_expression

It's not so bad. In this case we are doing something like wildcards in filenames, like *.* from the old days. Linux lets you be more specific, but we are doing the same thing. For instance to create a timelapse video of 9am-10am on a given day execute the following command:

  ~/bin/mkwebcamxvid mgvct-2007092909*

This will match all files from mgvct-200709290900.jpg to mgvct-200709290959.jpg.

To specify a more complicated range you can use braces:

   ~/bin/mkwebcamxvid mgvct-2007092906[3-5]*

Which will make a video with images from 6:30 to 6:59. To combine ranges or make things more complicated just add more regexes.

To go from 6:30am to 9:59 use the follow construction:

  ~/bin/mkwebcamxvid mgvct-2007092906[3-5]* mgvct-200709290[7-9]*.jpg

You can include multiple days by specifying the directory.

Personal tools