Time Lapse Video Processing Part 1 – From Stills

2013-03-17

San Felipe to Gonzaga Bay (after editing in Windows Movie Maker) on Vimeo.


I'm not a videographer, nor do I really aspire to be. I am, however, a gear-o-phile, and am enthralled by buttons and shiny things. One of those buttons captures video, leaving me with gigabytes of video, mostly driving, and diminishing free space on my drives and memory cards.

After collecting video clips for months, I decided to do something with them, but what?
I don't really have a concept or a project in mind. I am also constrained both by software (I don't have a decent editor) and hardware (a tiny laptop with an AMD E350 1.6GHz CPU).

For now, I've decided to solve my disk space problems by editing the video clips from my roadtrip down to 6-10x time-lapses. Chances are good that whatever I do with these clips, it won't involve a lot of real-time driving scenes, so the 10x time-lapses should be useful and take up significantly less storage.

Video Source Files:
  • JPEG stills taken in sequence
  • H.264 MP4 video (VGA and HD)
  • H.264 MOV video (HD)

Software:
  • ImageMagik – useful for batch processing still images
  • ffmpeg – the video swiss army knife. Useful for converting containers, formats and encoding.
  • VirtualDub – assembles time-lapses and applies filters. It may be possible to perform all processing in ffmpeg, omitting VirtualDub, but I haven't investigated this yet.
  • Windows Movie Maker – a basic (though the basics are done well) video editor that comes with some editions of Windows

I have some experience with VirtualDub, which is why I chose to use it to assemble the time lapses. However, VirtualDub natively only works with AVI and JPEG files. To process MP4 and MOV data files, you can either convert them to AVI using ffmpeg before processing in VirtualDub, or you can install the ffmpeg input drivers, allowing VirtualDub to open the files without prior conversion. I chose the latter.

Assembling Time Lapses from Stills

Using ImageMagick, Google Picasa, x264vfw (http://sourceforge.net/projects/x264vfw/), ReNamer (http://www.den4b.com/wiki/ReNamer), VirtualDub and Windows Movie Maker.

Resize Source Images


I start by resampling all of the images down to 1440x1080 resolution using ImageMagick. Mainly, I do this for disk-space – going from 1.5Mb to 200Kb makes a difference when I'm traveling with a small laptop with limited storage. While I haven't done a comparison to see if there are any overall performance gains, pre-processing and down-sampling the JPGs does make the VirtualDub step proceed faster.

The mogrify command, using this syntax, down-samples the images as they are loaded (theoretically the fastest method) and automatically adjusts contrast using auto-level.

mogrify "*.jpg[x1080]" -auto-level -quality 85

Once mogrified, I quickly skim through the stills and remove any I don't want included. This process is quicker on the down-sampled images than the originals, at least on this AMD E-350-powered laptop.

Finally, I rename all the images in sequential order. On Windows, this can be easily done using Google Picasa or ReNamer.

Load In VirtualDub


I assemble the stills into a 720 H.264-encoded AVI video using VirtualDub. From the VirtualDub main window, choose FILE->OPEN VIDEO FILE and select the first image in the sequence. Provided they are numbered sequentially, VirtualDub will open all of the images automatically.

Frame Rate


Frame Rate is a complicated subject depending on capture rates, focal lengths and movement in the scene.

The Contour Roam can capture stills but the built-in intervalometer only has one setting – 1 shot per second. For scenes that don't feature a lot of change from one shot to the next, such as people walking, this is ok. It may not seem obvious – but highway driving scenes also work well; the ribbon of highway doesn't move much from one frame to the next. Driving slowly, however, such as in town or on a 4x4 trail, and there is too much movement, resulting in a video that is either too herky-jerky or frenetic to watch.

The other downside to the Contour in this mode is that it is fully automatic. Some scenes may auto-expose or select white balance inconsistently as conditions change (such as when a cloud passes overhead). The shutter speed will likely be very fast. This eliminates motion blur so the resulting video will never be exceptionally smooth. A good rule of thumb for the shutter speed is to use the reciprocal of the playback framerate – 1/30th of a second exposures for 30fps playback. In bright sun, the Contour is shooting at 1/1000th or 1/2000th of a second.

The NEX-5 is fully programmable and produces much better results, though it does NOT have an intervalometer. It does have a continuous shutter mode and I have an add-on mechanical intervalometer for shooting night scenes.

For highway scenes captured at 1fps with the wide-angle Contour Roam, I assemble the stills at 15-30fps. For trails and other low-speed driving captured at 1fps, I assemble them at 6fps, though the resulting video isn't very smooth. I also use 6fps to assemble stills captured of subjects at portrait-distance with a 50-80mm lens using continuous shutter on the NEX-5. To get the files up to 30fps, I can interpolate the video files when edited later.

To set the frame rate in VirtualDub, choose Video->Frame Rate and set the Source Frame Rate Adjustment to your desired frame rate.

Resize


I have 1080 stills but I'm only creating 720 videos for now, so I down-sample them using the VirtualDub Resize filter.

Video->Filters->Add and select Resize. I am resizing only, no cropping or letterboxing is required as I am keeping the aspect ratio the same as the original.


Compression


From experimentation, I find that for 720 video, an average bit-rate of 7kbps with H.264 works well. I have not attempted to fine-tune the options further.

Video->Compression and choose x264 for Windows. I then set Rate Control to Single Pass ABR and set the bitrate to 7000.



I then save the videos (FILE->SAVE AS AVI) or batch them up to process overnight.

Final Editing


Once complete, I have the original files cut down to time-lapsed H.264-encoded AVIs. At this point, they are ready for editing with a non-linear editor, such as Windows Movie Maker (or better – AV Linux, Premiere or Final Cut Pro), to add transitions and soundtracks.

No comments:

Post a Comment