Python VideoFilter Plugin. Buffer None in do_transform_frame
Hernando Rojas
hrojas at lacuatro.com.ar
Fri Jan 8 07:43:41 PST 2016
Sebastian, el Wed, 06 Jan 2016 10:17:23 +0200
escribiste:
> On Di, 2016-01-05 at 18:19 -0300, hrojas at lacuatro.com.ar wrote:
> > Hello,
> > I am trying to develop a custom video filter plugin but I am
> > getting an empty buffer in VideoFrame parameter.
> >
> > The code is as follows:
> >
> > def do_transform_frame_ip(self, f):
> > try:
> > data = f.buffer.extract_dup(0, f.buffer.get_size())
> > bgr = numpy.ndarray((1080, 1920, 3), buffer=data,
> > dtype=numpy.uint8)
> > print bgr.shape
> > except Exception as e:
> > print e
> >
> > return Gst.FlowReturn.OK
> >
> > VideoFrame metada is fine, but Buffer is None
>
> What do you mean with metadata? The other fields of the GstVideoFrame?
> Are the plane data pointers set to something useful too?
Sorry, I meant streaminfo. VideoInfo struct looks ok.
eg.
gst-launch-1.0 videotestsrc ! 'video/x-raw, format=BGR, width=1920, height=1080' ! videoconvert ! videoscale ! videofiltertest ! fakesink
outputs this VideoInfo caps:
video/x-raw, format=(string)BGR, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)sRGB, framerate=(fraction)30/1
and these plane data pointers:
[140355236265984, 140356041679008, 0, 140359531233279]
But buffer field is None
>
> My guess would be that this is something wrong with the Python
> bindings, and them not being able to handle GstBuffer typed struct
> fields.
Surely, something went wrong after upgrade to lastests versions.
I had been using 1.5.0 and updated to 1.6.2 (also tried 1.7.1 with no luck)
>
> You could also try using GstBaseTransform directly instead of
> GstVideoFilter if you're going to directly access the buffers directly
> and not using GstVideoFrame... however from looking at your code you
> should probably use more of the GstVideoFrame metadata instead. The row
> stride for example.
I tried GstBaseTransform with do_transform() and it works! I can get and change buffer bytes.
So I'll use that insted.
Thank you very much!
More information about the gstreamer-devel
mailing list