I have done streaming with a single webcam using Motion, but my project needs streaming for two USB webcams. Any kind of help will be appreciated.
- You need a second USB camera (believe it or not)
- IF you're using motion, you need a different config setup:
If you have more than one camera you should not try and invoke Motion more times. Motion is made to work with more than one camera in a very elegant way and the way to do it is to create a number of thread config files. Motion will then create an extra thread of itself for each camera. If you only have one camera you only need the motion.conf file. The minute you have two or more cameras you must have one thread config file per camera besides the motion.conf file.
source and further reading: Link
To add to the other answer, Here is a quick exerpt from the link:
To make it clear, the thread files format and syntax is the same as motion.conf. An example of what you might want in a thread file as follows: assume you have two cameras, attached to one system. Create files thread0.conf and thread1.conf. At the end of motion.conf, uncomment out the lines that refer to them. The full contents of the thread files can be as simple as
thread0.conf: videodevice /dev/video0 stream_port 8081
thread1.conf: videodevice /dev/video1 stream_port 8082
Motion reads its configuration parameters in the following sequence. If the same parameter exists more than one place the last one read wins.
- Motion reads the configuration file motion.conf from the beginning of the file going down line by line.
- If the option "thread" is defined in motion.conf, the thread configuration file(s) is/(are) read.
- Motion continues reading the rest of the motion.conf file. Any options from here will overrule the same option previously defines in a thread config file.
- Motion reads the command line option again overruling any previously defined options.
So always call the thread config files in the end of the motion.conf file. If you define options in motion.conf AFTER the thread file calls, the same options in the thread files will never be used. So always put the thread file call at the end of motion.conf.