Friday, February 7, 2014

My first Time-Lapse Experiment

Well, my new camera (Panasonic DMC-GX7) has two features I've never had before: stop-motion and time-lapse. The only difference seems to be: the minimum time between the shots is either 1 second or 1 minute - and if there is an "open end" or a fixed number of pictures.

Searching around online, the most important thing to do is to take the shots in manual mode. The reason is, that you do not want to have this flickering. So well, that's easy to do in manual mode: exposure, aperture, ISO and of course the focus. What I didn't read (or didn't notice), but should have done is to also fix the white-balancing! So, in case you want to try this, set it the white balancing to manual.

One cool thing of doing this in stock motion on my camera is, that it automatically converts the images to a movie. Only for one sequence I had to do it on my computer, because the camera wasn't responsive or I've confused it. So, in case you are on a Ubuntu Linux like I am, here is what to do: First, don't bother with ffmpeg or avconv: they are too old and do not have the flag "-start_image" to set the first number of the counter. This sucks!

So instead: mencoder:
Start by moving all the images in a separate directory, then the "P*.JPG" regex pattern matches all your images in alphabetical order. Easy.

$ mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:autoaspect:vqscale=3 -vf scale=1920:1080 -mf type=jpeg:fps=5 'mf://P*.JPG' -o OUTPUT.avi
=> see update below

If you have better ideas for the command-line, please post it. fps=5 is for the number of frames per second. I think the quality should be set higher, but no idea which of the switches does this in a sane way.

Now enjoy these three YouTube videos from Vienna (Parlament and City-Hall):


There is indeed a much better mencoder setting, using x264:

$ mencoder -nosound 'mf://P*.JPG' -mf fps=10:type=jpeg -ovc x264 -x264encopts preset=slow:tune=animation:crf=20 -vf scale=1440:1080 -o time-lapse.avi

Options (for more, check the manpage)
  • fps=10: 10 pix/second. 5 is also ok, 20 if you have really a lot of pics.
  • tune=animation: sounds reasonable, there is also "film"
  • crf=20: recommended switch for setting the quality, could also be 10 or 20, ...
  • -vf scale: that could be something different, depends on what you have. (960x720)