Gnolin and Python - Theora/Vorbis ogg video only creating one pad

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

Gnolin and Python - Theora/Vorbis ogg video only creating one pad

Matt Veenstra
Hi,

I use a gnlfilesource with an .ogv source file (theora/vorbis).  I
only get one pad created when we start playing (the video pad), I
never receive the audio pad added callback of the composition.

I tried to add a "decodebin" and connect this to the composition or
gnlfilesource without any luck.

What am I missing to get both pads created?  A plain vorbis audio file
works fine.  I receive no errors in the code.

Here is the code.

class Main:
        def __init__(self):
                self.mainloop = gobject.MainLoop()
               
                # creating the pipeline
                self.pipeline = gst.Pipeline("mypipeline")
               
                # Create bus and connect several handlers
                self.bus = self.pipeline.get_bus()
                self.bus.add_signal_watch()
                self.bus.connect('message::eos', self.OnEOS)
                self.bus.connect('message::tag', self.OnTag)
                self.bus.connect('message::error', self.OnError)
               
                # creating a gnlcomposition
                self.comp = gst.element_factory_make("gnlcomposition", "composition")
                self.pipeline.add(self.comp)
                self.comp.connect("pad-added", self.OnPad)
               
                # create an audioconvert
                self.audioconvert = gst.element_factory_make("audioconvert", "audioconvert")
                self.pipeline.add(self.audioconvert)
                               
                # create an audioconvert
                self.videoconvert = gst.element_factory_make("ffmpegcolorspace")
                self.pipeline.add(self.videoconvert)

                # create an fakesink
                self.sink = gst.element_factory_make("fakesink", "fakesink")
                self.pipeline.add(self.sink)
               
                # create a gnlfilesource
                self.stream1 = gst.element_factory_make("gnlfilesource", "stream1")
                self.comp.add(self.stream1)

                # set the gnlfilesource properties
                self.stream1.set_property("location", "/transcoder/samples/video.ogv")
                # self.stream1.set_property("location",
"/transcoder/samples/Epoq-Lepidoptera.ogg")
                self.stream1.set_property("start", 0 * gst.SECOND)
                self.stream1.set_property("duration", 5 * gst.SECOND)
                self.stream1.set_property("media-start", 10 * gst.SECOND)
                self.stream1.set_property("media-duration", 5 * gst.SECOND)

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


        def OnPad(self, comp, pad):
                aCaps = pad.get_caps()
                aName = aCaps[0].get_name()
                print "pad added!", aName
               
                if aName == 'audio/x-raw-float' or aName == 'audio/x-raw-int':
                        convpad = self.audioconvert.get_compatible_pad(pad, pad.get_caps())
                        if not convpad.is_linked(): # Only link once
                                print "linking audio pads"
                                pad.link(convpad)
                                self.audioconvert.link(self.mux)
                elif aName == 'video/x-raw-yuv':
                        convpad = self.videoconvert.get_compatible_pad(pad, pad.get_caps())
                        if not convpad.is_linked(): # Only link once
                                print "linking video pads"
                                pad.link(convpad)
                                self.videoconvert.link(self.sink)


I am not sure this is the correct forum so please let me know if I
should post elsewhere.

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 and Python - Theora/Vorbis ogg video only creating one pad

Matt Veenstra
I worked my way through this and now have the basics working.  Here
are the 2 tricks and then plenty of details to get this working.

1. You must use 2 gnlfilesource with the same file and set the caps.
This makes sense.  I just missed this in the docs.
2. I was not able to get this to work if I put gnlfilesource in
gnlcomposition.  In this case I always failed in the linking of
elements and was not able to work around this.  I am not sure now when
to use gnlcomposition vs not.

Thanks,
Matt

On Fri, Feb 11, 2011 at 9:42 AM, Matt Veenstra <[hidden email]> wrote:

