Skip to content Skip to sidebar Skip to footer

Install Gstreamer Support For Opencv Python Package

I have built my own opencv python package from source. import cv2 print(cv2.__version__) prints: 3.4.5 Now the issue I am facing is regarding the use of gstreamer from the VideoC

Solution 1:

For those who are struggling with the same problem on Windows... I had to set following CMake Options:

  1. only set "WITH_GSTREAMER" option to True, "WITH_GSTREAMER_0_10" MUST BE FALSE
  2. add new entry "GSTREAMER_DIR"=(path to gstreamer) for me it was "C:/gstreamer/1.0/x86_64" I found this solution here

My OpenCV version: 3.4.3

Solution 2:

I was able to solve the issue, with a bit of help from the opencv support forum. Looking at the cmake output hints at the problem:

-- Checking formodule'gstreamer-base-0.10'
--   No package'gstreamer-base-0.10' found
-- Checking formodule'gstreamer-video-0.10'
--   No package'gstreamer-video-0.10' found
-- Checking formodule'gstreamer-app-0.10'
--   No package'gstreamer-app-0.10' found
-- Checking formodule'gstreamer-riff-0.10'
--   No package'gstreamer-riff-0.10' found
-- Checking formodule'gstreamer-pbutils-0.10'
--   No package'gstreamer-pbutils-0.10' found

During ccmake, I had set both WITH_GSTREAMER as well as WITH_GSTREAMER_0_10 to ON. Seems that cmake prefers the gstreamer0.10 flag over the one for gstreamer1.0. Since I only have gstreamer1.0 installed, opencv entirely failed setting up the gstreamer dependencies.

I made sure to whipe all previously deployed binaries:

cd <opencv-src>/build 
sudo make uninstall

Then I simply reinstalled, with the adjusted settings (given my knowledge above):

ccmake ..
make -j8
sudo make install

when I

import cv2
print(cv2.getBuildInformation())

my console now outputs

Video I/O:DC1394:NOFFMPEG:NOavcodec:NOavformat:NOavutil:NOswscale:NOavresample:NOGStreamer:base:YES(ver1.8.3)video:YES(ver1.8.3)app:YES(ver1.8.3)riff:YES(ver1.8.3)pbutils:YES(ver1.8.3)libv4l/libv4l2:NOv4l/v4l2:linux/videodev2.h

Bottom line is, do not set WITH_GSTREAMER_0_10 to ON during cmake, if you actually want gstreamer1.0. In that case you must only set WITH_GSTREAMER ON

Solution 3:

Installing the packages libgstreamer1.0-dev and libgstreamer-plugins-base1.0-dev helped me to solve this issue.

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

Post a Comment for "Install Gstreamer Support For Opencv Python Package"