Switching two video sources with input-selector

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Switching two video sources with input-selector

Mark Kretschmann
Heya,

I am trying to build an application with GStreamer that allows
switching between two video sources dynamically, one being a
live-video (videotestsrc for now), and the other a filesrc. The sink
is a standard xvimagesink.

The goal is to do the switching with as little latency as possible,
and also only running the elements that are necessary for each source.
Wim Taymans recommended to use an "input-selector" for switching
between the sources, which makes sense to me.

However, how should the pipeline design look? Would I need two
pipelines, one for each source, and play/pause them dynamically? Where
must the input-selector and the sink go?


Thanks,
Mark.

--
Mark Kretschmann
Amarok Developer
Fellow of the Free Software Foundation Europe
http://amarok.kde.org - http://www.fsfe.org

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Switching two video sources with input-selector

Andrés González
On 28/09/10 19:41, Mark Kretschmann wrote:

> Heya,
>
> I am trying to build an application with GStreamer that allows
> switching between two video sources dynamically, one being a
> live-video (videotestsrc for now), and the other a filesrc. The sink
> is a standard xvimagesink.
>
> The goal is to do the switching with as little latency as possible,
> and also only running the elements that are necessary for each source.
> Wim Taymans recommended to use an "input-selector" for switching
> between the sources, which makes sense to me.
>
> However, how should the pipeline design look? Would I need two
> pipelines, one for each source, and play/pause them dynamically? Where
> must the input-selector and the sink go?
>
>
> Thanks,
> Mark.
>
Hello Mark,

I send you an example of something I've been working on. I think it will
be useful as an starting point for you.

The usage is:

$ python switch-any.py <filename>

(The file must be MPEG)

Feel free to ask further questions about it.

By the way, about "only running the elements that are necessary for each
source",  as far as I know input-selector makes all its input elements
play (although you only see one of them). In fact, non selected inputs
run at higher speed. If you want to improve this, I'm interested.

Regards,
Andrés


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

