sudo apt-get install motion
sudo nano /etc/motion/motion.conf
ctrl-v until you get to the end of the file and uncomment the first two threads for the file locations for the configs files for the 2 cams (thread1 and thread2)
create the corresponding two files both in the same /etc/motion/ directory:
sudo touch thread1.conf && sudo nano thread1.conf
and do the same for thread2.conf. The contents are as follows:
#thread1.conf:
videodevice /dev/video0
target_dir /user/me/video0files
stream_port 8081 # may be optional - seems necessary for reliability
#thread2.conf:
videodevice /dev/video1
target_dir /user/me/video1files
stream_port 8082 # may be optional - seems necessary for reliability
sudo motion # double-check the need for sudo there ...
view the output (via VNC in this case) at:
localhost:8080 # the control interface for motion, including the option to action=>restart
localhost:8081 # the video feed from video0 / thread1
localhost:8082 # the video feed from video1 / thread2
To allow access from a non-localhost different computer, for the web control interface and the video streams, respectively, set:
webcontrol_localhost off
stream_localhost off
CAUTION: Be sure you really want this access allowed from a non-localhost computer. You may want to look into authentication from here to allow access from another PC, and/or you may want to configure firewalls and/or VLANs to restrict access to the control and video streams.
After making config changes, it seems so far most reliable, as one simple UI option, to select action => restart from the web control interface.
This relies on the defaults, assumes your cameras are compatible with Linux/motion default settings, assumes that your two cameras enumerate as video0 and video1, and was tested on a headless Intel iNUC (circa 2016) running Ubuntu 16.04.5 LTS or thereabouts (which is old, and retained for legacy comms project compatibility and reference). Motion version is 3.2.12
For an older slower headless fanless mini-ITX system, running 3 cameras required using a kernel driver documented “hack” (really just a setting — see the uvcvideo documentation) and/or rebuilding the driver to mod bandwidth output data to guarantee 3 cameras continuous running when bandwidth data wasn’t correct, and or something like that … a while ago … haven’t tested on this iNUC platform.
Update: For Motion on Ubuntu 18.04.1 (and what a nice rev I must say) the mutiple camera/thread naming convention has been updated to:
camera /etc/motion/camera1.conf
camera /etc/motion/camera2.conf
instead of the former:
thread yada yada # (the filename itself doesn't matter, but the directive is different)