> Hi,
>
> I use a gnlfilesource with an .ogv source file (theora/vorbis).  I
> only get one pad created when we start playing (the video pad), I
> never receive the audio pad added callback of the composition.
>
> I tried to add a "decodebin" and connect this to the composition or
> gnlfilesource without any luck.
>
> What am I missing to get both pads created?  A plain vorbis audio file
> works fine.  I receive no errors in the code.
>
> Here is the code.
>
> class Main:
>        def __init__(self):
>                self.mainloop = gobject.MainLoop()
>
>                # creating the pipeline
>                self.pipeline = gst.Pipeline("mypipeline")
>
>                # Create bus and connect several handlers
>                self.bus = self.pipeline.get_bus()
>                self.bus.add_signal_watch()
>                self.bus.connect('message::eos', self.OnEOS)
>                self.bus.connect('message::tag', self.OnTag)
>                self.bus.connect('message::error', self.OnError)
>
>                # creating a gnlcomposition
>                self.comp = gst.element_factory_make("gnlcomposition", "composition")
>                self.pipeline.add(self.comp)
>                self.comp.connect("pad-added", self.OnPad)
>
>                # create an audioconvert
>                self.audioconvert = gst.element_factory_make("audioconvert", "audioconvert")
>                self.pipeline.add(self.audioconvert)
>
>                # create an audioconvert
>                self.videoconvert = gst.element_factory_make("ffmpegcolorspace")
>                self.pipeline.add(self.videoconvert)
>
>                # create an fakesink
>                self.sink = gst.element_factory_make("fakesink", "fakesink")
>                self.pipeline.add(self.sink)
>
>                # create a gnlfilesource
>                self.stream1 = gst.element_factory_make("gnlfilesource", "stream1")
>                self.comp.add(self.stream1)
>
>                # set the gnlfilesource properties
>                self.stream1.set_property("location", "/transcoder/samples/video.ogv")
>                # self.stream1.set_property("location",
> "/transcoder/samples/Epoq-Lepidoptera.ogg")
>                self.stream1.set_property("start", 0 * gst.SECOND)
>                self.stream1.set_property("duration", 5 * gst.SECOND)
>                self.stream1.set_property("media-start", 10 * gst.SECOND)
>                self.stream1.set_property("media-duration", 5 * gst.SECOND)
>
>                self.pipeline.set_state(gst.STATE_PLAYING)
>                self.mainloop.run()
>
>
>        def OnPad(self, comp, pad):
>                aCaps = pad.get_caps()
>                aName = aCaps[0].get_name()
>                print "pad added!", aName
>
>                if aName == 'audio/x-raw-float' or aName == 'audio/x-raw-int':
>                        convpad = self.audioconvert.get_compatible_pad(pad, pad.get_caps())
>                        if not convpad.is_linked(): # Only link once
>                                print "linking audio pads"
>                                pad.link(convpad)
>                                self.audioconvert.link(self.mux)
>                elif aName == 'video/x-raw-yuv':
>                        convpad = self.videoconvert.get_compatible_pad(pad, pad.get_caps())
>                        if not convpad.is_linked(): # Only link once
>                                print "linking video pads"
>                                pad.link(convpad)
>                                self.videoconvert.link(self.sink)
>
>
> I am not sure this is the correct forum so please let me know if I
> should post elsewhere.
>
> 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 and Python - Theora/Vorbis ogg video only creating one pad

Edward Hervey
Administrator
On Fri, 2011-02-11 at 10:49 -0800, Matt Veenstra wrote:
> I worked my way through this and now have the basics working.  Here
> are the 2 tricks and then plenty of details to get this working.
>
> 1. You must use 2 gnlfilesource with the same file and set the caps.
> This makes sense.  I just missed this in the docs.

  gnonlin objects only output one stream (specified through the 'caps'
property).
  If you want to handle both audio and video, you'll need two
compositions.

> 2. I was not able to get this to work if I put gnlfilesource in
> gnlcomposition.  In this case I always failed in the linking of
> elements and was not able to work around this.  I am not sure now when
> to use gnlcomposition vs not.

  A composition is only needed when you need to use more than one object
