One of the biggest problems with the built in commands for using the Raspberry Pi Camera module is that you can’t stop a recording after an unknown time. You can record for a given number of seconds and that’s it. I have attempted to solve this problem by backgrounding the initial record process with a time of 27777.8 hours (99999999 seconds) when it’s time to stop recording, the process is manually killed using pkill.
Here is a test of my code, which I’ve called CameraModulePlus (written in python) which takes two videos, one for five seconds, and one for ten seconds, with a 10 second delay in between.
from CameraModulePlus import CameraModuleVideo
from time import sleep
v1 = CameraModuleVideo("/home/pi/CreatureCapture/", "video1")
v2 = CameraModuleVideo("/home/pi/CreatureCapture/", "video2")
except ValueError as e:
Here is a result of the 5 second duration test:
Here is a result of the 10 second duration test:
As you can see, it works pretty good for how barbaric it is. The full class for CameraModuleVideo can be found here. In the future, I’d like to encode a lot more data into the CameraModuleVideo class, things about time etc. Also I would like to monitor available space on the device to make sure there is enough space to record.