Compiling Opencv with Gstreamer, cmake not finding GStreamer

Asymptote picture Asymptote · Jun 7, 2016 · Viewed 18.5k times · Source

I want to build opencv with GStreamer support.

I built the GStreamer from source (version 1.8.1) following this guide: http://kacianka.at/?p=145 I have 'gstreamer_build' folder at my home directory and it contains 'bin' folder with these:

gst-device-monitor-1.0 gst-discoverer-1.0 gst-inspect-1.0 gst-launch-1.0 gst-play-1.0 gst-stats-1.0 gst-typefind-1.0 orc-bugreport orcc

I have this path added to my environment variable PATH.

When I use cmake like:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules -D BUILD_opencv_python3=ON -D WITH_GSTREAMER=ON -D WITH_FFMPEG=OFF ..

I get the following output clearly indicating that gstreamer is not found:

-- checking for module 'gstreamer-base-1.0'
--   package 'gstreamer-base-1.0' not found
-- checking for module 'gstreamer-video-1.0'
--   package 'gstreamer-video-1.0' not found
-- checking for module 'gstreamer-app-1.0'
--   package 'gstreamer-app-1.0' not found
-- checking for module 'gstreamer-riff-1.0'
--   package 'gstreamer-riff-1.0' not found
-- checking for module 'gstreamer-pbutils-1.0'
--   package 'gstreamer-pbutils-1.0' not found
-- checking for module 'gstreamer-base-0.10'
--   package 'gstreamer-base-0.10' not found
-- checking for module 'gstreamer-video-0.10'
--   package 'gstreamer-video-0.10' not found
-- checking for module 'gstreamer-app-0.10'
--   package 'gstreamer-app-0.10' not found
-- checking for module 'gstreamer-riff-0.10'
--   package 'gstreamer-riff-0.10' not found
-- checking for module 'gstreamer-pbutils-0.10'
--   package 'gstreamer-pbutils-0.10' not found

and this:

Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  NO
--     FFMPEG:                      NO
--       codec:                     NO
--       format:                    NO
--       util:                      NO
--       swscale:                   NO
--       resample:                  NO
--       gentoo-style:              NO
--     GStreamer:                   NO
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     OpenNI2:                     NO
--     PvAPI:                       NO
--     GigEVisionSDK:               NO
--     UniCap:                      NO
--     UniCap ucil:                 NO
--     V4L/V4L2:                    Using libv4l1 (ver 1.0.1) / libv4l2 (ver 1.0.1)
--     XIMEA:                       NO
--     Xine:                        NO
--     gPhoto2:                     NO

Can anyone help me with this?

Answer

Dan0 picture Dan0 · Jan 15, 2017

I had the same problem.

gstreamer-base corresponds to libgstbase-1.0.so (or libgstbase-0.10.so), found in package libgstreamer1.0-0 (or libgstreamer0.10-0, as the case may be). Below, we install the '-dev' package.

The other libraries (libgst-video, libgst-app, libgst-riff, libgst-pbutils) I found in package libgstreamer-plugins-base1.0-dev (again, substitute the version you wish to use, either v0.1, or v1.0).

Therefore, the following command should be used to install the missing dependencies:

sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

Repeat the cmake command, possibly purging the contents of the build directory beforehand.