Gnolin/Python - decoding 2 video streams

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

Gnolin/Python - decoding 2 video streams

Matt Veenstra
Hi,

I am now trying to get 2 video streams connected end to end in gnolin
and I am still missing a some pieces.

I have 2 streams.  Each in a "gnlfilesource".  Each filesource in
"gnlcomposition".  I have a callback for "pad-added" to each
composition.  From what I have found and read.  "gnlfilesource"
handles its own decodebin.

The callback is never called in the case of 2 video streams.  I get a
decodebin error.  Below...
'gstdecodebin2.c(3135): gst_decode_bin_expose ():
/GstPipeline:mypipeline/GnlComposition:gnlcomposition1/GnlFileSource:gnlfilesource1/GstURIDecodeBin:internal-uridecodebin/GstDecodeBin2:decodebin20:\nno
suitable plugins found'

If I do the 2 audio streams this works.  And I can connect this to an
"input-selector"
If I use just gnlfilesource without the compositions I have the same
problem as well.

It still seems like I am missing something fundamental.  Do I need to
build my own input's using "gnlsource" and not "gnlfilesource"?

Thanks,
Matt
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Gnolin/Python - decoding 2 video streams

Matt Veenstra
An update.  If I put both "gnlfilesource" in one "gnlcomposition".  I
get further.
- The first "pad-added" is called.
- Gstreamer handles the first 5 seconds of the first stream.
- Finally I get the an error at the end/start of the second streams time.

This got me thinking my pipeline is wrong.  And I have tried quite a
few variations with no success.  (queue, multiqueue, input-selector)
Here is a sample code (not perfectly complete)

Thanks again

                # create an video input selector
                self.video_input = gst.element_factory_make('input-selector')
                self.pipeline.add(self.video_input)

                # create an video queue
                self.video_queue = gst.element_factory_make('queue')
                # self.video_queue = gst.element_factory_make('multiqueue')
                self.pipeline.add(self.video_queue)

                # create an videoconverter
                self.videoconvert = gst.element_factory_make("ffmpegcolorspace")
                self.pipeline.add(self.videoconvert)

                self.video_encoder = gst.element_factory_make('theoraenc')
                self.pipeline.add(self.video_encoder)

                # create an mux
                self.mux = gst.element_factory_make('oggmux', 'mv_mux')
                self.pipeline.add(self.mux)

                # create an fakesink
                self.sink = gst.element_factory_make("fakesink", "fakesink")
                self.sink = gst.element_factory_make('filesink')
                self.sink.set_property("location", "/transcoder/samples/pygst_out.ogg")
                self.pipeline.add(self.sink)
               
                self.mux.link(self.sink)

                # link video pipe
                self.video_input.link(self.video_queue)
                self.video_queue.link(self.videoconvert)
                self.videoconvert.link(self.video_encoder)
                self.video_encoder.link(self.mux)

                # ----------------------- stream 1 ---------------------------
                # create a comp for each file
                self.comp1 = gst.element_factory_make("gnlcomposition")
                self.pipeline.add(self.comp1)
                self.comp1.connect("pad-added", self.OnPad)
               
                self.stream1 = gst.element_factory_make("gnlfilesource")
                self.comp1.add(self.stream1)
               
                self.stream1.set_property("location", "/transcoder/samples/media/example.ogg")
                self.stream1.set_property("caps", gst.caps_from_string("video/x-raw-yuv"))
                self.stream1.set_property("start", 0 * gst.SECOND)
                self.stream1.set_property("duration", 5 * gst.SECOND)
                self.stream1.set_property("media-start", 0 * gst.SECOND)
                self.stream1.set_property("media-duration", 5 * gst.SECOND)

                # ----------------------- stream 2 ---------------------------
                # create a gnlfilesource
                self.stream2 = gst.element_factory_make("gnlfilesource")
                self.comp1.add(self.stream2)

                # set the gnlfilesource properties
                self.stream2.set_property("location",
"/transcoder/samples/media/ANML_06_sort.ogg")
  self.stream2.set_property("caps", gst.caps_from_string("audio/x-raw-yuv"))
                self.stream2.set_property("start", 5 * gst.SECOND)
                self.stream2.set_property("duration", 5 * gst.SECOND)
                self.stream2.set_property("media-start", 0 * gst.SECOND)
                self.stream2.set_property("media-duration", 5 * gst.SECOND)

                self.pipeline.set_state(gst.STATE_PLAYING)
                self.mainloop.run()

        def OnPadLog(self, element, pad):
                aCaps = pad.get_caps()
                aName = aCaps[0].get_name()
                print "OnPadLog added:", aName
                if aName == 'video/x-raw-yuv':
                        # aPad = self.video_queue.get_compatible_pad(pad, pad.get_caps())
                        aPad = self.video_input.get_compatible_pad(pad, pad.get_caps())
                        if not aPad.is_linked(): # Only link once
                                print "linking video pads"
                                pad.link(aPad)
                                # self.video_queue.link(self.videoconvert) # for multiqueue
                                print "linking video pads done"



