gnlcomposition plays only first clip
aetitcomb
andrew at pixelstreetinc.com
Tue Jul 14 08:32:25 PDT 2015
I'm having trouble concatenating two audio clips back-to-back. Ultimately, I
want them to overlap . . . but, I can't even get them both to play one after
the other.
Here's my script:
#!/usr/local/bin/python
import sys
import gobject, pygst
import gst
class GStreamerAudio(object):
def __init__(self):
gobject.threads_init()
# create the pipeline ----
self.pipeline = gst.Pipeline("audioPipeline")
# create a gnlcomposition ----
self.comp = gst.element_factory_make("gnlcomposition",
"audioComposition")
self.pipeline.add(self.comp)
self.comp.connect("pad-added", self.OnPad)
# create an audioconvert ----
self.audioConverter = gst.element_factory_make("audioconvert",
"audioConverter")
self.pipeline.add(self.audioConverter)
# create an alsasink for live output ----
self.sink = gst.element_factory_make("alsasink", "alsasink")
self.pipeline.add(self.sink)
self.audioConverter.link(self.sink)
# create file sources for each track ----
file0 = '/usr/home/bobbybrady/test1.aiff'
file1 = '/usr/home/cindybrady/test2.aiff'
audio0 = gst.element_factory_make("gnlfilesource", "audio0")
self.comp.add(audio0)
audio0.set_property("location", file0)
audio0.set_property("start",0 * gst.SECOND)
audio0.set_property("duration", 4 * gst.SECOND)
audio0.set_property("media-start", 0 * gst.SECOND)
audio0.set_property("media-duration", 4 * gst.SECOND)
audio1 = gst.element_factory_make("gnlfilesource", "audio1")
self.comp.add(audio1)
audio1.set_property("location", file1)
audio1.set_property("start", 4 * gst.SECOND)
audio1.set_property("duration", 3 * gst.SECOND)
audio1.set_property("media-start", 0 * gst.SECOND)
audio1.set_property("media-duration", 3 * gst.SECOND)
self.pipeline.set_state(gst.STATE_PLAYING)
# wait for keyboard input
raw_input('Press enter to stop playing...')
def OnPad(self, comp, pad):
convpad = self.audioConverter.get_compatible_pad(pad,
pad.get_caps())
pad.link(convpad)
if __name__ == '__main__':
GStreamerAudio()
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/gnlcomposition-plays-only-first-clip-tp4672672.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list