772 B
772 B
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 -