On Tue, Feb 15, 2011 at 1:07 PM, Matt Veenstra <[hidden email]> wrote:

> Hi,
>
> I am now trying to get 2 video streams connected end to end in gnolin
> and I am still missing a some pieces.
>
> I have 2 streams.  Each in a "gnlfilesource".  Each filesource in
> "gnlcomposition".  I have a callback for "pad-added" to each
> composition.  From what I have found and read.  "gnlfilesource"
> handles its own decodebin.
>
> The callback is never called in the case of 2 video streams.  I get a
> decodebin error.  Below...
> 'gstdecodebin2.c(3135): gst_decode_bin_expose ():
> /GstPipeline:mypipeline/GnlComposition:gnlcomposition1/GnlFileSource:gnlfilesource1/GstURIDecodeBin:internal-uridecodebin/GstDecodeBin2:decodebin20:\nno
> suitable plugins found'
>
> If I do the 2 audio streams this works.  And I can connect this to an
> "input-selector"
> If I use just gnlfilesource without the compositions I have the same
> problem as well.
>
> It still seems like I am missing something fundamental.  Do I need to
> build my own input's using "gnlsource" and not "gnlfilesource"?
>
> Thanks,
> Matt
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Gnolin/Python - decoding 2 video streams

Matt Veenstra
In reply to this post by Matt Veenstra
Solved.  My bug.  Copy and paste error on the caps.

                self.stream1.set_property("caps", gst.caps_from_string("video/x-raw-yuv"))
  self.stream2.set_property("caps", gst.caps_from_string("audio/x-raw-yuv"))

I am sure there will be more questions.

On Tue, Feb 15, 2011 at 1:07 PM, Matt Veenstra <[hidden email]> wrote:

> Hi,
>
> I am now trying to get 2 video streams connected end to end in gnolin
> and I am still missing a some pieces.
>
> I have 2 streams.  Each in a "gnlfilesource".  Each filesource in
> "gnlcomposition".  I have a callback for "pad-added" to each
> composition.  From what I have found and read.  "gnlfilesource"
> handles its own decodebin.
>
> The callback is never called in the case of 2 video streams.  I get a
> decodebin error.  Below...
> 'gstdecodebin2.c(3135): gst_decode_bin_expose ():
> /GstPipeline:mypipeline/GnlComposition:gnlcomposition1/GnlFileSource:gnlfilesource1/GstURIDecodeBin:internal-uridecodebin/GstDecodeBin2:decodebin20:\nno
> suitable plugins found'
>
> If I do the 2 audio streams this works.  And I can connect this to an
> "input-selector"
> If I use just gnlfilesource without the compositions I have the same
> problem as well.
>
> It still seems like I am missing something fundamental.  Do I need to
> build my own input's using "gnlsource" and not "gnlfilesource"?
>
> Thanks,
> Matt
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Gnolin/Python - decoding 2 video streams

