Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6404 Discussions

video hardware acceleration through cv::VideoCapture

zeng__li
Beginner
534 Views

openvino_2019.1.133

Can cv::VideoCapture run video decoding with hardware acceleration (va api)? 

Have a try with 'CAP_INTEL_MFX' like below,but "cap.open(fname, cv::CAP_INTEL_MFX)" return false

diff --git a/demos/smart_classroom_demo/src/image_grabber.cpp b/demos/smart_classroom_demo/src/image_grabber.cpp
index 56448f2..4f68a1b 100644
--- a/demos/smart_classroom_demo/src/image_grabber.cpp
+++ b/demos/smart_classroom_demo/src/image_grabber.cpp
@@ -12,7 +12,9 @@ ImageGrabber::ImageGrabber(const std::string& fname) {
     if (fname == "cam") {
         is_opened = cap.open(0);
     } else {
-        is_opened = cap.open(fname);
+        printf("use intel mfx video decoder\n");
+        is_opened = cap.open(fname, cv::CAP_INTEL_MFX);
 

Check VA which looks good:

hema@hema:~/qiuxing.zl/open_model_zoo/demos/build$ vainfo
vainfo: VA-API version: 1.4 (libva 2.1.0)
vainfo: Driver version: Intel iHD driver - 18.4.git_1d28de_2019-02-11
vainfo: Supported profile and entrypoints
      VAProfileNone                   :    VAEntrypointVideoProc
      VAProfileNone                   :    VAEntrypointStats
      VAProfileMPEG2Simple            :    VAEntrypointVLD
      VAProfileMPEG2Simple            :    VAEntrypointEncSlice
      VAProfileMPEG2Main              :    VAEntrypointVLD
      VAProfileMPEG2Main              :    VAEntrypointEncSlice
      VAProfileH264Main               :    VAEntrypointVLD

 

Best Regards,

    Li

0 Kudos
1 Reply
Maksim_S_Intel
Employee
534 Views

OpenCV in OpenVINO 2019R1 do not have MediaSDK backend built-in. Try to use GStreamer backend with custom pipeline:

VideoCapture cap("filesrc location=file.mp4 ! qtdemux ! vaapidecodebin ! videoconvert ! appsink sync=false", CAP_GSTREAMER);

You will need to install gstreamer1.0-vaapi package (Ubuntu) and choose correct demux element for your container (qtdemux, matroskademux, etc.).

0 Kudos
Reply