<< Bandwidth testing of LACP bonding link in Linux with iperf | Home | Running multiple Tomcat instances on Debian Lenny >>

Hvar, Croatia Video - Time Lapse Photograph Experiment

Bookmark and Share

"The" wife and I went on holiday to Hvar, Croatia earlier this month. We stayed at a quant little flat in town halfway up the karst hillside with an amazing view. So, having brought my camera, tripod and Arduino-based intervalometer, I setup my kit and made a few short clips.

This is my best results yet! That said, I did learn (and relearn) a few lessons for next time:

  • Must put the camera into full manual mode. Any automatic settings (speed, aperture, etc.) result in flickering in the video. Semi-automatic modes are not good enough.
  • Manually focus once and leave it. The auto focus takes a variable amount of time (leading to inconsistant intervals) and different focal lengths from frame to frame.
  • The tripod, a cheap aluminum model, with vertical extension is too wobbly. The movement shows up when zoomed in with the 135mm lens. Keep the vertical extension collapsed.
  • Stop using the 'small & coarse' JPEG image quality setting. The compression leaves unsightly artifacts in large, low contrast areas of the photos, like sky & cloud backgrounds.

One thing that kind of bugs me about the Canon is the camera's system of storing photos in sub folders with only 100 stuff each. This is probably because the image file name number maxes out at 9999, another irritating problem because movies can easily be the composite of 10,000+ frames. To resolve both of these issues, I've written a little Bash script that copies the stuff into a single target folder and renames them starting from 00001 (a requirement for FFmpeg).

#!/bin/bash
set -x
id=0
for dir in raw/*CANON
do
    echo "Processing directory $dir"
    for file in $dir/*
    do
        echo "Processing file $file"
        id=$(($id+1))
        name="$(printf "%04d" $id)" 
        
        cp -v $file "orig/$name.jpg"
    done
done

After some processing (resizing, namely) I ran the below FFmpeg command used to compose the movie from the stuff. It uses h264, my favorite video codec, and decent quality settings.

manoa:orig stu$ /opt/local/bin/ffmpeg -f image2 -i %05d.jpg -vcodec libx264 -f mp4
   -flags +loop+mv4 -cmp 256 -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8
   -me_method hex -subq 7 -trellis 1 -refs 5 -bf 0 -flags2 +mixed_refs -coder 0 -me_range 16 
   -g 75 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10 -qmax 51 -qdiff 4  -r 25 -an 
   -b 1280kb -y hvar.avi
FFmpeg version UNKNOWN, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --enable-pthreads --enable-libx264 --enable-libmp3lame --enable-libfaad
    --enable-libfaac --disable-ffplay --disable-ffserver --disable-static --enable-shared 
   --enable-nonfree --enable-gpl --enable-postproc --enable-hwaccel=mpeg2_vaapi 
   --enable-hwaccel=mpeg4_vaapi --enable-hwaccel=h263_vaapi --enable-hwaccel=wmv3_vaapi 
   --prefix=/opt/local --extra-cflags=-I/opt/local/include 
   --extra-ldflags=-L/opt/local/lib
  libavutil     50. 3. 0 / 50. 3. 0
  libavcodec    52.35. 0 / 52.35. 0
  libavformat   52.38. 0 / 52.38. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0
  built on Dec 15 2009 17:01:07, gcc: 4.0.1 (Apple Inc. build 5493)
Input #0, image2, from '%05d.jpg':
  Duration: 00:07:05.96, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: mjpeg, yuvj420p, 1280x720 [PAR 72:72 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
[libx264 @ 0x1028600]using SAR=1/1
[libx264 @ 0x1028600]using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
[libx264 @ 0x1028600]profile Baseline, level 3.1
Output #0, mp4, to 'hvar.avi':
    Stream #0.0: Video: libx264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=10-51, 1280 kb/s, 25 tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=10649 fps=  5 q=16938494.0 Lsize=   73318kB time=425.96 bitrate=1410.0kbits/s    
video:73233kB audio:0kB global headers:0kB muxing overhead 0.115394%
[libx264 @ 0x1028600]frame I:162   Avg QP:28.94  size: 82562
[libx264 @ 0x1028600]frame P:10487 Avg QP:31.99  size:  5875
[libx264 @ 0x1028600]mb I  I16..4: 31.0%  0.0% 69.0%
[libx264 @ 0x1028600]mb P  I16..4:  2.4%  0.0%  0.7%  P16..4: 32.4%  5.3%  2.2%  0.0%  0.0%    skip:56.7%
[libx264 @ 0x1028600]final ratefactor: 29.67
[libx264 @ 0x1028600]coded y,uvDC,uvAC intra:36.9% 27.2% 12.7% inter:6.6% 2.1% 0.1%
[libx264 @ 0x1028600]ref P L0  48.7% 18.1% 16.8%  7.9%  8.4%
[libx264 @ 0x1028600]kb/s:1408.4
manoa:orig stu$ 

Once the video was uploaded to youtube.com, I added the sound with YouTube's AudioSwap functionality. That feature is very convenient for adding audio to these movies. It sorts the available audio clips into a logical set of categories, has a search function and a "find sound tracks about the same length as my video" option.



Re: Hvar, Croatia Video - Time Lapse Photograph Experiment

Good information, neat video. Maybe just say what frame rate you were using. I have started to play with CHDK on my point-and-shoot for an intervalometer, it's worth checking out for all Canon users. A quick test at http://www.youtube.com/watch?v=pH6dTFDNJUM

Add a comment Send a TrackBack