The PiVideo software is our current solution for communications with the PiCapture boards. It is Python based, and consists of two parts:
- pivideo.py (the command-line program)
- pivideo_class.py (the library of interface routines which is used by the command line program, but is also useable by your software)
Using Python, you can communicate with PiCapture with a few lines of code:
Import pivideo_class (import the class)
vid=pivideo_class.PiVideo() (create the object)
vid.pivideo_port=”i2c1” (specify the port to use, matching the jumpers)
pivideo_port=vid.open (open communications)
Now, you can use the “vid” object for whatever information you need, such as:
In this case “mode” represents the camera mode for detected video, or zero if no video. This call can be repeated to detect when there is a mode change or loss of video.
All of the information that you get when issuing the command “pivideo -q all -v” is available through the python class.
We suggest referring to pivideo.py to see how to use pivideo_class.py.