8

I want to have multiple USB webcams running on a single Raspberry Pi. I will put them through a powered hub. I want the webcams to take stills simultaneously (or as simultaneously as possible - a second or two delay isn't a big deal) and save the images to a memory stick, each image will have the same name beginning but then cam1, cam2, cam3 etc. to differentiate them from each other.

Is this possible? If so, what number of webcams am I limited to? Also, how would I address them, can fswebcam control more than one webcam?

If it isn't possible, can anyone tell me why not?

Greenonline
  • 2,969
  • 5
  • 27
  • 38
Matt Howarth
  • 83
  • 1
  • 1
  • 4

2 Answers2

6

Theoretically, yes. It's possible to connect as many webcams as you can as long as they're powered up as per their requirements.

How do you address them ?

Each usb web cam that you connect gets listed under /dev/video<n> where n = 0,1,2 .. as number of video devices increase. Ie, if I connect two webcams to my system, I would be able to see two entries /dev/video0 and /dev/video1 when I fire ls /dev/video*.

I've not used fswebcam personally but its documentation suggests that using -d flag you can specify a particular webcam. Default is /dev/video0. You can run multiple instances of fswebcam to capture images from all the cams simultaneously.

However, USB bandwidth bottleneck is entirely a different issue as you keep on adding devices.

Hope it helps.

dhruvvyas90
  • 2,883
  • 3
  • 21
  • 33
2

thank you dastaan, your answer help me so much, finally I take a picture with fswebcam --device <device> <filename>

here is the example, I'm gonna take a picture and save it to image.jpg:

my first webcam

fswebcam --device /dev/video0 image.jpg

and my second webcam

fswebcam --device /dev/video1 image.jpg

you can check your device with

ls /dev/

hope it helped for the others

Ghanima
  • 15,958
  • 17
  • 65
  • 125
iqom
  • 21
  • 1