Python VideoFilter Plugin. Buffer None in do_transform_frame
Kevron Rees
tripzero.kev at gmail.com
Sat Jan 9 17:07:06 PST 2016
On Fri, Jan 8, 2016 at 7:57 AM Hernando Rojas <hrojas at lacuatro.com.ar>
wrote:
> 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.
>
Curious. I have code that worked on 1.5 that no longer works on 1.6. I
can no longer create my filter element with Gst.Element.make("foo")
anymore. Could you share how you are registering your element? Do you
know if that changed between 1.5 and 1.6?
Thanks
Kevron
>
> Thank you very much!
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160110/465462e5/attachment.html>
More information about the gstreamer-devel
mailing list