Select desired stream with decodebin2

Tim-Philipp Müller t.i.m at zen.co.uk
Sat Oct 20 04:07:29 PDT 2012


On Sat, 2012-10-20 at 12:14 +0530, Yogesh Marwaha wrote:

Hi,

> What I'm looking for is a way to identify a stream so that I may be able to 
> apply correct options to each streams. I'm refering to "Stream ID" values 
> which are shown by many media info pragrams (Is that a real value or just an 
> index number of stream). So far I'm unable to get any clue where/how to get 
> hold of that information. Hope I'm clear this time.

It's not so easy with 0.10.

1.0 has stream-ids as part of the stream-start event for each stream.
These are stable for a given file, so you can first discover some info
and then later recognise which stream is which again. Also, decodebin
tries much harder to expose streams in the same order in 1.0, in 0.10
it's basically random which pads get exposed in which order.

If you must use 0.10, it depends a bit on what your plan is. You could
do decodebin, then for each new pad hook up a queue, set up a pad block
on the queue's src pad, and an event probe on the new decodebin pad. You
will then get tag events for each stream via the event probe (with info
about the stream's language etc.), and you will also get a notify::caps
signal on that pad once a buffer with caps went through it. You can then
expose all that info in your user interface, and then link things up to
the queues as needed and unblock the pads to start/continue transcoding.
This approach won't work so well if you want to support transmuxing as
well though.

I would recommend you switch to 1.0, it makes this all somewhat easier.

Cheers
 -Tim


> Regards,
> 
> 
> On Sunday 14 Oct 2012 6:14:15 PM Yogesh Marwaha wrote:
> > Hi,
> > 
> > I am trying transcoding files and I'm using gstreamer 0.10.
> > 
> > My problem is that I'm unable to work out (in case a source file has more
> > than one stream) which stream(s) to select if they have same capabilities.
> > Say I've an audio file with two streams with different language, then how
> > will I select/determine the desired stream?
> > 
> > What I have in my mind is (all thinking/no practical) : Connect all streams
> > and add a queue with large enough size (but do not connect to final sink/or
> > connect to fake sink); then change state to paused - there will be messages
> > in the bus with required meta info; now disconnect all unneeded pads,
> > connect with sink and play. How's that? Am I stretching it too far?
> > 
> > Regards,
> > 
> > Yogesh M
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




More information about the gstreamer-devel mailing list