At A Glance Main Projects Tutorials Resume

Contact


Email: palen1c at gmail.com



Flex and Red5 Surveillance System


Recently my father was complaining of some things that were being stolen from a lot where he stores automobiles. This lot is rarely attended and it would be easy for vandals to slip in and out unnoticed. Thinking about the problem, I knew that I could help out using the stream recording functionality of Red5 and Flex. We had a really old computer laying around that wasn't being used, so I commandeered it for this project. Red5 is run locally and so is the flex client in a Firefox browser window.

Computer Specifications

CPU: Celeron 433Mhz
OS: Ubuntu 8
RAM: 256MB PC100
HD: 10GB
Integrated Graphics and Audio
Generic Webcam

My father is a typical older user that easily gets frustrated by complications in using a computer. Due to this, I created a little heart beat and new recording monitor to be used as a USB peripheral with the system. The software lights up an LED every 1 second when the system is monitoring for motion. New files are checked for every 30 seconds. If new files are found, a second LED will also flash indicating new videos.

The system will typically use around 100kb for a 10 second video. Because of the motion detection, video is only recorded when something is happening alleviating the need for massive amounts of storage. In testing, the system has proved to be moderately reliable so far.

Source Code

August, 2009
I have been contacted more about the source code for this project then anything else. I have decided to post it despite the fact that it is a mess. From what I recall, I built this based on red5 .7. The client side application is written using Flex. I used Flashdevelop with the free flex compiler. I think it's important to note that there is stuff from blitzagency in the source code that isn't used in this project. The Connection.as and SimpleConnector.mxml are modified pieces of code from John Grden's FLV player example for Red5.

If your new to Red5, or Flex, then I would suggest taking a look at the source code of my delayTest application before this one. This project uses abstraction that is confusing for beginners. In the delay test I wrote it from scratch with the intent of posting its source as an easy to understand flex project from the start. You can do two way broadcasting with it using Red5 as well.

Download the Flex and Red5 Source Code For This Project

A Little Bit About the Code

The zip archive contains the red5 application called "interactive_webcam" and the flex application that works with it called "FLEXSecurity_System". The red5 app was built on Red5 v7 I think. I have no clue if it will run on the latest because I havent done anything with it since a year and a half ago. In the red5 application there is a whole bunch of code inside manager.java for transfering images. That code has nothing to do with the application demoed in the video. Most of the serial port class also has nothing to do with what was demoed. I was just using it to transmit to the microcontroller that was blinking the LED's. The main code on the Red5 side is the timer that checks for new files inside the streams directory. The main code on the flex/as3 side is inside a class called "Recorder.as". The line of code using netstream.publish will inherently record a flv to Red5. You didn't used to have to write any special code to get this to record something on the red5 side of things. You used to be able to use the Red5 example Oflademo application for recording as well. I haven't used Red5 in a long time so I am not sure if it works how I have described it anymore.

" ns.publish("SecStream" + TimeComponent , "record");"

Good luck.

Comments

Charles
Charles
August 30, 2009 01:03 am

Source Code is now posted.

Charles
Charles
July 6, 2009 06:25 am

Thanks for asking Jonathan. I dug up the code for this and was planning on just putting a link to a zip file on here. After looking at the source, its very bad and wouldnt make sense. EX I use functions that I was using for other things to blink the LEDs. Specifically servo functions. If you really want it, contact me directly and ill just send it to you.

Jonathan
Jonathan
June 29, 2009 11:07 pm

Opensourced? This is neat. I would like to put something like this up at home.

hierro
hierro
February 19, 2009 8:50 pm

i'd like to do something with several Ip cameras, any hint or path to follow ?

Josh Dobbs
Josh Dobbs
November 18, 2008 12:55 am

This is very cool. I need to get around to playing with red5 soon! I want to write a similiar application that works with IP cameras.

Comments are currently disabled.