Hi,
I am coding in python since 2 years now. I had setup anaconda using OpenCV and everything was working fine. My code is reading a video of a billiard table with balls on it and I extract the route of each ball on it. Unfortunately my Anaconda got corrupt and all my environment setup is lost now.
So I tried now to replicate the setup:
- Windows 11
- Anaconda 2.3.1,
- with an environment using Python 3.9.15
- OpenCV 4.6.0, just installed in anaconda
Now my code is not running anymore. Here is a snippet from the beginning:
import cv2
filename = “E:/DaVinciResolveProjects/20221208_OffsetSystem/20230115_2157/20230115_2157.mkv”
vs = cv2.VideoCapture(filename)frames_total = int(vs.get(cv2.CAP_PROP_FRAME_COUNT))
fps = int(vs.get(cv2.CAP_PROP_FPS ))
frame_width = int(vs.get(3))
frame_height = int(vs.get(4))
It produces a error message when it calls the
cv2.VideoCapture(filename)
error message is:
[ WARN:0] global …\modules\videoio\src\cap_gstreamer.cpp (2060) cv::handleMessage OpenCV | GStreamer warning: your GStreamer installation is missing a required plugin
[ WARN:0] global …\modules\videoio\src\cap_gstreamer.cpp (2076) cv::handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module uridecodebin0 reported: Your GStreamer installation is missing a plug-in.>
[ WARN:0] global …\modules\videoio\src\cap_gstreamer.cpp (1053) cv::GStreamerCapture::open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global …\modules\videoio\src\cap_gstreamer.cpp (616) cv::GStreamerCapture::isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
I tried to search and fix the issue with installing gstreamer, tried older versions of python and openCV, but didn’t work.
I have tried to modified the code like following:
gst_str = (“filesrc location=E:/20230115_2157.mkv ! decodebin ! video/x-matroska ! queue ! videoconvert ! appsink”)
self.vs = cv2.VideoCapture(gst_str, cv2.CAP_GSTREAMER)
But produced similar error:
[ WARN:0] global …\modules\videoio\src\cap_gstreamer.cpp (2060) cv::handleMessage OpenCV | GStreamer warning: your GStreamer installation is missing a required plugin
[ WARN:0] global …\modules\videoio\src\cap_gstreamer.cpp (2076) cv::handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module decodebin0 reported: Your GStreamer installation is missing a plug-in.
[ WARN:0] global …\modules\videoio\src\cap_gstreamer.cpp (1053) cv::GStreamerCapture::open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global …\modules\videoio\src\cap_gstreamer.cpp (616) cv::GStreamerCapture::isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
I read very often that others “built their openCV with GStreamer”. But this is only necessary if you compile a program. I instead just want to run my python scripts.
Actually I never noticed up to now that within openCV a backend is used for the video capturing, nor I have ever had heard about GStreamer…
I actually only want to run it within the python command window or Spyder.
So here are my questions:
Is there an obvious really simple reason why it can’t work as I have done it?
Do I have to install GStreamer libraries manually or is it sufficient when I add the Gstreamer with Anaconda in to my environment?
Is the key to “make an openCV built” with GStreamer?
Please give me a hint in which direction I have to dig.