Skip to content

Python & GStreamer

Alex Lennon edited this page Dec 26, 2020 · 2 revisions

Basic example from http://lifestyletransfer.com/how-to-launch-gstreamer-pipeline-in-python/

# create pipeline object 
pipeline = Gst.Pipeline() 
 
# create Gst.Element by plugin name 
src = Gst.ElementFactory.make("videotestsrc") 
 
# as Gst.Element inherit from GObject 
# we can use GObject methods to set property of element
src.set_property("num-buffers", 50) 
 
# create Gst.Element by plugin name 
sink = Gst.ElementFactory.make("gtksink") 
 
# as Gst.Pipeline is container of Gst.Elements 
# add src, sink to Gst.Pipeline 
pipeline.add(src, sink) 
 
# link src with sink 
# Note: elements should be elements of same Gst.Pipeline 
src.link(sink)

Clone this wiki locally