Skip to content

Instantly share code, notes, and snippets.

@alumae
Created May 22, 2013 12:40
Show Gist options
  • Save alumae/5627250 to your computer and use it in GitHub Desktop.
Save alumae/5627250 to your computer and use it in GitHub Desktop.
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
GObject.threads_init()
Gst.init(None)
appsrc = Gst.ElementFactory.make("appsrc", "appsrc")
filesink = Gst.ElementFactory.make("filesink", "filesink")
filesink.set_property("location", "test.dat")
pipeline = Gst.Pipeline()
pipeline.add(appsrc)
pipeline.add(filesink)
appsrc.link(filesink)
pipeline.set_state(Gst.State.PLAYING)
data = "1234" * 12
print "Using data: %s" % data
buf = Gst.Buffer.new_allocate(None, len(data), None)
buf.fill(0, data, len(data))
appsrc.emit("push-buffer", buf)
pipeline.send_event(Gst.Event.new_eos())
result = open("test.dat").read()
print "Result : %s" % result
@SpirosArk
Copy link

SpirosArk commented Mar 24, 2021

I fixed your errors in my fork and created a working version of your code. On Python 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment