Timelapse

Time Lapsing

I require long-term photography (for a worksite). I’ll be using an Android mobile phone (and power-bank or solar).

I settled on this process:

  1. App takes photos and saves locally
  2. App or sync uploads photos to Dropbox or similiar
  3. Cronjob runs every hour to:
    1. Combines 100s of images into a video, keeping all frames
    2. Deletes images (which are huge)
  4. Manually, I can check the videos, and choose to delete / edit / combine or slow down.

1. App to Take Photos

There’s a lot of apps, but few are suitable for longer-term use. The main problem is if the phone powers down without creating a video. There were good:

  • Timelapse Upload to Cloud
  • Timelapse 24/7
  • Open Camera
  • LapseIT Pro

Open Camera is really stable, has a simple timer feature and can set the focus. The timer is a countdown timer, so unfortunately images are 10s + photo time, which can vary. It has no scheduling or upload features.

Timelapse 24/7 was a bit buggy on my phone. It has better battery life, so would be good for 1 photo/min arrangement.

Timelapse Upload to Cloud was only a bit more stable. I didn’t use the Upload to Cloud function: this tries to upload immediately, requiring WiFi. Instead, I’ll run for 24hr, then turn on WiFi to upload in a batch.  Timelapse Upload to Cloud doesn’t add EXIF data to the images and occasionally crashed

LapseIT Pro is currently used. It appears stable and has lots of options and is simple to use. However, at the moment long-running captures sometimes stop (no crash). To find out more.

2. App to Upload

  • DropSync

Simple, solid.

3. Making movie from images

I wrote a command-line python program to do this. See details on this below.

It uses ffmpeg to create a movie. The Hx264 with defaults was a good format.

To deflicker, I used the ffmpeg deflicker filter when building the movie. The timelapse-defilter python script also worked well, but was slower.

Space and Time Requirements

Using the app below, I worked out a few scenarios. My details are:

  • 1920×1080 images: At 95% quality, this is about 0.3Mb.
  • ffmpeg encoding on defaults with H264 codec in AVI container.
  • No audio

I noted that:

  • 100fps or 24fps in the 1 hour video didn’t change the file size
  • At one photo per 10s, it’s 1Gb per day of images!
  • Convert to video, it’s 100Mb per day of videos
  • ffmpeg H264 defaults give 7000kbit/s (or ~1Mb/s?)

Choosing an interval:

  • 1s for driving, close people
  • 5s for sunsets, far people
  • 10s sun movement, or slow clouds
  • 1m plants
  • 10m construction (not activity)
Interval ThingDurationVideo Length Speedup
1sClose people1h2.5 min24x
5sFar people, fast clouds6h3 min120x
10sClose building, clouds6h6 min240x
30sSun,sky1day8 min 720x
1minPlants1 week7 min1440x
10minConstruction1 month3 min14400x

I selected 10s intervals for most things.

Real LengthInterval (s)# PhotosPhoto (Mb)Video Length
SpeedupVideoFPS (Max)VideoSize (Mb)
1h1036010012s3001008
10h (day)10360010002min30010050?
7 days (10h/day)?
1 month?

Making the Movies with FFMpeg

I wrote a command-line python program to control ffmpeg.  ffmpeg creates the movie.

Variable Frame Rate

This means you create a file with the duration of each image. For example
file 'discont-stamped/20190319133410293.jpg'
duration 0:00:10.050000
file 'discont-stamped/20190319133413274.jpg'
duration 0:00:00.050000

Then you use ffmpeg to combine them. For example:

ffmpeg -hide_banner -loglevel verbose -y -f concat -vsync vfr -safe 0 -i 2019-03-19T13_to_2019-03-19T13-dis-vfr.avi.images -vcodec libx264 -r 22 2019-03-19T13_to_2019-03-19T13-dis-vfr.avi

It’s tricky to get the framerate right if time-between-frames varies, and you want to keep all the frames. The “-r” options sets the output framerate (default: 25). The “-framerate” option is not uses, as the incoming framerate is defined by the duration between frames.

To take an example: 10 frames with 10 seconds between the 1st and 2nd, then 1 second. The average fps (real) is 10/(10+9) = 10/19 ~= 0.5fps. However, the maximum framerate is 1.0fps. ffmpeg will ‘pad’ the extra time between frames 1 and 2, effectively adding frames. To eliminate dropped frames, you must set “-r 1” in this case, instead of “-r 0.5”

One thought on “Time Lapsing

Leave a Reply

Your email address will not be published. Required fields are marked *