February 22, 2008

Time-lapse photography with dvd-slideshow

Author: Chad Files

Over the last few years I have been experimenting with time-lapse photography. One easy way to compile a time-lapse video is to use dvd-slideshow, a tool for creating video slideshows from digital photos, and more.

To get started, copy your photos into a single directory on your computer, then use dvd-slideshow's dir2slideshow utility to create the control file that dvd-slideshow needs. The -n flag tells dir2slideshow what to name the slideshow:

dir2slideshow -n "Time Lapse Video" /path/to/photos

When dir2slideshow finishes, it leaves a text file in the current directory whose name closely matches the name you provided; underscores replace spaces and special characters in the name. If you edit the file you'll see several lines at the beginning that provide a title and some fade effects to the video when it is rendered. I suggest removing these; you can always go back and add titles later. Also check the last few lines and decide whether you want to remove the additional effect commands there. When you are finished, every line should look something like the following:

./IMG_***.JPG:5

These lines tell dvd-slideshow where to place the images and how long to display them, in seconds. Depending on the target length of your video you may need to change the duration for each image.

This is where things can get tricky. Suppose you estimated a video would take 720 photos, but it really took 912 -- the actual number for the video of ice melting in the figure. If we used them all in a 30-second video, they'd have to go really fast. Instead, I changed the length of the video to 60 seconds. Divide the number of seconds the video needs to be by the number of photos. For the ice melting that means 60/912 = 0.0657. dvd-slideshow balks if you give it more than three numbers to the right of the decimal point, so round off the number. This step takes some practice; don't be discouraged if the result is not what you want the first time.

Once you have a figure for the duration, you can replace the default value in the control file by using a small sed command:

sed 's/:5/:\0.066/g' Time_Lapse_Video.txt > New_Time_Lapse_Video.txt

Finally you're ready to make the video with dvd-slideshow. If you have several hundred photos this will take a while:

dvd-slideshow -f New_Time_Lapse_Video.txt

The command above should produce a video named Time_Lapse_Video.vob. This file is just a DVD quality MPEG video; the vob extension is what DVD players use. You should be able to view the video with most of the standard Linux video players, such as Xine, MPlayer, and Totem. Most of the major video sharing Web sites, such as YouTube and Google Video, will accept the vob file and convert it to a Web-playable version automatically.

Once you know how to use dvd-slideshow to create a time-lapse video, you can start doing other interesting things. With dvd-slideshow you can add audio, titles, and effects to the video by editing the control file before you run the dvd-slideshow command. You can read more about the parameters in the control file on the dvd-slideshow Web site.

Dvd-slideshow also creates a dvdauthor stub when it runs. This file can be incorporated into a dvdauthor control file to eventually make a DVD disk image. The name of the stub is the same as the dvd-slideshow control file, except it has an XML extension.

If you want to do more in-depth video editing, you can use ffmpeg to create a raw digital video (DV) version of the video that you can edit with Kino:

ffmpeg -i Time_Lapse_Video.vob -target ntsc-dv Time_Lapse_Video.dv

With ffmpeg you can convert the video to all sorts of formats and sizes. I encourage you to look at the ffmpeg documentation for more information.

Creating time-lapse videos with Linux is not only possible but not that hard to do.

Category:

  • Graphics & Multimedia
Click Here!