Beruflich Dokumente
Kultur Dokumente
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