Sie sind auf Seite 1von 4

Motion configuration with mutliple webcams and ip cameras

Intended for people trying to configure 'Motion' with a mixture of cheap usb web
cameras and IP cameras but can't get multiple and mixed cameras configured.
I couldn't find an example of configuration files for this type of set-up anywhere and
guess you can't either. I assume you have motion installed and are up and running with
one webcam.
This is just about the motion.conf and threadX.config files only.
I wanted the jpg/avi files in a different folder for each camera, and each camera to be
viewed in a browser.
First the location of the .conf files, for Ubuntu the best place to put all 4 .conf files is in
/etc/motion
for other distros they may be better of elsewhere, see the motion site for info.
When in the right location you do not need to specify where they are when you run
motion, but you can actually put them anywhere you like and use the -c opt like this
motion -c /path-to-file/motion.conf
Most of my trouble was that the config files were not actually being found but motion
doesn't tell you (this could have been my fault after misreading the website).
It was only when i ran motion in daemon mode did it actually tell me the files were
missing and being skipped, motion still ran as such but not as i expected.
make sure the files are readable and writeable to you.
Multiple camera mode
Confusingly when using multiple cameras the motion.conf kinda changes it's purpose
and simply holds all the global or common settings for all cameras and each camera will
need it's own threadX.conf with it's individual settings.
With 3 cameras i needed the main motion.conf file and 3 threadX.conf files.
So that's 4 files in total, motion.conf which is now just a global setter plus thread1.conf
thread2.conf and thread3.conf.
motion.conf
I ended up commented these out when i was testing but not totally sure if it helped.
It's prolly ok to leave motion.conf pretty much as it was but this works fine for me and
that's how it's gonna stay now it's fully working.
;netcam_url value
;target_dir value
;webcam_port 8081
;videodevice /dev/video0
The labels and timestamps wern't clear in my jpg's due to 5 webcams unless i set this
text_double on

Now it's all working properly i start motion silently (daemon mode).
daemon on
It's a good idea to store the PID on start up, it may be useful later.
process_id_file /home/ndmaque/motion/motion.pid
i have 3 cameras in total (2 usb webcams and a Foscam IP) so needed to enable 3 thread
config files at the very bottom of motion.conf.
thread /etc/motion/thread1.conf
thread /etc/motion/thread2.conf
thread /etc/motion/thread3.conf
;thread /usr/local/etc/thread4.conf
threadX.conf
The thread.conf files need very little info, this is all i have in mine for now.
thread1.conf
videodevice /dev/video0
text_left USBWebcam-1
target_dir /home/ndmaque/motion/images/webcam1
webcam_port 8081
thread2.conf
videodevice /dev/video1
text_left USBWebcam-2
target_dir /home/ndmaque/motion/images/webcam2
webcam_port 8082
thread3.conf
netcam_userpass admin:mypassword
text_left Foscam IP
netcam_url http://192.168.0.60/videostream.cgi
target_dir /home/ndmaque/motion/images/foscam
webcam_port 8083
*IP Cam's generally need a user/pass to be accessed.
If you have two usb webcams you should see video0 and video1 in your /dev folder and
the above *should* work. The file folders will be re-created by motion so you can just
delete the whole lot anytime.
Good to go
We're ready to rock so from the command line...
motion
The reponse confirms it found and loaded all the conf files...
[0] Processing thread 0 - config file /etc/motion/motion.conf
[0] Processing config file /etc/motion/thread1.conf
[0] Processing config file /etc/motion/thread2.conf
[0] Processing config file /etc/motion/thread3.conf

[0] Motion 3.2.11 Started


[0] Motion going to daemon mode
Yay, i can see files pouring into the three folders.
Time to fire up the browser and have a peep.
http://localhost:8081/
http://localhost:8082/
http://localhost:8083/
OMG i can see again, it's miracle!
Bizarely i do not intend to use the zone/motion detection zones thing because even high
quality cams trigger when shadows/daylight/trees/reflections move, and don't forget
movement is relative so panning the camera will trigger and cause a dump of unwanted
files so i set the threshold in the global motion.conf to make sure they never trigger and
jpg/avi files are not created.
threshold 1000000
However, during testing i set the threshold low so the camera's trigger and create files as
soon as motion fires up without me having to dash around the house and dance in front
of each one.
threshold 1
Because i start my motion with threshold 1000000 i need a method of creating videos
when my burglar actually does turn up.
Arduino Uno
I have my Arduinos hooked up with motion, smoke and other sensors which make a
much better decision if i am being burgled again.
The Arduino's trigger the BeagleBone to kill the process (the PID is in that file we
configured earlier) and restarts motion using a different set of .conf files which are set to
threshold 1 so it constantly records files
motion -c /path-to-file-always-record/motion.conf
I use the youtube data api to push the videos into my account using
on_event_end myscript.sh
and sends me a text and email with all the sensor values. It also posts the data and ftp's
the much clearer jpg's into my Drupal site.
After iv'e been robbed Arduino triggers BeagleBone to restart motion with the threshold
100000 .conf again ready for the next burglar.

A 60 PTZ foscam, 2 x 5 webcams, a 12 Arduino Uno and the almighty 60


BeagleBone.
Thank you to Linux, Motion, Drupal and the Youtube cloud for a high quality cheap,
flexible and reliable alarm.
Oh yes, a big thanks to my burglar without whom this post would never have happened.

Das könnte Ihnen auch gefallen