I have two webcams attached to my laptop (one built in), both of which work. (If I use Cheese, a webcam thingy that comes with Ubuntu, it uses the external one). If I use
I believe that under Linux the valid indices for video inputs are the numbers of the videoN devices in the /dev directory. Hence the following will give a list of valid indices:
import os
devs = os.listdir('/dev')
vid_indices = [int(dev[-1]) for dev in devs
if dev.startswith('video')]
vid_indices = sorted(vid_indices)
vid_indices