rpi-camera-timelapse-go

Timelapse image capture daemon for Raspberry Pi Camera Module, built with Go

Stars
11
Committers
3

Raspberry Pi: Timelapse Camera Daemon

0. What is it for?

It is for capturing images with some interval, using Raspberry Pi Camera Module.

These captured images can be used as each frame of a timelapse video.

1. What do I need before running it?

You need:

2. How can I configure it?

You need to create your own config file.

Sample file is included, so feel free to copy it and change values as you want.

$ cp config.json.sample config.json
$ vi config.json

You can configure it to save files locally, send via SMTP, upload to Dropbox or S3 like this:

"storages": [
	{
		"type": "local",
		"path": "/home/meinside/photos/timelapse"
	},
	{
		"type": "smtp",
		"smtp_recipients": "[email protected],[email protected]",
		"smtp_email": "[email protected]",
		"smtp_passwd": "sender-email-password",
		"smtp_server": "sender.smtp-server.com:587"
	},
	{
		"type": "dropbox",
		"path": "/timelapse",
		"dropbox_token": "Tttttttt_oOOOOOOO-kkkkkkkk-eeeeeee_NNNNNNNN"
	},
	{
		"type": "s3",
		"path": "/optional/directory/in/bucket",
		"s3_bucket": "my-s3-bucket-name"
	}
]

When not needed, just remove the unwanted one from storages.

3. How can I build it?

A. Manually

$ go get -d github.com/meinside/rpi-camera-timelapse-go
$ cd $GOPATH/src/github.com/meinside/rpi-camera-timelapse-go
$ go build

B. With docker-compose

a. Raspberry Pi 3B, 3B+, 4B

$ docker-compose build

b. Raspberry Pi 2

$ docker-compose build --build-arg RPI=raspberry-pi2

c. Raspberry Pi B / Zero

$ docker-compose build --build-arg RPI=raspberry-pi

4. How can I run it?

A. Manually

Just execute the compiled binary:

$ ./rpi-camera-timelapse-go

If nothing goes wrong, images will be captured and stored periodically as you configured.

B. With docker-compose

$ docker-compose up

4. How can I run it as a service?

A. With systemd

$ sudo cp systemd/rpi-camera-timelapse-go.service /etc/systemd/system/
$ sudo vi /etc/systemd/system/rpi-camera-timelapse-go.service

and edit User, Group, WorkingDirectory, and ExecStart values.

You can simply start/stop it with:

$ sudo systemctl start rpi-camera-timelapse-go.service
$ sudo systemctl stop rpi-camera-timelapse-go.service

If you want to launch it automatically on boot:

$ sudo systemctl enable rpi-camera-timelapse-go.service

B. With docker-compose

$ docker-compose up -d

5. How do I merge captured images to a timelapse video?

Use ffmpeg:

$ ffmpeg -framerate 30 -pattern_type glob -i '*.jpg' -c:v libx264 timelapse.mp4

998. Any trouble?

Please open an issue.

999. License?

MIT