[gst-devel] newbie: multiple webcams?

Stefan Kost ensonic at hora-obscura.de
Thu Aug 28 08:46:28 CEST 2008


hi gerry,

Gerry Deckert schrieb:
> Stefan,
>
>    Here's a sample script I put together to test out input-selector using two videotestsrcs as input.  I tried many permutations of queues, videorate elements, etc., but this simplified version seems to work the best but still has a slight pause during switching.
>
>    Note that I'm using version 0.10.6-5 of plugins-bad, which is all that is available via repositories.  Let me know if you think I should go to a source install and upgrade to 0.10.8.
>   

Trying with cvs version e.g. installed to /usr/local would definitely
nice. I also noticed its v4l, don't you have v4l2 drivers for those cameras?

Stefan

>
>    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
>> ------------------------------------------------------------------------
>>
>> -------------------------------------------------------------------------
>> 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