SkyLok/camera_example
2026-05-21 12:31:08 +02:00
..
camera.cpp ai fixed all our issues for now 2026-05-20 16:02:10 +02:00
deploy.sh camera deploy script and makefile and readme 2026-05-21 12:31:08 +02:00
event_loop.cpp camera example from libcamera git 2026-05-20 12:22:09 +02:00
event_loop.hpp camera example from libcamera git 2026-05-20 12:22:09 +02:00
flake.nix camera example from libcamera git 2026-05-20 12:22:09 +02:00
Makefile camera deploy script and makefile and readme 2026-05-21 12:31:08 +02:00
README.md camera deploy script and makefile and readme 2026-05-21 12:31:08 +02:00

camera_example

libcamera viewfinder (XRGB8888) -> libjpeg-turbo -> TCP. One client at a time.

Wire format: [uint32 BE jpeg_size][jpeg_bytes] repeating.

Knobs are constants at the top of camera.cpp (fps, quality, AF mode, lens position, port, resolution).

Build on the Pi

apt install g++ pkg-config libcamera-dev libevent-dev libjpeg-turbo8-dev
make

Cross-build (x86 -> armv6l) on a Nix host

nix build

The resulting binary links against /nix/store, so it only runs on a Pi that has those libs available (i.e. nix installed). For a vanilla Pi OS target, use the Makefile on the device, or ./deploy.sh user@host to rsync+build.

Receive

Any TCP client that reads the framed JPEGs. Quick check:

nc <pi-ip> 5000 | ffplay -f mjpeg -