4

I looked into the documentation of the picamera and wondered whether there would be a way to use the splitter option to have the picamera capture a video in 640x480 and asynchronously capture stills in three different resolutions: 1296x972, 640x480 and 2592x1944. So far I am using this command to capture the video.

camera = picamera.PiCamera()
camera.resolution = (2592, 1944)
camera.framerate = 24
camera.start_recording(output, splitter_port=1, format='yuv', resize=(640,480))

I now run a web server with three endpoints in a different thread accessing the same camera object.

camera.capture('./hd.png', format='png', use_video_port=True)
camera.capture('./sd.png', format='png', resize=(1296,972), use_video_port=True)
camera.capture('./mb.png', format='png', resize=(640,480), use_video_port=True)

However this does not seem to work or rather it takes forever to take a still and sometimes it does not work at all.

  • 1
    PNG is not hardware accelerated on the Pi and takes ages to encode a full resolution image; use JPEG and things should be much faster (the GPU includes hardware acceleration for JPEG and H264 compression) – Dave Jones Apr 29 '17 at 13:30
1

Have you tried capturing in separate scripts? You could write a new script for each resolution you wanted, store the files and have them managed or run via a processing script. Will try and build this myself over the weekend and see if I can add some code to this answer, but the theory should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.