[gst-devel] newbie: multiple webcams?

Gerry Deckert gerry_deckert at yahoo.com
Mon Aug 18 07:33:26 CEST 2008


Hi all,

   Another question for the list.  When I try to open too many cameras at once I get this error:

> Error msg from bus: Could not open resource for reading and writing. v4l_calls.c(179): gst_v4l_open (): /player/src1: system error: Cannot allocate memory

   Currently I can open 18 cameras simultaneously, but previously I was able to open as many as 29 before seeing this memory error.  Why would this be?  Are there any properties I can set that would reduce the memory footprint and let me open more?

   Here's roughly what my pipeline looks like:

v4lsrc device=/dev/video0 ! ffmpegcolorspace ! video/x-raw-rgb,width=160,height=120 ! videomixer name=mix ! ffmpegcolorspace ! gamme ! xvimagesink
...
v4lsrc device=/dev/video1 ... .mix
...
etc.

   I seem to be limited in options for width and height (352x288, 320x240, and 160x120 work), and I don't seem to be able to change the framerate from 25/1 or the depth or bpp from 24.  Is that just due to limitations in the v4lsrc element?
   I did try setting the v4lsrc 'blocksize' property smaller (from 4096 to 2048), but this didn't seem to make a difference.
   Any help would be greatly greatly appreciated.  If I can achieve 32 cameras running simultaneously I will be a happy man.


   Thanks,


   Gerry




--- On Mon, 8/11/08, Stefan Kost <ensonic at hora-obscura.de> wrote:

