[gst-devel] Using gnonlin to extract time segments from a video file
Edward Hervey
bilboed at gmail.com
Mon Feb 16 09:06:24 CET 2009
Hi,
GNonLin elements are one-output-stream-only elements. If you wish to
do processing on audio AND video, you will have to create:
* 2 compositions (one per media type)
* 2 sources (one per media type), you will have to set the 'caps'
properties of each of the sources to the correct type (Ex:
gst.Caps("video/x-raw-yuv;video/x-raw-rgb") for the video one).
Then put one source in each composition and connect each of those
composition to the adequate downstream elements (sinks, encoders,
etc...).
Why only one stream ? Because it is the lowest common denominator for
all types of non-linear operations. Various tests have proven the
overhead of duplicating the sources is minimal provided you code them
properly (the only duplicated processing part will be the filesource and
demuxer).
Hope this helps,
Edward
On Fri, 2009-02-13 at 15:53 -0200, Rodrigo Manhães wrote:
> Hi,
>
> I wrote two small scripts to explain my problem on getting dynamic
> pads with gnonlin.
>
> The first, with no gnonlin, uses a filesrc, and prints:
>
> video/x-raw-yuv
> audio/x-raw-int
>
> indicating that it found the two pads.
> The code is below.
>
> ###
> import gst
> import gtk
>
> pipeline = gst.Pipeline()
>
> source = gst.element_factory_make('filesrc')
> source.set_property('location', 'creature.mpg')
> pipeline.add(source)
>
> decoder = gst.element_factory_make('decodebin')
> pipeline.add(decoder)
> source.link(decoder)
>
> def on_new_pad(bin, pad):
> print pad.get_caps()[0].get_name()
>
> decoder.connect('pad-added', on_new_pad)
>
> pipeline.set_state(gst.STATE_PLAYING)
> gtk.main()
>
> ####
>
> The second, using gnonlin, prints:
>
> video/x-raw-yuv
>
> indicating that only the video stream was found. (If I connect the
> signal to gnlfilesource rather than gnlcomposition, the result is the
> same)
> The code is below:
>
> ###
> import gst
> import gtk
>
> pipeline = gst.Pipeline()
>
> composition = gst.element_factory_make('gnlcomposition')
> pipeline.add(composition)
>
> source = gst.element_factory_make('gnlfilesource')
> source.set_property('location', 'creature.mpg')
> source.set_property('start', 0)
> source.set_property('media-start', 0)
> source.set_property('duration', 10)
> source.set_property('media-duration', 10)
> composition.add(source)
>
> def on_new_pad(bin, pad):
> print pad.get_caps()[0].get_name()
>
> source.connect('pad-added', on_new_pad)
>
> pipeline.set_state(gst.STATE_PLAYING)
> gtk.main()
> #####
>
> What am I doing wrong?
>
> []'s
> Rodrigo
>
> 2009/2/12 Rodrigo Manhães <rmanhaes at gmail.com>:
> > 2009/2/12 Edward Hervey <bilboed at gmail.com>:
> >> 'new-decoded-pad' is a convenience signal for new pads on decodebin.
> >> The normal signal for new pads being added to an element is 'pad-added'.
> >
> > Using 'pad-added' signal, the callback is called only once, for the
> > video stream. The pad for audio part is not added.
> >
> > []'s
> > Rodrigo
> >
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
More information about the gstreamer-devel
mailing list