0

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?

Community
  • 1
  • 1
Jay Gattuso
  • 3,890
  • 12
  • 37
  • 51
  • What exactly did you try so far? Also `gst_parse_launch` is rather a dev tool then an API... – drahnr Apr 22 '14 at 08:49
  • @drahnr I have no idea where to start! hence posting a question. I',m not sure if its a python problem or a nix problem. I know roughly what I think I need to do, I just don't know where to look for guidance to do that. – Jay Gattuso Apr 22 '14 at 09:06

1 Answers1

1

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)

Community
  • 1
  • 1
drahnr
  • 6,782
  • 5
  • 48
  • 75
  • Ahh, Thank you. I didn't realise it was possible to pass the name of the pipe being used. Thanks. The project is quick and dirty. The video will be in a mostly closed system with fixed illumination. I have looked at opencv as a better solution, but struggled to get it to compile. Thank you, thats a great help. And the link is an excellent resource and is answering many of my questions. – Jay Gattuso Apr 22 '14 at 09:08