Skip to content

Enabling GStreamer source in G API

Anastasiya(Asya) Pronina edited this page May 9, 2023 · 4 revisions

Building G-API with GStreamer support on Ubuntu 20.04:

  • As a first step, you need to install the following dependencies:

    $ sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-{base,good,bad}
  • Secondly, you need to launch OpenCV cmake with an extra option specified:

    $ cmake /path-to-opencv -DOPENCV_GAPI_GSTREAMER=ON

After completing these steps, you should see the following in the cmake output:

-- Checking for module 'gstreamer-base-1.0'
--   Found gstreamer-base-1.0, version 1.16.3
-- Checking for module 'gstreamer-app-1.0'
--   Found gstreamer-app-1.0, version 1.16.3
-- Checking for module 'gstreamer-riff-1.0'
--   Found gstreamer-riff-1.0, version 1.16.3
-- Checking for module 'gstreamer-pbutils-1.0'
--   Found gstreamer-pbutils-1.0, version 1.16.3
-- Checking for module 'gstreamer-video-1.0'
--   Found gstreamer-video-1.0, version 1.16.3
-- Checking for module 'gstreamer-audio-1.0'
--   Found gstreamer-audio-1.0, version 1.16.3

And, also the following:

--   Video I/O:
--   ...
--     GStreamer:                   YES (1.16.3)
--   ...

Running G-API GStreamerSource Tests:

When you build G-API with GStreamer support, tests for streaming via GStreamerSource are enabled. However, some of them require test data from opencv_extra repository. So, to launch all the tests successfully, you need:

  • Clone opencv_extra repository:
    $ git clone https://github.com/opencv/opencv_extra.git
  • Set OPENCV_TEST_DATA_PATH environment variable:
    $ export OPENCV_TEST_DATA_PATH=/path-to-opencv_extra/testdata
  • Run tests with *GStreamer* filter:
    $ ./path-to-opencv-bin/opencv_test_gapi --gtest_filter=*GStreamer*

After completing these steps, you should see that all of tests pass. For example:

image

You may, however, notice some warnings during execution, like these ones:

image

or

image

Please don't worry, they are expected!

Clone this wiki locally