How to run gstreamer vaapi with opencv
Hello,
I'm trying to run live RTSP stream from IP camera with opencv VideoCapture() class using gstreamer with VA-API to offload decoding operation to gpu.
I was able to run successfully the next pipeline from terminal: (Display of live video was opened)
‘gst-launch-1.0 rtspsrc location=rtsp://UserName:password@CamIp:CamPort latency=0 ! decodebin ! videoconvert ! vaapisink'
The problem is that I could not find a pipeline (with VA-API) that works with opencv videoCapture(). Our opencv installation was built from source with G-Streamer. Is it sufficient to support VA-API? If so, Is there a known pipeline for our use case including VA-API that works with opencv?
here is vainfo output:
libva info: VA-API version 1.9.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /opt/intel/mediasdk/lib64/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_9
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.9 (libva 2.5.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 20.3.0 (86ec0b6f)
vainfo: Supported profile and entrypoints
VAProfileNone : VAEntrypointVideoProc
VAProfileNone : VAEntrypointStats
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Simple : VAEntrypointEncSlice
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointFEI
VAProfileH264Main : VAEntrypointEncSliceLP
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointFEI
VAProfileH264High : VAEntrypointEncSliceLP
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointEncPicture
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264ConstrainedBaseline: VAEntrypointFEI
VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
VAProfileVP8Version0_3 : VAEntrypointVLD
VAProfileVP8Version0_3 : VAEntrypointEncSlice
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSlice
VAProfileHEVCMain : VAEntrypointFEI
VAProfileHEVCMain10 : VAEntrypointVLD
VAProfileHEVCMain10 : VAEntrypointEncSlice
VAProfileVP9Profile0 : VAEntrypointVLD
VAProfileVP9Profile2 : VAEntrypointVLD
gst-inspect-1.0 vaapi output:
Plugin Details:
Name vaapi
Description VA-API based elements
Filename /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvaapi.so
Version 1.16.1
License LGPL
Source module gstreamer-vaapi
Source release date 2019-09-23
Binary package gstreamer-vaapi
Origin URL http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer
vaapijpegdec: VA-API JPEG decoder
vaapimpeg2dec: VA-API MPEG2 decoder
vaapih264dec: VA-API H264 decoder
vaapivc1dec: VA-API VC1 decoder
vaapivp8dec: VA-API VP8 decoder
vaapivp9dec: VA-API VP9 decoder
vaapih265dec: VA-API H265 decoder
vaapipostproc: VA-API video postprocessing
vaapidecodebin: VA-API Decode Bin
vaapisink: VA-API sink
vaapimpeg2enc: VA-API MPEG-2 encoder
vaapih265enc: VA-API H265 encoder
vaapivp8enc: VA-API VP8 encoder
vaapijpegenc: VA-API JPEG encoder
vaapih264enc: VA-API H264 encoder
vaapih264feienc: VA-API H264 FEI Advanced encoder (Experimental)
16 features:
+-- 16 elements
The PC information:
CPU: Intel® Core™ i9-9900 CPU @ 3.10GHz × 16
Graphic: Intel® UHD Graphics 630 (Coffeelake 3x8 GT2)
Cameras information: we use H.264/H.265 protocol. from 720p and up to 4k resolutions.