0

I'm a semi-new user to the raspberry pi USB webcam world, although I'm used to the RPi camera. My question is, can I use two cameras taking pictures at the same time without the pictures being overwritten by the other camera? Would I be able to use the RPi command or do I have to use C or cron? Any help would be appreciated.

0

2 Answers 2

1

You can't use the RPi camera commands with a webcam. Those only work with the pi camera. However, there are other options for reading input from a webcam. One of the most commonly used tools for this is fswebcam. There are other options too, though.

Install fswebcam with sudo apt install fswebcam. Then, you can use it with command

fswebcam image.jpg --no-banner -i 0

To use the second webcam, just change the -i or --input switch to -i 1 instead of -i 0.

Fswebcam has some other options as well, such as the -r switch to change the resolution, or the -l switch to take an image every x seconds. You can find the fswebcam documentation here.

And yes, the cameras should work together. They should each mount at different files: /dev/video0 and /dev/video1.

Hope this answer helps!

2
  • 1
    I used the same but it shows error like this pi@raspberrypi:~ $ fswebcam image.jpg --no-banner -i 1 --- Opening /dev/video0... Trying source module v4l2... /dev/video0 opened. Unrecognised input "1" I tried using fswebcam image.jpg --no-banner -i 2, but it shows same error. What to do to run two webcam together? Thanks. Commented Jun 12, 2019 at 11:24
  • @NaseebGill fswebcam will not work with webcams which are not recognized by your system, for obvious reasons. Commented Jul 17, 2020 at 7:30
1
  1. try to unplug one webcam
  2. use command ls /dev/video* to detect which are active/assigned (write down it)
  3. plug the another webcam
  4. repeat ls /dev/video* (write down and compare with previous list)

the first on both list is cam0, the first new number on second list (vs first list) is your second cam

example of my outputs and working commands..i waste one week figuring out this..

output step 2. Dev/vídeo[0,1,2,3,10,11,12,13,14,15,16] output step 4. dev/vídeo[4,5,6]

working commands

fswebcam -d /dev/video0 -r 1280x720 --no-banner image1.jpg fswebcam -d /dev/video4 -r 1280x720 --no-banner image3.jpg

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.