pbewig
Posts: 10
Joined: Sat Jun 21, 2014 6:07 pm

Web-Based Security Camera

Tue Dec 09, 2014 1:24 am

My daughter recently had a break-in at her apartment (the thief stole a laptop and tablet, nothing else), and she asked that I arrange a security camera for her. I want a system that will be always available to view images in real-time over the internet, and also that will detect motion and send images to an off-site store for review, as well as email or text notification any time motion is detected.

I have a spare RasPi Model B (not B+), PiCam and wifi dongle. I've set it up with Raspbian Wheezy and dynamic DNS. But when I went looking for security camera software, I got very confused. One option seems to be a program called Motion by Jeroen Vreeken and Kenneth Lavrsen; it has a lengthy pedigree and is included in Debian stable. Another option is Mmal (I couldn't find the author) which is distributed as pre-compiled binaries and seems to be a part-time project for one programmer. A third option is MotionPie by ccrisan, which wraps a convenient front-end around Motion but is built as its own distribution and doesn't allow dynamic DNS to be set up. And there also seems to be a python script that provides similar functionality (actually, I'm confused enough that I'm not sure if there is a single python script or more than one).

I'm not sure of the current state of the art for this kind of software. Reading blog posts provides inconsistent information. Some blogs claim that motion works only with USB cams, not PiCam, but others claim otherwise, and the motion(1) web page specifically states that it works with the V4L driver, which is available for RasPi. I am leery of both mmal and MotionPie, since they are made as part-time efforts of single programmers and may not be maintained timely for the foreseeable future. As a programmer, I can read and maintain a python script, but I'm not sure which script provides a strong set of features, good security, and is future-proof.

Can anyone provide guidance? Either a statement such as "XYZ is the only option that will work for you because ...." or a series of statements such as "If ... is important to you, then you would probably prefer XYZ, because ...." If motion works with PiCam, I would probably prefer that because of its long history and inclusion in Debian, and because it seems to have all the features I need.

Many thanks,

Phil

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7019
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Web-Based Security Camera

Tue Dec 09, 2014 8:36 am

Standard motion works with V4L2. Yes it can work with the PiCamera by loading the V4L2 driver first (sudo modprobe bcm2835-v4l2).

MMAL is the Broadcom API for accessing the multimedia parts of the BCM2835 chip. Source for the ARM side is all in the userland repo. The GPU side is closed source.
This API allows a few more bells and whistles compared to V4L2, and someone has adapted motion to natively talk to MMAL instead of V4L2. Source is available - dozencrows seems to be the latest person to have tinkered, and has his source and build instructions at https://github.com/dozencrows/motion/bl ... UILD-HOWTO It's loosely based on the source for the standard raspistill and raspivid apps.
(The Pi V4L2 driver is also using MMAL to access the GPU. You can't avoid it totally!)

Both work well, so have a read of the source (in C) and instructions/documentation to see which best fits your needs.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

pbewig
Posts: 10
Joined: Sat Jun 21, 2014 6:07 pm

Re: Web-Based Security Camera

Wed Dec 10, 2014 12:35 am

Ah, I was missing the kernel driver. Got it. Works fine. Many thanks.

User avatar
dozencrows
Posts: 172
Joined: Sat Aug 04, 2012 6:02 pm

Re: Web-Based Security Camera

Wed Dec 10, 2014 12:52 pm

@6by9 - just to blow my trumpet, the 'someone' you refer to was me. I'm to blame for both the MMAL port and the tinkering :D

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7019
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Web-Based Security Camera

Wed Dec 10, 2014 1:33 pm

dozencrows wrote:@6by9 - just to blow my trumpet, the 'someone' you refer to was me. I'm to blame for both the MMAL port and the tinkering :D
Sorry for not giving you all the credit. I thought you'd picked it up after someone else had done the initial port, and was too lazy to do the forum search. I'll remember for next time ;)
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Camera board”