Skip to content

ronguest/window-on-weather

Repository files navigation

Time-lapse Video Project for Raspberry Pi

This project was created in order to collect time-lapse videos of the sky outside my house on a continuous basis (24/7). It could be used to collect time-lapse video of anything but this is the purpose for which it was built.

Required Hardware

  • Raspberry Pi with WiFi or Ethernet (I used a Pi B2 with a TP-Link WiFi adapter)
  • Raspberry Pi camera (I used a V1 camera but V2 should work as well)
  • Micro SD card (I started with an 8GB card but it wasn't large enough. 16GB would have worked but I had a 32GB handy and used that)

You should have a web server configured as well as having enabled the camera. I find it easiest to work with the Pi over SSH rather than using a display+keyboard+mouse. If you feel the same you will also need to enable SSH access. The Pi webserver is assumed to store it's files in /var/www/html. The "wx" directory needs to be created manually within that directory.

For camera installation instruction refer to this web site.

Software Components

  • crontab entries to launch the necessary scripts on a schedule
  • Three shell scripts
    • capture_wx.sh - captures a series of GIF images then combines them into an animated GIF and calls video.py to create a separate MP4 time-lapse
    • compile_wx.sh - runs once an hour and combines the previous hour's MP4 time-lapse into a single file
    • delete_wx.sh - runs once a day and deletes the video files created 2 days prior
  • One Python script
    • video.py - records time-lapse in MP4, called from capture_wx.sh
      • Note: If raspivid is used directly the first frames are highly over-exposed while auto-exposure makes adjustments. video.py records and throws away a few seconds of video to avoid this issue before recording the time-lapse.

Installation

  • In /home/pi create a directory named wx_video
  • Make sure /var/www/html/wx exists and the current user has read and write permission
  • Place the three shell scripts and the video.py script in that directory
  • Run crontab -e and place the final three lines from crontab.txt into the crontab

Once everything is installed and running visit your Pi's webserver IP and append one of these strings to access the files:

  • wx/current.gif will display the most recent GIF (recorded every 10 minutes if you use my crontab entries)
  • wx/current.mp4 displays roughly 2 minutes of real time into a 10 second MP4 time lapse (also updated every 10 minutes)
  • wx/current_hour.mp4 displays a compilation of the previous hour's MP4 files (five 10 minute time lapses)

If your Pi has IP address 192.168.1.73 and your web server is using the default port then visiting http://192.168.1.73/wx/current.gif with your browser should load the most recent GIF.

About

Collects time-lapse GIF and MP4 videos using Raspberry Pi and the Pi Camera. I use it to capture the sky/weather

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published