> From: Stefan Kost <ensonic at hora-obscura.de>
> Subject: Re: [gst-devel] newbie: multiple webcams?
> To: "Discussion of the development of GStreamer" <gstreamer-devel at lists.sourceforge.net>
> Date: Monday, August 11, 2008, 3:51 AM
> hi,
> 
> Gerry Deckert schrieb:
> > Stefan,
> >
> >    Thanks for the suggestion.  The result is the same,
> the first camera works fine, there is a pause when I switch
> to the second, I get a short burst of delayed video, and
> from then on I get about 1 frame every 10-20 seconds. 
> I've also tried it with leaky=1 just to see, and tried
> different values for max_size_buffers (2, 0, ...) and the
> outcome is unchanged.  Would a caps filter describing the
> video stream make a difference, or does that only affect
> negotiating the links between elements?
> >
> >   
> if you use videotestsrc instead would it work them. If you
> could make a 
> small standalone test app, that uses <n> sources and
> either videotetsrc 
> or v4l2src I could try to get another webcam and try with
> two webcams. 
> Best would be to file a bug and attach it there.
> Also happens if you set sync=FALSE on the sink?
> 
> Stefan
> 
> >    Gerry
> >
> > --- On Sun, 8/10/08, Stefan Kost
> <ensonic at hora-obscura.de> wrote:
> >
> >   
> >> From: Stefan Kost <ensonic at hora-obscura.de>
> >> Subject: Re: [gst-devel] newbie: multiple webcams?
> >> To: "Gerry Deckert"
> <gerry_deckert at yahoo.com>, "Gstreamer"
> <gstreamer-devel at lists.sourceforge.net>
> >> Date: Sunday, August 10, 2008, 3:29 AM
> >> Hi,
> >>
> >> please keep the list in the loop.
> >>
> >> Gerry Deckert schrieb:
> >>     
> >>> Stefan,
> >>>
> >>>    I've just given input-selector a try
> and ran
> >>>       
> >> into trouble.  The first camera comes up fine, but
> when I
> >> try to switch cameras (by setting the
> 'active-pad'
> >> property) the video on the next camera is frozen,
> or
> >> stutters through a few frames and then freezes. 
> If I set my
> >> pipeline to STATE_NULL, then change the active-pad
> on the
> >> input-selector, then set the pipeline back to
> STATE_PLAYING
> >> it works as expected but there's a 1 second
> pause while
> >> switching, which defeats the purpose.
> >>     
> >>>    Do you have any ideas why this might be the
> case,
> >>>       
> >> or if there is some combination of elements I
> could put
> >> upstream or downstream of the input-selector to
> improve its
> >> behavior?  I've tested putting queues on
> either end, but
> >> with no visible difference.  Any insight you could
> provide
> >> would be helpful!
> >>
> >> I suspect timestamp issues. Can you try this:
> >> v4l2src ! queue leaky=2 ! input-select name=sel !
> ,,,
> >> v4l2src ! queue leaky=2 ! sel.
> >> ...
> >>
> >> Stefan
> >>
> >>
> >>     
> >>>    Thanks,
> >>>
> >>>
> >>>    Gerry
> >>>
> >>>
> >>>
> >>> --- On Thu, 8/7/08, Stefan Kost
> >>>       
> >> <ensonic at hora-obscura.de> wrote:
> >>     
> >>>> From: Stefan Kost
> <ensonic at hora-obscura.de>
> >>>> Subject: Re: [gst-devel] newbie: multiple
> webcams?
> >>>> To: "Discussion of the development of
> >>>>         
> >> GStreamer"
> >> <gstreamer-devel at lists.sourceforge.net>
> >>     
> >>>> Date: Thursday, August 7, 2008, 1:30 AM
> >>>> hi,
> >>>>
> >>>> have you tried input-selector from
> gst-plugin-bad?
> >>>>
> >>>> Stefan
> >>>>
> >>>> Gerry Deckert schrieb:
> >>>>         
> >>>>> Hi all,
> >>>>>
> >>>>>    I'm working on a Gstreamer /
> Python /
> >>>>>           
> >> Gtk
> >>     
> >>>> project to debut at Burning Man in a few
> weeks,
> >>>>         
> >> and I'm
> >>     
> >>>> hoping to get some suggestions, insight,
> and
> >>>>         
> >> pointers to
> >>     
> >>>> examples.  I'm almost completely new
> to
> >>>>         
> >> Gstreamer and
> >>     
> >>>> the Python bindings, but I have gone
> through the
> >>>>         
> >> App
> >>     
> >>>> development manual and the Pygstreamer
> Tutorial. 
> >>>>         
> >> I'm
> >>     
> >>>> amazed at the speed and flexibility, and
> I'm
> >>>>         
> >> convinced
> >>     
> >>>> it's the right way to go with my
> project.
> >>>>         
> >>>>>    Here's what I'm trying to
> do:  I
> >>>>>           
> >> want to
> >>     
> >>>> take input from multiple usb webcams
> (v4lsrcs) at
> >>>>         
> >> the same
> >>     
> >>>> time, display video in a window from just
> one at a
> >>>>         
> >> time, and
> >>     
> >>>> have the ability to switch the feed
> smoothly from
> >>>>         
> >> camera to
> >>     
> >>>> camera.  Why would I want to do this you
> ask?  So
> >>>>         
> >> I can set
> >>     
> >>>> up a ring of cameras and create a
> bullet-time
> >>>>         
> >> dance cage, of
> >>     
> >>>> course.  :)
> >>>>         
> >>>>>    I cobbled together something from
> various
> >>>>>           
> >> examples
> >>     
> >>>> that more or less works, but I'm sure
> >>>>         
> >> there's a
> >>     
> >>>> better approach.  My initial attempt
> involved
> >>>>         
> >> detaching and
> >>     
> >>>> attaching cameras directly to xvimagesink,
> but
> >>>>         
> >> this took too
> >>     
> >>>> long for a smooth transition.  In my
> current
> >>>>         
> >> setup, each
> >>     
> >>>> camera is fed through its own videobox,
> all the
> >>>>         
> >> videoboxes
> >>     
> >>>> connect to a single videomixer, and the
> videomixer
> >>>>         
> >> goes
> >>     
> >>>> through ffmpegcolorspace to xvimagesink. 
> All the
> >>>>         
> >> cameras
> >>     
> >>>> are running at the same time, and I choose
> between
> >>>>         
> >> them by
> >>     
> >>>> setting the alpha channel on the videobox
> of the
> >>>>         
> >> desired
> >>     
> >>>> camera to 1 while all the others are 0. 
> This
> >>>>         
> >> results in
> >>     
> >>>> smooth switching, but I'm sure is not
> a good
> >>>>         
> >> use of
> >>     
> >>>> resources.  
> >>>>         
> >>>>>    So, with that, I have lots of
> questions. 
> >>>>>           
> >> Is there
> >>     
> >>>> a way to switch between sinks on the
> videomixer to
> >>>> accomplish the same effect?  Is there a
> fast way
> >>>>         
> >> to turn the
> >>     
> >>>> cameras on and off, or should I try
> turning them
> >>>>         
> >> on and off
> >>     
> >>>> in groups?  How could I enable recording
> of the
> >>>>         
> >> video
> >>     
> >>>> that's coming out?  I'm guessing I
> want to
> >>>>         
> >> use a tee
> >>     
> >>>> element, but how do I enable it on the
> fly?  What
> >>>>         
> >> about
> >>     
> >>>> toggling on/off some of the effectv
> plugins?  How
> >>>>         
> >> could I
> >>     
> >>>> grab single frames from the cameras?  I
> don't
> >>>>         
> >> have a
> >>     
> >>>> good understanding of what's involved
> in
> >>>>         
> >> modifying the
> >>     
> >>>> pipeline on the fly.  Is there some
> documentation
> >>>>         
> >> or are
> >>     
> >>>> there some examples anyone could point me
> to? 
> >>>>         
> >> Suggestions? 
> >>     
> >>>> Any help would be greatly appreciated!
> >>>>         
> >>>>>    Regards,
> >>>>>
> >>>>>
> >>>>>    Gerry
> >>>>>
> >>>>>
> >>>>>           
> >>
> -------------------------------------------------------------------------
> >>     
> >>>>> This SF.Net email is sponsored by the
> Moblin
> >>>>>           
> >> Your Move
> >>     
> >>>> Developer's challenge
> >>>>         
> >>>>> Build the coolest Linux based
> applications
> >>>>>           
> >> with Moblin
> >>     
> >>>> SDK & win great prizes
> >>>>         
> >>>>> Grand prize is a trip for two to an
> Open
> >>>>>           
> >> Source event
> >>     
> >>>> anywhere in the world
> >>>>
> >>>>         
> >>
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >>     
> >> _______________________________________________
> >>     
> >>>>> gstreamer-devel mailing list
> >>>>> gstreamer-devel at lists.sourceforge.net
> >>>>>
> >>>>>           
> >>
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> >>     
> >>>>>   
> >>>>>           
> >>>>         
> >>
> -------------------------------------------------------------------------
> >>     
> >>>> This SF.Net email is sponsored by the
> Moblin Your
> >>>>         
> >> Move
> >>     
> >>>> Developer's challenge
> >>>> Build the coolest Linux based applications
> with
> >>>>         
> >> Moblin SDK
> >>     
> >>>> & win great prizes
> >>>> Grand prize is a trip for two to an Open
> Source
> >>>>         
> >> event
> >>     
> >>>> anywhere in the world
> >>>>
> >>>>         
> >>
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >>     
> >>>>
> _______________________________________________
> >>>> gstreamer-devel mailing list
> >>>> gstreamer-devel at lists.sourceforge.net
> >>>>
> >>>>         
> >>
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> >>     
> >
> >
> -------------------------------------------------------------------------
> > This SF.Net email is sponsored by the Moblin Your Move
> Developer's challenge
> > Build the coolest Linux based applications with Moblin
> SDK & win great prizes
> > Grand prize is a trip for two to an Open Source event
> anywhere in the world
> >
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> > _______________________________________________
> > gstreamer-devel mailing list
> > gstreamer-devel at lists.sourceforge.net
> >
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> >   
> 
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move
> Developer's challenge
> Build the coolest Linux based applications with Moblin SDK
> & win great prizes
> Grand prize is a trip for two to an Open Source event
> anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel




More information about the gstreamer-devel mailing list