How to take images with Raspberry Pi since "raspistill" and "raspivid" are deprecated

2.6k views Asked by At

Since the Raspberry Pi is transitioning from using the old raspistill and raspivid to the newer libcamera how should I take an image now if I don't want to use the CLI nor C as programming language? I can't find any wrapper for libcamera in any language other than C and the new official Picamera2 library is also in an alpha phase and not recommended for production use.

I am also using a 64-bit version of the Raspberry Pi OS so I can't use the legacy camera interface. I could downgrade to 32-bit but where is the point in deprecating the old system if the new one is clearly not ready for productive use.

How do you guys handle using the camera of the Raspberry Pi at the moment if you want to use a wrapper like Picamera? Am I missing something?

2

There are 2 answers

1
Mark Setchell On BEST ANSWER

At the moment, the best way, if you want to use bullseye, is probably to run libcamera-vid and pipe the output from that into a Python script. You can either use a subprocess() call, or just start a pipeline:

libcamera-vid <params> | python script.py

Be sure to read from sys.stdin.buffer like here to avoid CR/LF mangling.

Probably choose a YUV-based format to ensure frames are a deterministic length, as opposed to MJPEG where the frame length will vary according to image content and you'll have to search for JPEG SOI/EOI markers.

5
eldavo On

Did you try to see if the cam utility is installed?