Question

Using the initial code from this question, I can get a live window from a webcam.

Taking a snapshot from webcam monitor in python (pygtk)

I have two webcams on my system, and I want to specify which camera I am calling for the viewer.

I have been poking around, and with nothing connected I get this error:

Error: Resource not found. v4l2_calls.c(493): gst_v4l2_open (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
system error: No such file or directory

This suggests to me that I can probably tell the streamer to look at another pipeline... perhaps /GstPipeline:pipeline1/GstV4l2Src:v4l2src0 or /GstPipeline:pipeline0/GstV4l2Src:v4l2src1

My ubuntu foo is not that good, and I'm not sure how I might specify which camera to use. I suspect that there is something in this line I can change:

 self.player = gst.parse_launch ("v4l2src ! autovideosink")

Any suggestions?

Was it helpful?

Solution

Each camera should create device /dev/videoN (where N is a number, TV cards and old GeForce cards with a Tuner will also create devices as /dev/videoN but these are false friends)

v4l2src device=/dev/video0 ! autovideosink

should work, where device= specifies which devices to pick as input src.

Alsp have a look at this question


Keep in mind that this is not a clean approach - gst_parse_launch is a devtool and can not change settings dynamically (i.e. volume level, brightness etc - these are fixed for the lifetime of the stream)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top