How to stream full resolution, full quality, HDR jpegs from a raspberry pi camera v3 to LAN

July 16, 2024, 10:23

scottyn91

I have a raspberry pi zero 2 W and a raspberry pi camera v3 wide that I mainly want to use for timelapse purposes with home assisstant. There are 2 ways that I'm aware of to do this: 1. One way to do this is for the pi to constantly send a stream of images to the HA server (another rpi), and then HA can save the current image from the stream when the appropriate HA condition is triggered. 2. The other way would be to only take one image when it is requested by HA, and then store that image locally on the pi and create the timelapse at the end. The issue here is that I'm not sure how I can get the timelapse pi to read the states of the HA server and then take a new timelapse jpeg when the state changes to the right value. In both cases, I want the camera to take still images in full resolution (4608x2592), full jpeg quality (e.g. the default quality factor of 93), HDR on and with autofocus turned on. I know rpi cam v3 can normally only do HDR with a max of 2304x1296, but I don't mind if the camera has to wait to take multiple photos at different exposures quickly after each other at the full resolution of 4608x2592 and then combine them to create an HDR image. So far I have tried to use [Pi MJPEG Server](https://github.com/kingkingyyk/Pi-MJPEG-Server) to create the continuous image stream, and while there is very little lag on the stream and it doesn't use much memory or CPU, it won't start a stream if I set it to the full resolution (4608x2592), it won't do HDR, and the stream quality is not that great because it has pixelation/blockiness, whereas if I take a still image with libcamera-still the quality is much better. The other way I have tried is to use a dev version of motioneye on 64bit rpi OS bookworm, and while I was eventually able to get motioneye to boot up and get an image from the rpi cam, it took a lot of CPU and memory to even show the camera at 4608x2592 with motion analysis turned off, and this caused the pi to constantly write to swap and lag.