Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#350869 - 15/03/2012 17:27 Motion detection software
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
Is anyone familiar with any Unix-based software that can do motion detection in recorded video? I want a surveillance camera to record continuously, but would like to run some motion detection over the continuous files to generate timestamps that I can then feed into mencoder or something to get smaller files during times where motion was detected.

I found Motion, but it appears to want to operate on video streams directly from cameras using video4linux, not video files that are already recorded.

I don't think I need anything fancy, though the ability to mask off busy sections to be excluded from motion detection would be helpful.
_________________________
- Tony C
my empeg stuff

Top
#350880 - 16/03/2012 00:05 Re: Motion detection software [Re: tonyc]
gbeer
carpal tunnel

Registered: 17/12/2000
Posts: 2665
Loc: Manteca, California
It's linux, surely there is some way to trick it into accepting a stream from a file in place of the device.
_________________________
Glenn

Top
#350895 - 16/03/2012 11:12 Re: Motion detection software [Re: tonyc]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada


Edited by mlord (16/03/2012 11:14)

Top
#350955 - 17/03/2012 17:04 Re: Motion detection software [Re: mlord]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
It looks like those might work, but they both seem to require kernels built with CONFIG_VIDEO_V4L1_COMPAT, which seems to have been taken out in the 3.x kernel. I don't have a machine with 2.x kernel that would be suitable for the heavy CPU load of doing motion detection. I might be able to run a VM or something, but it'd be a bit of a mess.

Thanks for the suggestions, though.
_________________________
- Tony C
my empeg stuff

Top
#350959 - 18/03/2012 00:20 Re: Motion detection software [Re: tonyc]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
In what way are mid-stream 2.6.xx kernels not suitable ?

Top
#351176 - 28/03/2012 14:48 Re: Motion detection software [Re: mlord]
canuckInOR
carpal tunnel

Registered: 13/02/2002
Posts: 3212
Loc: Portland, OR
Originally Posted By: mlord
In what way are mid-stream 2.6.xx kernels not suitable ?

I don't think he's saying that the 2.6.xx kernels aren't suitable, just that all of his machines still using 2.x are a little too anemic on the hardware specs for motion detection.

Top
#351180 - 28/03/2012 16:16 Re: Motion detection software [Re: canuckInOR]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
Yeah, sorry, I meant to respond to this but got sidetracked.

The one machine I have that can handle this runs Ubuntu 11.04, which uses 3.x kernels. Rolling my own 2.6.x kernel for it means keeping that machine on 2.6 until these V4L loopback projects are upgraded to support 3.x kernels, which for my purposes means "indefinitely."

If it came down to that, I'd probably run a small VM with 2.6 on it just for this purpose and hope that it can handle the load. If it couldn't, I'd probably try experimenting with Xen virtualization and seeing if I could run two Xen nodes on it.
_________________________
- Tony C
my empeg stuff

Top
#352484 - 04/06/2012 12:40 Re: Motion detection software [Re: tonyc]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
Update:

I decided to try a different approach, since software motion detection options haven't been fruitful. The Foscam cameras I'm using can do their own motion detection, and though it's crude (can't mask off high-activity areas, really sensitive to shadows / changes in sunlight, etc.) it's better than nothing. They can send an email and/or upload still images to FTP when motion is detected, so I decided to try writing a script to parse the emails to get the start/end times for each motion detection event, then I calculate time offsets within the hourly video files based on those timestamps.

Unfortunately, I hit a snag there, too. The frame rates on the AVI files produced by my NAS's surveillance software are completely wacky. If I set the recording FPS to 15, the video files produced end up showing up as 8.0 FPS in mediainfo and mplayer. If I set the FPS to 5, they end up showing as 4.00 FPS. The playback time for a supposedly hour-long video ends up around 70 minutes (but varies), which makes mapping timestamps of the motion-cap emails to timestamp offets in the hourly video files nearly impossible.

Then a third, and probably much better solution hit me. Let the NAS do only the motion-detection events (since it has much better motion detect functionality built in) and use ffmpeg to record the hourly continuous recordings. It's a bit more manual (need to set up a cron job on the NAS, don't see the hourly recordings in the NAS's surveillance station UI) and it'll suck up more resources on the cameras (since during motion capture they'll be serving two streams, one for the motion capture recording and one for the continuous recording) but I don't expect those to be big problems. The continuous recordings are really just there if the motion detect misses something, so I can probably do those at a relatively low FPS to keep things lightweight.

As usual, I arrive at the right solution after exhausting every other possible alternative.
_________________________
- Tony C
my empeg stuff

Top