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:
- App takes photos and saves locally
- App or sync uploads photos to Dropbox or similiar
- Cronjob runs every hour to:
- Combines 100s of images into a video, keeping all frames
- Deletes images (which are huge)
- 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
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)
|1s||Close people||1h||2.5 min||24x|
|5s||Far people, fast clouds||6h||3 min||120x|
|10s||Close building, clouds||6h||6 min||240x|
|1min||Plants||1 week||7 min||1440x|
|10min||Construction||1 month||3 min||14400x|
I selected 10s intervals for most things.
|Real Length||Interval (s)||# Photos||Photo (Mb)||Video Length||Speedup||VideoFPS (Max)||VideoSize (Mb)|
|7 days (10h/day)||?|
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
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”