Weekend hacking: Homebrew security camera with infinite recording length

24 January, 2011 § 1 Comment

I’ve seen people use security cameras before. Most cameras are set up in a way where the user puts in a VHS tape, presses record, and repeats this process over. If something happened during the recording, the tape will be saved as evidence, otherwise it will be rewound and recorded over again.

This always seemed like a lot of work for something that is purely reactionary. Let’s look at the scenario again. The user is proactively doing a lot of work in the hopes that they will be able to react. Put another way, if you make 20 dollars an hour, over a given month you might spend five or six hours rewinding and pressing record. If there is less than 100 dollars of damage caught on tape, then it wasn’t worth it.

So how about a different solution? At midnight on Friday I decided I would find something better. I had in mind a security camera that kept a circular buffer of the last 8 or so hours. If nothing happened then it would just overwrite what it had previously recorded.

Unfortunately I had no luck finding such a program on the internet, so I decided to write one myself. I first came across OpenCV, which is a free computer vision library. OpenCV is really powerful (and might be a lot of work). I sure didn’t want to write this in C++. Luckily I found technobabbler’s tutorial on how to make a simple webcam application using Python.

I followed the tutorial and had a simple application running that could save a snapshot from the webcam with a simple click of a button. By 4:30am I had a working prototype that was doing just what I wanted.

Using Python 2.5, VideoCapturePILpygame, and FFmpeg, I am able to keep the last 24-hours of snapshots (at 10 frames per second). If I ever want to save those 24 hours for reference, I simply hit the letter ‘s’ on the keyboard.

I’ve made this script open-source under the GPL license and hosted it at Google Code. Let me know what you think.

YouTube Playlist Downloader source code will be released

29 May, 2009 § Leave a comment

As I continue to work on making more of my source code open, I will be making all of the source code for the YouTube Playlist Downloader open source. You can expect to see a post up here soon with a link to the source files, and I will also cover some of the technologies used in more depth.

In the meantime, here is a very general overview: YouTube Playlist Downloader (YPD) was a project that I took up to learn Windows Presentation Foundation (WPF). It uses WPF for the user interface and all the animations. Windows Presentation Foundation was released with Microsoft .NET 3.0, which is why there is a requirement for this version of the framework. To get the list of videos in a playlist from YouTube, an external RSS web services is used. The files are then downloaded, and transcoded using FFmpeg.

That’s about the shortest technical overview I could give, and probably still left out too much. Look forward to some code walkthroughs in the next week or so. I haven’t made up my mind yet if it will be available as a .zip file or something where you can browse the source code online ala Google Code.

Where Am I?

You are currently browsing entries tagged with ffmpeg at JAWS.

Follow

Get every new post delivered to your Inbox.

Join 1,004 other followers