[gst-devel] Using gnonlin to extract time segments from a video file
Rodrigo Manhães
rmanhaes at gmail.com
Sat Feb 21 00:32:58 CET 2009
Hi,
2009/2/18 Edward Hervey <bilboed at gmail.com>:
> Your code is fine, but the mpeg file is the culprit. Seeking in mpeg
> files is not 100% functional (yes, it sucks, really), and therefore
> gnonlin can't work effectivelly with those files :(
Ok! I tested the same code with ogg video files and worked fine. Thank you!
What format is better supported by gnonlin? I'll establish a canonical
video format for my application, so this information is very useful.
>> I understood your explanation, but I don't know how to program it. The
>> example you gave creates a gst.Caps object, but how do I set the caps
>> to the source or composition? I tried to do
>>
>> source.set_property('caps', gst.Caps("audio/x-raw-int"))
>
> Make that "audio/x-raw-int;audio/x-raw-float" so that it allows any
> kind of raw audio to come out.
I tried to do this but I received the same GST_PAD_LINK_NOFORMAT error.
The form of setting caps I wrote above is correct? I've not found
references on doing this.
[]'s
Rodrigo
>
>>
>> but it also doesn't work, getting the following error
>>
>> gst.LinkError: <enum GST_PAD_LINK_NOFORMAT of type GstPadLinkReturn>
>>
>> when connecting the obtained pad to the audio encoder.
>>
>> []'s
>> Rodrigo
>>
>>
>> 2009/2/16 Edward Hervey <bilboed at gmail.com>:
>> > 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
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > 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
>> >
>>
>> ------------------------------------------------------------------------------
>> 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
>
>
> ------------------------------------------------------------------------------
> 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