I had this issue while setting up two webcams with a Raspberry Pi and Motion.
I ended up with the conclusion that this is due to the naming in /dev/ (video0, video1, video2, video3, …)
After a reboot, or after unplug/plug of a USB webcam, its device naming may change, therefore Motion configuration becomes incorrect.
In Motion .conf files, each camera shall be called by its device name, for example:
In addition, in my setup I have 2 names per webcam, and only one of them is valid for Motion.
raspberrypi:~ $ ls /dev/video*
/dev/video0 /dev/video1 /dev/video10 /dev/video11 /dev/video12 /dev/video2 /dev/video3
Plug/unplug your camera to know what are its identifiers.
The solution I found is to use a static naming of those webcams, fortunately in /dev/v4l devices can be called with their id and path.
pi@raspberrypi:~ $ ls /dev/v4l/by-id
The xxxxxx and yyyyyy are the manufacturer name, product name and serial number, you can see them by using dmesg:
dmesg | grep usb
Now in the motion .conf files, call the camera by its id, for example:
I tested it by unplugging and plugging again, and by doing a reboot, it works with no issue.
I read about another workaround to define a rule in udev, but I’m not doing it for the moment.
If you have any question or remark feel free to add a comment.