Creating Time-lapse Videos on Ubuntu

I’ve previously blogged about how I sometimes setup a webcam to take pictures and turn them into videos. I thought I’d update that here with something new I’ve done, fully automated time lapse videos on Ubuntu. Here’s when I came up with:-

(apologies for the terrible music, I added that from a pre-defined set of options on YouTube)

(I quite like the cloud that pops into existence at ~27 seconds in) :)

Over the next few weeks there’s an Air Show where I live and the skies fill with all manner of strange aircraft. I’m usually working so I don’t always see them as they fly over, but usually hear them! I wanted a way to capture the skies above my house and make it easily available for me to view later.

So my requirements were basically this:-

  • Take pictures at fairly high frequency – one per second – the planes are sometimes quick!
  • Turn all the pictures into a time lapse video – possibly at one hour intervals
  • Upload the videos somewhere online (YouTube) so I can view them from anywhere later
  • Delete all the pictures so I don’t run out of disk space
  • Automate it all

Taking the picture

I’ve already covered this really, but for this job I have tweaked the .webcamrc file to take a picture every second, only save images locally & not to upload them. Here’s the basics of my .webcamrc:-

dir = /home/alan/Pictures/webcam/current
file = webcam.jpg
tmp = uploading.jpeg
debug = 1
local = 1

device = /dev/video0
text = popeycam %Y-%m-%d %H:%M:%S
fg_red = 255
fg_green = 0
fg_blue = 0
width = 1280
height = 720
delay = 1
brightness = 50
rotate = 0
top = 0
left = 0
bottom = -1
right = -1
quality = 100
once = 0
archive = /home/alan/Pictures/webcam/archive/%Y/%m/%d/%H/snap%Y-%m-%d-%H-%M-%S.jpg

Key things to note, “delay = 1″ gives us an image every second. The archive directory is where the images will be stored, in sub-folders for easy management and later deletion. That’s it, put that in the home directory of the user taking pictures and then run webcam. Watch your disk space get eaten up.

Making the video

This is pretty straightforward and can be done in various ways. I chose to do two-pass x264 encoding with mencoder. In this snippet we take the images from one hour – in this case midnight to 1AM on 2nd July 2014 – from /home/alan/Pictures/webcam/archive/2014/07/02/00 and make a video in /home/alan/Pictures/webcam/2014070200.avi and a final output in /home/alan/Videos/webcam/2014070200.avi which is the one I upload.

mencoder "mf:///home/alan/Pictures/webcam/archive/2014/07/02/00/*.jpg" -mf fps=60 -o /home/alan/Pictures/webcam/2014070200.avi -ovc x264 -x264encopts direct=auto:pass=1:turbo:bitrate=9600:bframes=1:me=umh:partitions=all:trellis=1:qp_step=4:qcomp=0.7:direct_pred=auto:keyint=300 -vf scale=-1:-10,harddup
mencoder "mf:///home/alan/Pictures/webcam/archive/2014/07/02/00/*.jpg" -mf fps=60 -o /home/alan/Pictures/webcam/2014070200.avi -ovc x264 -x264encopts direct=auto:pass=2:bitrate=9600:frameref=5:bframes=1:me=umh:partitions=all:trellis=1:qp_step=4:qcomp=0.7:direct_pred=auto:keyint=300 -vf scale=-1:-10,harddup -o /home/alan/Videos/webcam/2014070200.avi

Upload videos to YouTube

The project youtube-upload came in handy here. It’s pretty simple with a bunch of command line parameters – most of which should be pretty obvious – to upload to youtube from the command line. Here’s a snippet with some credentials redacted.

python youtube_upload/ --email=########## --password=########## --private --title="2014070200" --description="Time lapse of Farnborough sky at 00 on 02 07 2014" --category="Entertainment" --keywords="timelapse" /home/alan/Videos/webcam/2014070200.avi

I have set the videos all to be private for now, because I don’t want to spam any subscriber with a boring video of clouds every hour. If I find an interesting one I can make it public. I did consider making a second channel, but the youtube-upload script (or rather the YouTube API) doesn’t seem to support specifying a different channel from the default one. So I’d have to switch to a different channel by default work around this, and then make them all public by default, maybe.

In addition YouTube sends me a “Well done Alan” patronising email whenever a video is upload, so I know when it breaks, I stop getting those mails.


Delete the pictures

This is easy, I just rm the /home/alan/Pictures/webcam/archive/2014/07/02/00 directory once the upload is done. I don’t bother to check if the video uploaded okay first because if it fails to upload I still want to delete the pictures, or my disk will fill up. I already have the videos archived, so can upload those later if the script breaks.

Automate it all

webcam is running constantly in a ‘screen’ window, that part is easy. I could detect when it dies and re-spawn it maybe. It has been known to crash now and then. I’ll get to that when that happens ;)

I created a cron job which runs at 10 mins past the hour, and collects all the images from the previous hour.

10 * * * * /home/alan/bin/

I learned the useful “1 hour ago” option to the GNU date command. This lets me pick up the images from the previous hour and deals with all the silly calculation to figure out what the previous hour was.

Here (on github) is the final script. Don’t laugh.

Ubuntu Online Summit ‘Ask Rick and Olli’ Session

One of the things we’re keen to continue to push with Ubuntu is a spirit of openness and inclusivity. Over the last couple of years with the reduction in ‘in person’ Ubuntu Developer Summits it’s been said Canonical developers are harder to reach, and that we’re not communicating effectively our plans and designs for the future direction of Ubuntu. We’ve been trying to address this via increased blogging, regular email status updates and video updates from all areas of the community.