Luis de Bethencourt
On Tue, Feb 15, 2011 at 11:25 PM, Matt Veenstra <[hidden email]> wrote:

> Solved.  My bug.  Copy and paste error on the caps.
>
>                self.stream1.set_property("caps", gst.caps_from_string("video/x-raw-yuv"))
>                self.stream2.set_property("caps", gst.caps_from_string("audio/x-raw-yuv"))
>
> I am sure there will be more questions.
>
> On Tue, Feb 15, 2011 at 1:07 PM, Matt Veenstra <[hidden email]> wrote:
>> Hi,
>>
>> I am now trying to get 2 video streams connected end to end in gnolin
>> and I am still missing a some pieces.
>>
>> I have 2 streams.  Each in a "gnlfilesource".  Each filesource in
>> "gnlcomposition".  I have a callback for "pad-added" to each
>> composition.  From what I have found and read.  "gnlfilesource"
>> handles its own decodebin.
>>
>> The callback is never called in the case of 2 video streams.  I get a
>> decodebin error.  Below...
>> 'gstdecodebin2.c(3135): gst_decode_bin_expose ():
>> /GstPipeline:mypipeline/GnlComposition:gnlcomposition1/GnlFileSource:gnlfilesource1/GstURIDecodeBin:internal-uridecodebin/GstDecodeBin2:decodebin20:\nno
>> suitable plugins found'
>>
>> If I do the 2 audio streams this works.  And I can connect this to an
>> "input-selector"
>> If I use just gnlfilesource without the compositions I have the same
>> problem as well.
>>
>> It still seems like I am missing something fundamental.  Do I need to
>> build my own input's using "gnlsource" and not "gnlfilesource"?
>>
>> Thanks,
>> Matt

Glad we could help ;)
just kidding, good that you got it solved.

Luis
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Gnolin/Python - decoding 2 video streams

abirato
In reply to this post by Matt Veenstra
unsubscribe

Luis de Bethencourt <[hidden email]> wrote:

>On Tue, Feb 15, 2011 at 11:25 PM, Matt Veenstra <[hidden email]> wrote:
>> Solved.  My bug.  Copy and paste error on the caps.
>>
>>                self.stream1.set_property("caps", gst.caps_from_string("video/x-raw-yuv"))
>>                self.stream2.set_property("caps", gst.caps_from_string("audio/x-raw-yuv"))
>>
>> I am sure there will be more questions.
>>
>> On Tue, Feb 15, 2011 at 1:07 PM, Matt Veenstra <[hidden email]> wrote:
>>> Hi,
>>>
>>> I am now trying to get 2 video streams connected end to end in gnolin
>>> and I am still missing a some pieces.
>>>
>>> I have 2 streams.  Each in a "gnlfilesource".  Each filesource in
>>> "gnlcomposition".  I have a callback for "pad-added" to each
>>> composition.  From what I have found and read.  "gnlfilesource"
>>> handles its own decodebin.
>>>
>>> The callback is never called in the case of 2 video streams.  I get a
>>> decodebin error.  Below...
>>> 'gstdecodebin2.c(3135): gst_decode_bin_expose ():
>>> /GstPipeline:mypipeline/GnlComposition:gnlcomposition1/GnlFileSource:gnlfilesource1/GstURIDecodeBin:internal-uridecodebin/GstDecodeBin2:decodebin20:\nno
>>> suitable plugins found'
>>>
>>> If I do the 2 audio streams this works.  And I can connect this to an
>>> "input-selector"
>>> If I use just gnlfilesource without the compositions I have the same
>>> problem as well.
>>>
>>> It still seems like I am missing something fundamental.  Do I need to
>>> build my own input's using "gnlsource" and not "gnlfilesource"?
>>>
>>> Thanks,
>>> Matt
>
>Glad we could help ;)
>just kidding, good that you got it solved.
>
>Luis
>_______________________________________________
>gstreamer-devel mailing list
>[hidden email]
>http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

