0

I am using Gstreamer 1.14.5 with its Python bindings. I'm looking to remove custom RTP Header Extensions from an RTSP stream. Hence I need to open each packet, see if the X bit is set, and if so remove some part of the buffer.

This should be doable in a custom plugin using either the transform or transform_ip methods. As Python represents the buffers as immutable types (how to access the data of a GStreamer buffer in Python?), I'm using ctypes to attempt to access the memory underneath (https://lifestyletransfer.com/how-to-make-gstreamer-buffer-writable-in-python/)

I have found that while the above tutorial works for creating a new buffer and modifying it, it doesn't work in the Python Gstreamer pipeline using a custom plugin (GstRemoveHeaderExtensions):

"( rtspsrc location={} name=source latency=50 ! GstRemoveHeaderExtensions ! rtph264depay name=depay ! rtph264pay name=pay0 pt=96".format(self.source_url))

in GstRemoveHeaderExtensions we see an error on the line:

with map_gst_buffer(buf, Gst.MapFlags.READ | Gst.MapFlags.WRITE) as mapped:

raise ValueError("Writable array requested but buffer is not writeable")

Perhaps transform_ip creates or modifies a buffer in a different way? Either way is it possible to make them accessible during execution of the pipeline?

Possibly relevant. Using:

sys.getrefcount(pbuffer)

We see ref count is 5.

Seb Squire
  • 11
  • 4

0 Answers0