As always we’re also keen to hear feedback, we welcome email discussion on our lists, bug reports, design mock-ups and of course well tested patches. We also want to ensure people at every level are available for Q&A sessions on a regular basis. Jono Bacon had a series of Q&A sessions which the Community Team will continue, but with additional domain experts and leaders during those sessions.

One of the biggest visible areas of change for Ubuntu is the transition from Unity 7 on Compiz (used in 14.04 and below) and Unity 8 and Mir (to be used in future releases). So today this weeks Ubuntu Online Summit we’ve arranged a couple of sessions which we invited participation in.

At 14:00 UTC today Rick Spencer (VP of Engineering) and Oliver (Olli) Ries (Director of Unity & Display Server) will hold an Ask Rick & Olli session. Bring along your questions about Unity, Mir, convergence, future desktop direction and more.

image20140410_0014 se11r9kc283jyd14yz48

An hour later at 15:00 UTC we have a Convergence Progress Report session where you can get an update on where we stand with our converged vision, and of course participate on the hangout or via IRC.

Click the time links above to find out when these are happening in your timezone today, and the other links to join in the sessions at that time. If you miss it you can watch the sessions later using the same links.

Running Core Apps on the Desktop

One of the (many) challenges with creating a new mobile platform is that of bootstrapping app developers. The Ubuntu SDK – based on well known tools like Qt & QtCreator and supporting HTML5, C++ & GL – we can run our applications both on mobile devices and standard Ubuntu desktops.

With our convergence plans being a core component of Ubuntu over the coming releases, we can take advantage of this when testing mobile apps.

Developers can create & users can test applications without having to commit funds to a dedicated Ubuntu mobile device. Of course in the future Ubuntu mobile devices will be ubiquitous :) but for now we can support those users, testers and developers right now to use Ubuntu mobile apps on the desktop.

So with the Core Apps Hack Days just around the corner, now is a great time to install the core apps on your desktop and help test them, file bugs and contribute patches!

For users of Ubuntu 13.10 and Trusty (14.04) we have a Core Apps Daily PPA which has builds of all the core apps. Installing them is a cinch on 13.10 and 14.04 via the PPA & touch-coreapps metapackage:-

sudo add-apt-repository ppa:ubuntu-touch-coreapps-drivers/daily
sudo apt-get update
sudo apt-get install touch-coreapps

Note: This has been tested on 13.10 and 14.04 but not on previous releases.

If you later wish to remove them simply use sudo ppa-purge ppa:ubuntu-touch-coreapps-drivers/daily or just sudo apt-get autoremove touch-coreapps.

Once installed you should see icons for all the core apps in your dash

Music Reminders Calendar Clock Terminal File Manager Shorts Sudoku stock_icon_128 Dropping Letters

We welcome constructive feedback and bug reports about all aspects of the Core Apps. You can find us in #ubuntu-app-devel on freenode and details of where to file bugs can be found on the Core Apps wiki pages.

You can get started with developing apps on Ubuntu via the SDK, the documentation for which is at

March 2014 Core Apps Hack Days!

Hack Days are back!

On March 25th – 27th 2014 from 09:00 – 21:00U UTC we’re having another round of Core Apps Hack Days as we Sprint towards the final Ubuntu 14.04 release in April.

This time we’re concentrating our focus on 6 main apps, but we welcome new contributions to all the core apps. We’re identifying all the bite-size bugs which would be ideal for new developers, and we have some more chunky work for more experienced developers looking for more of a challenge. Getting involved is really easy and it’s fun and friendly.

Music & Reminders will be the focus on Tuesday 25th.

device-2014-03-21-103234  device-2014-03-21-103147

Clock & Calendar on Wednesday 26th.

device-2014-03-21-103454  device-2014-03-21-103341

Weather & Calculator on Thursday 27th.

device-2014-03-21-103716  device-2014-03-20-174002

That said, we don’t want to limit contributions to just those days, and of course welcome community developers getting involved at any time of day or night!

We’ve detailed on the HackDays wiki page how you can get involved and all the other details. Head over there for more information.

David, Michael & myself will be around on IRC in #ubuntu-app-devel as always to co-ordinate and run the Hack Days. We’ll also be able to test on multiple mobile devices as well as desktops and laptops. We can review code and get completed work landed into trunk and on devices promptly. We’ll also have and other Core Apps community & Canonical platform developers around to consult and mentor where required.

If you’ve ever considered developing on Ubuntu, but not got around to it, now is a great time to join. There’s plenty to do for people of all levels, developing Free Software for a very wide audience. Join us and lets make the Core Apps rock!

January 2014 Core Apps Final Hack Day – Weather and Terminal

See also Hack Day One – Reminders and Music, Day Two – Calendar and RSS Reader, Day Three – File Manager and Calculator and Day Four – Clock and Doc Viewer.

The Final Day of the January 2014 Core Apps Hack Days brings focus to Weather and Terminal but as I keep saying we welcome contributions to any app on any day of the week!





In order to get started we’ve come up with some suggestions for new developers.

First off get your development environment setup as documented at which you can do either natively on Ubuntu 13.10 or 14.04 or in a Virtual Machine if you prefer.
If you have a Nexus device, you could either replace the legacy OS with Ubuntu using either of these guides – or

Next up take a look at some of these suggestions based on your area of interest and skill level.

We welcome translations for all our Core Apps. If that’s if interest you can find everything you need at and

If you find bugs in the apps you can look for existing bugs to confirm or fix at and, or file new bugs at and

You may find some bugs which have yet to be confirmed or triaged, we’d love your help there too.

You’ll find out-standing merge proposals on launchpad at and

If you’d like to take on a task then we have some work items in the blueprints which you can assign to yourself and get cracking on at and

You can find out more about the Core Apps Hack Days at the links at the top, and you’ll find all of us hanging out on #ubuntu-app-devel on freenode.