1

I am using gstreamer v1.14.5 with Python bindings. I have created a plugin by subclassing the GstBase.BaseTransform class and overriding its do_transform_ip method. The plugin draws a rectangle on the video frame.

class MyPlugin(GstBase.BaseTransform):

    def do_transform_ip(self, buffer: Gst.Buffer) -> Gst.FlowReturn:
        logging.info("in do_transform_ip")

        # draw rectangle on the video frame
        # I won't go into the implementation details here

        return Gst.FlowReturn.OK

The plugin works well when used with gst-launch-1.0:

gst-launch-1.0 videotestsrc ! myplugin ! videoconvert ! autovideosink

I have added debug messages to the do_transform_ip and those messages are displayed in the terminal. And rectangle is drawn on the video.

enter image description here

However when I create the pipeline manually, like in the code below, it seems like the plugin's do_transform_ip method is not called.

pipeline = Gst.Pipeline.new("test-pipeline")

source = Gst.ElementFactory.make("videotestsrc")
my_plugin = Gst.ElementFactory.make("myplugin")
converter = Gst.ElementFactory.make("videoconvert")
sink = Gst.ElementFactory.make("autovideosink")

pipeline.add(source)
pipeline.add(my_plugin)
pipeline.add(converter)
pipeline.add(sink)

source.link(my_plugin)
my_plugin.link(converter)
converter.link(sink)

pipeline.set_state(Gst.State.PLAYING)

No log messages are displayed in the terminal and the rectangle is not drawn on the video. The video output of videotestsrc is displayed properly, but without the rectangle.

enter image description here

What am I missing here?

GunnerFan
  • 3,576
  • 3
  • 25
  • 38

0 Answers0