How to change rank of a plugin by configuration(without change code and recompile)

Bu, Long
Hi,
        I am wondering if there is a chance to change the rank of a plugin by some configuration without modifying code and rebuilding.

        Thanks a lot!

Cheers.
Long
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to change rank of a plugin by configuration(without change code and recompile)

Julien Moutte
Here is how it's done in Moovida :

bp_enable_factory (const gchar *name, gboolean enable)
{
    GstRegistry *registry = NULL;
    GstElementFactory *factory = NULL;

    registry = gst_registry_get_default ();
    if (G_UNLIKELY (!registry)) {
        bp_debug ("failed retrieving default registry");
        goto beach;
    }

    factory = gst_element_factory_find (name);
    if (G_UNLIKELY (!factory)) {
        bp_debug ("unable to locate the %s factory", name);
        goto beach;
    }

    // Raise Rank to Primary + 2 as Fluendo codecs use Primary + 1.
    if (enable) {
        gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), GST_RANK_PRIMARY + 2);
    }
    else { // Or set it back to NONE.
        gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), GST_RANK_NONE);
    }

beach:
    if (factory && registry) {
        gst_registry_add_feature (registry, GST_PLUGIN_FEATURE (factory));
    }

    return;
}

Julien Moutte
CTO 
Fluendo
San Francisco, USA & Barcelona, SPAIN
Tel BCN. +34 933 175 153
Tel USA. 
+1 415 773 5353

www.fluendo.com & www.moovida.com

P Please consider the environment before printing this e-mail.




On Fri, Feb 25, 2011 at 10:36 AM, Bu, Long <[hidden email]> wrote:
Hi,
       I am wondering if there is a chance to change the rank of a plugin by some configuration without modifying code and rebuilding.

       Thanks a lot!

Cheers.
Long
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

RE: How to change rank of a plugin by configuration(without change code and recompile)

Bu, Long

Mmm.., thanks for your sharing.

But What I what is something like configuration files that gstreamer can read to set ranks automatically.

 

Cheers.

Long

 

From: gstreamer-devel-bounces+long.bu=[hidden email] [mailto:gstreamer-devel-bounces+long.bu=[hidden email]] On Behalf Of Julien Moutte
Sent: Friday, February 25, 2011 6:10 PM
To: Discussion of the development of and with GStreamer
Subject: Re: How to change rank of a plugin by configuration(without change code and recompile)

 

Here is how it's done in Moovida :

 

bp_enable_factory (const gchar *name, gboolean enable)

{

    GstRegistry *registry = NULL;

    GstElementFactory *factory = NULL;

 

    registry = gst_registry_get_default ();

    if (G_UNLIKELY (!registry)) {

        bp_debug ("failed retrieving default registry");

        goto beach;

    }

 

    factory = gst_element_factory_find (name);

    if (G_UNLIKELY (!factory)) {

        bp_debug ("unable to locate the %s factory", name);

        goto beach;

    }

 

    // Raise Rank to Primary + 2 as Fluendo codecs use Primary + 1.

    if (enable) {

        gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), GST_RANK_PRIMARY + 2);

    }

    else { // Or set it back to NONE.

        gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), GST_RANK_NONE);

    }

 

beach:

    if (factory && registry) {

        gst_registry_add_feature (registry, GST_PLUGIN_FEATURE (factory));

    }

 

    return;

}

Julien Moutte
CTO 
Fluendo
San Francisco, USA & Barcelona, SPAIN
Tel BCN. +34 933 175 153
Tel USA. 
+1 415 773 5353

www.fluendo.com & www.moovida.com

P Please consider the environment before printing this e-mail.



On Fri, Feb 25, 2011 at 10:36 AM, Bu, Long <[hidden email]> wrote:

Hi,
       I am wondering if there is a chance to change the rank of a plugin by some configuration without modifying code and rebuilding.

       Thanks a lot!

Cheers.
Long
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

 


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel