Gnolin/Python - decoding 2 video streams

Matt Veenstra matt at tribalmedia.com
Tue Feb 15 14:09:35 PST 2011


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 <matt at tribalmedia.com> 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
gstreamer-devel at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list