Various examples to record video on Raspberry Pi using the Raspberry Pi camera and a button or PIR sensor to trigger recording.
Written in Java.
git clone https://github.com/joe-akeem/raspi-cam.git
cd raspi-cam
mvn install
mkdir /home/pi/capture
only needed if a remote debugger shall be connected:
export MAVEN_OPTS="-Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=6006"
- Start the camera by pushing the button, stop it by releasing the button -> the button must be connected to GPIO02 (27)
sudo mvn -PbuttonCam install exec:java
- Play a sound when the PIR notices movement -> the button must be connected to GPIO02 (27)
sudo mvn -PwelcomeSound install exec:java
Videos end up in /home/pi/capture
omxplayer filename.h264
E.g. on Ubuntu:
sudo apt-get install gpac
MP4Box -add filename.h264 filename.mp4