Showing posts with label CCTV. Show all posts
Showing posts with label CCTV. Show all posts

Tuesday, 5 June 2012

Motion webcam two webcams change order on boot /dev/video0 persistent linux ubuntu

Copied from various resources on the web, Original Reference Here

When using Motion http://www.lavrsen.dk/foswiki/bin/view/Motion with multiple usb webcams, sometimes the dev order of the webcams changes on reboot of a machine. 

i.e.  /dev/video0 becomes dev/video1

This can seriously stuff things up.  To overcome this, create a udev rule to lock/assign a device dev location.

First do a lsusb, notice that I have two webcams, one is built into the screen and the other is USB connected.



Take note of the ID of the webcam you want
i.e 045e:00f7


Now do a:
sudo touch /etc/udev/rules.d/25-name-video-devices.rules


Edit this file and enter the following:
SUBSYSTEM=="video4linux", BUS=="usb", SYSFS{idVendor}=="045e", SYSFS{idProduct}=="00f7", NAME="video5"


I assigned the webcam to give a default location of /dev/video5 so it would never conflict with other webcams fitted in the future (hopefully)

Don't forget to modify your ~/.motion/motion.conf file and change the video device to /dev/video5


What happens if you have two webcams and they are both the same?  Fuuuuuuuuuuuuuuuuu!!!!!!!!!!!!!!!

WindyCityTech Blogger
WindyWindyCityTech Wordpress

Wednesday, 16 March 2011

Build a Cheap/easy Linux based Motion Detection CCTV system



This is a guide for those that want to build a cheap CCTV server for your home or business.

It uses a analogue camera to do two things:
  • Motion capture surveillance footage only when needed
  • email pictures of captured footage to you inbox

It requires some computer skills, but you probably will be smarter afterwards.

Hardware Required:
  • Asus EEE PC 701 Netbook $260
  • Easycap DC60 USB Video Capture Adapter $8.90
  • Video Camera $0 free

I picked the netbook up online from www.catchoftheday.com.au and figured it would be useful for some small project. It sat around doing nothing for a while until I was given a camera for free. I thought the two would be perfect for a CCTV project. The camera had a composite video output so the first task was finding a cheap video to usb adaptor. I picked one of these up from www.dealextreme.com after checking that there were Linux drivers available.

Software:
  • Ubuntu 10.04 LTS netbook remix
  • driver for the usb adaptor
  • motion
  • mutt
  • msmtp

The netbook came installed with Xandros. I replaced that with Eeebuntu 3.0 soon after I got it but that distro is getting a bit old. For this project I wanted something that was still being maintained and would suit a netbook. I settled on the netbook remix of Ubuntu 10.04.

The drivers for the USB adaptor were available from sourceforge.net/projects/easycapdc60. The documentation was great and it came with test scripts.

Motion was available in the repos so I picked that. I did have a look at Zoneminder but I wanted to keep the number of running processes to a minimum and Zoneminder was a bit of overkill for what I needed.

I wanted a way to email off the pictures motion took using just the command line. I picked mutt. Installing it from the repos installed postfix as the MTA. The problem was my ISP kept rejected the emails from postfix. Then I found an excellent guide at www.andrews-corner.org/mutt.html so I removed postfix and used msmtp instead..

Setting up
Install Ubuntu
Build/install usb driver
apt-get install motion
apt-get install mutt
apt-get purge postfix (use msmtp instead)
apt-get install msmtp
configure mutt /home/user/.muttrc
configure msmtp /home/user/.msmtprc
configure motion /home/user/motion.conf

I configured .muttrc and .msmtprc using the directions from www.andrews-corner.org/mutt.html. I then tested it with "echo test | mutt -s test myemail@myisp.com". Great success.

I left most of the settings in motion.conf as is, the most important change I made was to add "on_picture_save date | mutt -s motion myemail@myisp.com -a %f" to get it to send an email everytime it took a picture.

I also opened a port on my router so I could monitor the camera remotely using motion's built in webserver.





Credit goes to my mate P, who wrote this.