Is there a way to crop in VAAPI?

Michael Olbrich m.olbrich at pengutronix.de
Mon Aug 5 12:33:38 UTC 2019


On Mon, Aug 05, 2019 at 02:54:16PM +0800, Yan Wang wrote:
> 
> On 8/3/2019 9:25 PM, Nicolas Dufresne-5 [via GStreamer-devel] wrote:
> > Le vendredi 02 août 2019 à 20:45 -0500, kmliu a écrit :
> > 
> > > I need to decode H.264 video via VAAPI and then extract the decoded
> > frames to
> > > main memory. Since I intend to crop the frames anyway, I'd like to
> > crop them
> > > while they're still in graphics memory, to reduce memory bandwidth
> > > consumption. So conceptually, I want to do this:
> > >
> > > gst-launch-1.0 rtspsrc location=rtsp_uri ! rtph264depay ! vaapih264dec
> > !
> > > videocrop left=x right=x top=x bottom=x ! filesink location=video.yuv
> > >
> > > But I think this will end up copying the whole frames to main memory
> > before
> > > cropping it there. It would be nice if vaapipostproc supports cropping?
> > 
> > Another (simplier) option is to use gltransformation, but apparently
> > not all distro ship this plugin.
> 
> May I add the crop option for vaapih264dec?
> 
> It may be more direct.

If I read the code correctly, then vaapipostproc already suppports
GstVideoCropMeta. So I think you could do ... ! vaapih264dec !
vaapipostproc ! ... and add a pad probe that adds the crop meta to each
buffer.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


More information about the gstreamer-devel mailing list