Coder Social home page Coder Social logo

timelapsebot's Introduction

About

24/7 recording timelapse bot in Golang, intended for Raspberry Pi.

This program is intended to be crash safe in that the only state that it uses is read from filesystem when the program is re-started.

This program also uses concurrency to try to ensure that the stills are taken at as fixed interval as possible - any background processing is done concurrently.

Running

$ go build timelapsebot.go
$ nohup ./timelapsebot &

TODO: systemd unit file

Background processes

  • Every 5 minutes, encodes all stills (currently ~60 stills / 5 mins) into a single video.
  • Every hour, combine those 5-min clips (12 x 5min = hour) into an hour-long video.
  • Every 24 hours, combine those hour-long clips (24 x hour = day) into a daily video.
  • When a new daily video is produced, upload that into AWS S3 and delete the video from SD card so disk use does not grow unbounded.

Install gstreamer

Gstreamer is required to take advantage of Raspberry's hardware encoding of h264 and decoding of JPEGs.

Otherwise, we could use something else like mencoder or libav.

With software encoding the first-gen Raspberry Pi (that I use for timelapses) would not be able to keep up.

TODO:

From here https://www.raspberrypi.org/forums/viewtopic.php?t=72435

$ sudo sh -c 'echo deb http://vontaene.de/raspbian-updates/ . main >> /etc/apt/sources.list'
$ sudo apt-get install libgstreamer1.0-0 liborc-0.4-0 gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gstreamer1.0-alsa gstreamer1.0-omx gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-base-apps gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-pulseaudio gstreamer1.0-tools gstreamer1.0-x libgstreamer-plugins-bad1.0-0 libgstreamer-plugins-base1.0-0

Install avimerge

$ apt-get install -y transcode
$ avimerge -v
avimerge (transcode v1.1.7) (C) 2001-2004 Thomas Oestreich, T. Bitterberg 2004-2010 Transcode Team

Optional LED support

LED is turned on for duration of still capture, so you can see the "heartbeat" and know that the rig is healthy.

LED support:

$ git clone git://git.drogon.net/wiringPi && cd wiringPi && ./build

# Test LED

$ gpio -g mode 16 output
$ gpio -g write 16 1 # off
$ gpio -g write 16 0 # on

# configure LED not to trigger on SD card activity, but GPIO only
$ echo gpio >/sys/class/leds/led0/trigger

# set GPIO #16 (the LED) as output mode
$ gpio -g mode 16 output

timelapsebot's People

Contributors

joonas-fi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.