blog

RaspberryPI Motion detection - video player

This project combines a video player and motion detection.

The goal is to play a video in a loop, and if the camera detects movement, play another video.

Because the video acceleration on the Pi is still in its infancy, most of the frameworks/players don't support it yet. I've looked at Qt5/QML, VLC, ... gst123 even produced some lovely glitches:)

In the end I ran out of time and used omxplayer!

The integration was... amazing, too:)

Video Player

A script loops calls to omxplayer with the video file to play and checks a local memcache server for a variable. In another process I access the camera and calculate the difference between frames. If it's above the threshold, I set that variable in memcached. 

Movement detection

For the camera movement detection part I used opencv to configure the camera and fetch frames which was suprisingly easy considering this is not an x86 architecture. The positive sides of fully open source I guess.

 

So it's quite hacky, but there it is, working!

System configuration

For camera calibration I thought about using a simple keyboard and the up/down keys or something like that, but decided it was time to advance this. I setup the Raspberry PI to act as a wifi Access Point and created the control interface on its web server. This would allow any smartphone user to configure the system, or I could supply a small tablet preconfigured for that task.

#

#