switch-any.py (15K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Switching two video sources with input-selector

Luciana Fujii Pontello
On Thu, 2010-10-07 at 17:18 +0200, Andres Gonzalez wrote:
> Hello Mark,
>
> I send you an example of something I've been working on. I think it will
> be useful as an starting point for you.

Hi,

Check if you've sent the right file. There is a missing method (on_eos)
and filename is never used.

I'm interested in that because when I had to use input-selector with
filesrc it not always worked. It does switch sometimes, but then it
freezes.

Regards,

Luciana Fujii

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Apple Air Play

Roland Peffer-2
Anyone knows a site / resource that gives details about Apple's Air Play protocol.
Target would be to build an audio and maybe video renderer filter.

Regards,
Roland


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Switching two video sources with input-selector

victor héry
In reply to this post by Luciana Fujii Pontello
  Hello,

I tried to work with input-selector some times ago, with two filesrc.
Unfortunately, it never worked. For me, it seems that input-selector
doesn't work with non-live video stream...

So, perhaps your input-selector sometimes works is because it works when
you switch on videotestsrc, and it doesn't work when you switch on the
filesrc ?

I have to admit I never found a solution to use input-selector and
filesrc. (And for my own part, I use uridecodebin than filesrc).

But, we have the idea to use Gstreamer (or any other streaming software)
to stream the filesrc, and catch the stream with Gstreamer. Then, the
video stream is a live-video, so input-selector has to work on it. I
haven't the time to test this idea, so I don't know if it works, but it
was the most simple thing we could think about to use input-selector...

I hope I could help more, but anyway if you found a solution to use
input-selector with filesrc, I am really interrested ti know your results.

Regards,

Victor Héry


Le 09/10/2010 01:34, Luciana Fujii Pontello a écrit :

> On Thu, 2010-10-07 at 17:18 +0200, Andres Gonzalez wrote:
>> Hello Mark,
>>
>> I send you an example of something I've been working on. I think it will
>> be useful as an starting point for you.
> Hi,
>
> Check if you've sent the right file. There is a missing method (on_eos)
> and filename is never used.
>
> I'm interested in that because when I had to use input-selector with
> filesrc it not always worked. It does switch sometimes, but then it
> freezes.
>
> Regards,
>
> Luciana Fujii
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2&  L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Switching two video sources with input-selector

Frans van Berckel
Hi Guy's,

Did you take a look into the Gstreamer Gnonlin element yet?

http://gstreamer.freedesktop.org/modules/gnonlin.html

More about: Using Gnonlin with GStreamer and Python. What is Gnonlin
exactly and how Gnonlin works!

http://www.jonobacon.org/2006/12/27/using-gnonlin-with-gstreamer-and-python/

Thanks,


Frans van Berckel

On Sat, 2010-10-09 at 12:30 +0200, Victor Héry wrote:

> Hello,
>
> I tried to work with input-selector some times ago, with two filesrc.
> Unfortunately, it never worked. For me, it seems that input-selector
> doesn't work with non-live video stream...
>
> So, perhaps your input-selector sometimes works is because it works when
> you switch on videotestsrc, and it doesn't work when you switch on the
> filesrc ?
>
> I have to admit I never found a solution to use input-selector and
> filesrc. (And for my own part, I use uridecodebin than filesrc).
>
> But, we have the idea to use Gstreamer (or any other streaming software)
> to stream the filesrc, and catch the stream with Gstreamer. Then, the
> video stream is a live-video, so input-selector has to work on it. I
> haven't the time to test this idea, so I don't know if it works, but it
> was the most simple thing we could think about to use input-selector...
>
> I hope I could help more, but anyway if you found a solution to use
> input-selector with filesrc, I am really interrested ti know your results.
>
> Regards,
>
> Victor Héry
>
>
> Le 09/10/2010 01:34, Luciana Fujii Pontello a écrit :
> > On Thu, 2010-10-07 at 17:18 +0200, Andres Gonzalez wrote:
> >> Hello Mark,
> >>
> >> I send you an example of something I've been working on. I think it will
> >> be useful as an starting point for you.
> > Hi,
> >
> > Check if you've sent the right file. There is a missing method (on_eos)
> > and filename is never used.
> >
> > I'm interested in that because when I had to use input-selector with
> > filesrc it not always worked. It does switch sometimes, but then it
> > freezes.
> >
> > Regards,
> >
> > Luciana Fujii


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Switching two video sources with input-selector

Luciana Fujii Pontello
On Sat, 2010-10-09 at 17:44 +0200, Frans van Berckel wrote:
> Hi Guy's,
>
> Did you take a look into the Gstreamer Gnonlin element yet?
>
> http://gstreamer.freedesktop.org/modules/gnonlin.html

Yes. Gnonlin works very well to switch between filesrc and a live
source, but I was only able to do that setting the times in the timeline
before starting to play. What I wanted to achieve was switching to a
filesrc when the user requests to.

I honestly don't know how to do that with gnonlin and haven't found any
docs about it at the time. I tried the obvious, which was setting the
timeline while playing after the user requests the switch, but it didn't
work. I also tried some variants of that, like blocking pads and then
setting the timeline. The truth is I don't know much about gnonlin and I
didn't look at the code enough to know how it works. Is that supposed to
work? Is it even a use case that gnonlin intends to cover?

Anyway, what I could do to switch between souces was, incredibly, use
videomixer as my input-selector. I already used videomixer to provide
picture-in-picture, so I just use alpha to hide every other video I
don't want to show. You can imagine that there are some problems with
that aproach, but it was better than anything I tried for that.

Regards,

Luciana Fujii

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Switching two video sources with input-selector

Andrés González
In reply to this post by Luciana Fujii Pontello
On 09/10/10 01:34, Luciana Fujii Pontello wrote:
> Hi,
> Check if you've sent the right file. There is a missing method (on_eos)
> and filename is never used.
Hi Luciana!

Well, actually it was the right file, but the file was not right :-)

I extended a previous example (see the comments), which was missing that
method too (bad excuse, I know).
But the program still runs and (I think) it shows how to use
input-selector. The unused 'filename' is mine...

I send the file fixed. I just replaced 'filename' with 'filepath', and
added the method on_eos in SwitchTest class:
######
   def on_eos(self):
       self.stop()
######


> I'm interested in that because when I had to use input-selector with
> filesrc it not always worked. It does switch sometimes, but then it
> freezes.

I think the problem is when a filesrc is connected to an
input-selector's sink, but not selected, the filesrc it is running at
very high speed. So you can switch sometimes, but it reaches the end of
the stream very quickly, and then you cannot play it anymore.
I think the most desirable behaviour of input-selector would be all
sources running at normal speed, or al least, non-selected sources
paused (volunteers...? :-)

> Regards,
>
> Luciana Fujii

Thanks!
Andrés

> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2&  L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

switch-any.py (15K) Download Attachment