This is my balenaCloud project to use a Raspberry Pi as a skycam.
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.
https://ffmpeg.org/ffmpeg-formats.html#rawvideo
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
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
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
- 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.
- 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
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
- Install balena-cli
- Deploy this application via balena push