(a composition). If you don't to handle more than one 'file' you're fine
to just use two gnlfilesource like you are.
  If you need to start composing things, you'll need two compositions
with your various objects in it.

    Edward

>
> Thanks,
> Matt
>
> On Fri, Feb 11, 2011 at 9:42 AM, Matt Veenstra <[hidden email]> wrote:
> > Hi,
> >
> > I use a gnlfilesource with an .ogv source file (theora/vorbis).  I
> > only get one pad created when we start playing (the video pad), I
> > never receive the audio pad added callback of the composition.
> >
> > I tried to add a "decodebin" and connect this to the composition or
> > gnlfilesource without any luck.
> >
> > What am I missing to get both pads created?  A plain vorbis audio file
> > works fine.  I receive no errors in the code.
> >
> > Here is the code.
> >
> > class Main:
> >        def __init__(self):
> >                self.mainloop = gobject.MainLoop()
> >
> >                # creating the pipeline
> >                self.pipeline = gst.Pipeline("mypipeline")
> >
> >                # Create bus and connect several handlers
> >                self.bus = self.pipeline.get_bus()
> >                self.bus.add_signal_watch()
> >                self.bus.connect('message::eos', self.OnEOS)
> >                self.bus.connect('message::tag', self.OnTag)
> >                self.bus.connect('message::error', self.OnError)
> >
> >                # creating a gnlcomposition
> >                self.comp = gst.element_factory_make("gnlcomposition", "composition")
> >                self.pipeline.add(self.comp)
> >                self.comp.connect("pad-added", self.OnPad)
> >
> >                # create an audioconvert
> >                self.audioconvert = gst.element_factory_make("audioconvert", "audioconvert")
> >                self.pipeline.add(self.audioconvert)
> >
> >                # create an audioconvert
> >                self.videoconvert = gst.element_factory_make("ffmpegcolorspace")
> >                self.pipeline.add(self.videoconvert)
> >
> >                # create an fakesink
> >                self.sink = gst.element_factory_make("fakesink", "fakesink")
> >                self.pipeline.add(self.sink)
> >
> >                # create a gnlfilesource
> >                self.stream1 = gst.element_factory_make("gnlfilesource", "stream1")
> >                self.comp.add(self.stream1)
> >
> >                # set the gnlfilesource properties
> >                self.stream1.set_property("location", "/transcoder/samples/video.ogv")
> >                # self.stream1.set_property("location",
> > "/transcoder/samples/Epoq-Lepidoptera.ogg")
> >                self.stream1.set_property("start", 0 * gst.SECOND)
> >                self.stream1.set_property("duration", 5 * gst.SECOND)
> >                self.stream1.set_property("media-start", 10 * gst.SECOND)
> >                self.stream1.set_property("media-duration", 5 * gst.SECOND)
> >
> >                self.pipeline.set_state(gst.STATE_PLAYING)
> >                self.mainloop.run()
> >
> >
> >        def OnPad(self, comp, pad):
> >                aCaps = pad.get_caps()
> >                aName = aCaps[0].get_name()
> >                print "pad added!", aName
> >
> >                if aName == 'audio/x-raw-float' or aName == 'audio/x-raw-int':
> >                        convpad = self.audioconvert.get_compatible_pad(pad, pad.get_caps())
> >                        if not convpad.is_linked(): # Only link once
> >                                print "linking audio pads"
> >                                pad.link(convpad)
> >                                self.audioconvert.link(self.mux)
> >                elif aName == 'video/x-raw-yuv':
> >                        convpad = self.videoconvert.get_compatible_pad(pad, pad.get_caps())
> >                        if not convpad.is_linked(): # Only link once
> >                                print "linking video pads"
> >                                pad.link(convpad)
> >                                self.videoconvert.link(self.sink)
> >
> >
> > I am not sure this is the correct forum so please let me know if I
> > should post elsewhere.
> >
> > Thanks,
> > Matt
> >
> _______________________________________________
> 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