A Pi camera that previews live while recording 1080p
I wrote Pi camera scripts for a small live preview while recording 1080p video, plus night-sky timelapses and still-image bursts. The main fix was sizing the capture buffer for the padded camera frame.
Results
1088rows per frame the buffer had to fit
10 minper night timelapse run
5stills per burst
The problem
The first scripts recorded at low resolution behind an on-screen button. Raising the resolution to 1080p crashed the preview with a buffer write error, and once it ran, the full-size preview window covered the whole screen.
What I did
- Traced the 1080p crash to the camera's frame padding and sized the capture buffer to the padded frame.
- A recorder that captures 1080p at 30 fps while showing a scaled 640×480 preview, with Enter to record a one-minute clip and Ctrl+C to stop cleanly.
- A night timelapse script: night exposure mode, fixed white balance, raised brightness, one frame per second, saved under a time-stamped name.
- A burst mode that grabs a set of night-exposure stills into a time-stamped folder.
What I took from it
The 1080p preview failed because the camera padded the frame to a multiple of 16 rows. The warning already described the mismatch. Correcting the buffer size fixed it.