That is the package that I would suggest using. One advantage is that the camera initialization is only performed when the object is created and so it is faster and may be more reliable.
Please note that you need to fully initialize the camera properties when using the picamera package, including (most importantly!) the camera mode. For example:
camera.resolution = (1920, 1080)
camera.sensor_mode = 1
camera.exposure_mode = ‘off’
camera.awb_mode = ‘off’
camera.awb_gains = (1.0,1.0)
You can then use the PiVideo module to make sure that video is active/ready before performing the capture, with something along these lines:
sleep(30) # Wait until time for the next capture
while not vid.ready:
print(“Video source is not ready”)
All of this is a suggestion that may help improve stability in a production environment, but there are certainly other approaches.
If you need additional assistance with the script please contact us via email and we will help if we can: email@example.com