asgaut / skycam

Raspberry Pi simple all sky camera

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Skycam

This is my balenaCloud project to use a Raspberry Pi as a skycam.

Idea

Stream raw video data from a ZWO ASI120MM-S camera into ffmpeg and create one or more video files for each night.

Future plan: Autodetect fireballs and meteors using something like the Hough transform.

Links

https://ffmpeg.org/ffmpeg-formats.html#rawvideo

https://stackoverflow.com/questions/64025844/how-to-pipe-multiple-images-being-created-in-parallel-with-an-index-to-ffmpeg

My camera: https://astronomy-imaging-camera.com/product/asi120mm-s

Camera lib: https://astronomy-imaging-camera.com/software/ASI_linux_mac_SDK_V1.15.0915.tar.bz2

Development

ffmpeg h264_omx encoder on Raspberry Pi (32 bit Debian based OS) is hardware accelerated.

h.264 encoding tips: https://raspberrypithoughts.blogspot.com/2019/03/raspberry-pi-3b-video-encoding-with.html

Show h264_omx options: ffmpeg -h encoder=h264_omx

FFMPEG

GPU mem settings with BalenaOS on Raspberry Pi: https://github.com/balenalabs/balena-cam

Streaming and encoding mp4 video using hardware encoder on Raspberry Pi:

./zwostream | ffmpeg -hide_banner -f rawvideo -pixel_format gray8 -vcodec rawvideo -video_size 1280x960 -use_wallclock_as_timestamps 1 -i pipe:0 -movflags +faststart -c:v h264_omx -b:v 720k -vsync vfr -metadata creation_time=`date --utc +%FT%T`Z -y /tmp/raw-720.mp4

Software encoding 12 bit video:

./zwostream -p RAW16 | ffmpeg -f rawvideo -pixel_format gray12le -vcodec rawvideo -video_size 1280x960 -i pipe:0 -c:v libx264 -y video.mp4

Stream for Apple (https://www.martin-riedl.de/2020/04/17/using-ffmpeg-as-a-hls-streaming-server-overview/)

./zwostream | ffmpeg -hide_banner -f rawvideo -pixel_format gray8 -vcodec rawvideo -video_size 1280x960 -use_wallclock_as_timestamps 1 -i pipe:0 -movflags +faststart -c:v h264_omx -b:v 720k -vsync vfr -metadata creation_time=`date --utc +%FT%T`Z -f hls -hls_time 10 /tmp/balena/stream.m3u8

or with software encoding

./zwostream | ffmpeg -f rawvideo -pixel_format gray8 -vcodec rawvideo -video_size 1280x960 -i pipe:0 -c:v libx264 -crf 20 -preset veryfast -f hls -hls_time 4 /tmp/balena/stream.m3u8

Service containers

  • cam: Captures images and saves video to disk.
  • heatercontrol: Enables controlling the heating resistors via MQTT.
  • sysmon: Uploads various system monitoring parameters to a MQTT broker.
  • uploader: Plan: upload video files.
  • web: Make captured video available via HTTP.
  • wifi-connect: Configure the WiFi settings when the Skycam is not connected to any access point.

Required hardware

  • Raspberry Pi 2, 3, or 4
  • 16 GB+ Micro-SD Card
  • Power supply
  • Waterproof case with dome for camera
  • ZWO camera, for example ASI120MM-S
  • Temperature and humidity sensor for monitoring
  • Transistor controlled power resistors for heating

How to deploy this example to balenaCloud via git

git clone git@github.com:asgaut/skycam.git
git remote add balena <YOUR_BALENA_USERNAME>@git.balena-cloud.com:<YOUR_BALENA_USERNAME>/<YOUR_BALENA_APP_NAME>.git
git push balena master

How to deploy this example to balenaCloud via the balena CLI

  1. Install balena-cli
  2. Deploy this application via balena push

About

Raspberry Pi simple all sky camera

License:MIT License


Languages

Language:Python 77.5%Language:Shell 21.4%Language:HTML 1.1%