Gstremer vaapi pipeline to change color space

Andressio www.andreabertolaso at gmail.com
Tue Oct 9 10:27:07 UTC 2018


Hello everybody. I'm trying to build a pipeline to decode an h264 stream
coming from a rtsp camera. 
As the video is 4k i'm trying to use vaapi plugins.

If I launch this pipeline
/gst-launch-1.0 rtspsrc
location="rtsp://root:root@192.168.0.91:554/axis-media/media.amp?videocodec=h264&resolution=3840x2160"
protocols=GST_RTSP_LOWER_TRANS_TCP ! rtph264depay ! queue ! vaapih264dec !
vaapisink/

i can see the video and the cpu usage is around 20%.
But if I use that pipeline in Opencv the usage becomes 80%. The piepline in
opencv ends like this:
/... ! rtph264depay ! queue ! vaapih264dec ! videoconvert ! appsink/

If I understand correcty it is necessary the change of memory space from
VAsurface to standard memory that opencv can mange, and also a change of
color space from (probably) something like NV12 to BGR which opencv normally
use.
So I tried to perform the color space conversion directly in hw in order to
reduce the cpu usage but unfortunatly I did not succed. 

I tried to use the vaapipostproc and vaapidecodebin plugins like this
1) /...rtph264depay ! queue ! vaapih264dec ! videopostproc format=bgr !
videoconvert ! appsikn/
2) /...rtph264depay ! queue ! vaapih264dec ! videopostproc !
video/x-raw,format=(string)BGR ! videoconvert ! appsikn/
3) /...rtph264depay ! queue ! vaapidecodebin ! videoconvert !
video/x-raw,format=(string)BGR ! videoconvert ! appsikn/

The last one launched from terminal with this pipeline
/... ! rtph264depay ! queue ! vaapih264dec ! vaapipostproc !
video/x-raw,format=(string)BGR ! autovideosink/
gave this error: /could not link vaapipostproc0 to autovideosink0,
vaapipostproc0 can't handle caps video/x-raw, format=(string)BGR/, but the
GStreamer docs states that one of the output formats can be the one I want.

Do you now if ther is a way to perform the change in color space that
directly in hw? What is the proper way? Can this be ported to opencv?

Many thanks




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list