# Anaconda, Python, OpenCV, Capture file with GStreamer error Plugin

**URL:** <https://forum.opencv.org/t/anaconda-python-opencv-capture-file-with-gstreamer-error-plugin/11644>\
**Category:** Python\
**Created:** [January 16, 2023, 8:27pm UTC](https://forum.opencv.org/t/anaconda-python-opencv-capture-file-with-gstreamer-error-plugin/11644 "2023-01-16T20:27:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ersin\_Dogan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/ersin_dogan/32/6973_2.png) [@Ersin\_Dogan](https://forum.opencv.org/u/Ersin_Dogan)\
**Post date:** [January 16, 2023, 8:27pm UTC](https://forum.opencv.org/t/anaconda-python-opencv-capture-file-with-gstreamer-error-plugin/11644/1 "2023-01-16T20:27:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [January 16, 2023, 11:27pm UTC](https://forum.opencv.org/t/anaconda-python-opencv-capture-file-with-gstreamer-error-plugin/11644/3 "2023-01-16T23:27:40Z")

</div>

you’re reading a video file? or from a live webcam? what is the goal?

webcams have native API backends (DSHOW, MSMF). video files are handled by ffmpeg.

gstreamer is not required and not recommended for these two sources. why do you bother with gstreamer pipelines at all? the “WARN” stuff is warnings, nothing else. that’s mostly noise.

---

<div class="post-metadata">

**Author:** ![Ersin\_Dogan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/ersin_dogan/32/6973_2.png) [@Ersin\_Dogan](https://forum.opencv.org/u/Ersin_Dogan)\
**Post date:** [January 17, 2023, 11:23am UTC](https://forum.opencv.org/t/anaconda-python-opencv-capture-file-with-gstreamer-error-plugin/11644/4 "2023-01-17T11:23:23Z")

</div>

Yes, actually I didn’t recognize that the code is still running. But it felt like it stopped and looked like it was frozen. The program continues running but it is very very slow, since I make a jump until I detect a movement and these jumping of 2 s = 120 frames with

> vs.set(cv2.CAP\_PROP\_POS\_FRAMES, fps\*2)

is getting slower and slower. This was not the case before.

Anyhow: Any idea why I get the GStreamer warning? I don’t want to do anything with Gstreamer. May be I have some ffmpeg issue?

I made some trials with simple code showing the problem with the slow jump.

> import cv2  
> import time
> 
> filename = “E:/DaVinciResolveProjects/20221208\_OffsetSystem/20230115\_2157/20230115\_2157.mkv”  
> vs = cv2.VideoCapture(filename)

Here I just read 600 frames

> print(‘Task: read 600 frames’)  
> framei = 0  
> tic = time.time()  
> while framei\< 600:  
> framei = framei + 1  
> ret, frame = vs.read()
> 
> toc = time.time()  
> print(str(round(toc-tic,3))+'s - '+str(round(600/(toc-tic),3))+‘fps’)

results in

> Task: read 600 frames  
> 11.78s - 50.933fps

Now look at this: If I try to jump further 600 frames the times are really slow

> print(‘Task: Jump from frame 600 to 1200’)  
> tic = time.time()  
> framei = 1200  
> vs.set(cv2.CAP\_PROP\_POS\_FRAMES, framei)
> 
> toc = time.time()  
> print(str(round(toc-tic,3))+'s - '+str(round(600/(toc-tic),3))+‘fps’)

The time it takes :

> Task: Jump from frame 600 to 1200  
> 12.843s - 46.716fps

I think I will open just an other thread, since this problem not be related to the topic.

---

<div class="post-metadata">

**Author:** ![pmil](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@pmil](https://forum.opencv.org/u/pmil)\
**Post date:** [July 3, 2023, 10:11am UTC](https://forum.opencv.org/t/anaconda-python-opencv-capture-file-with-gstreamer-error-plugin/11644/5 "2023-07-03T10:11:26Z")

</div>

Hey Ersin\_Dogan,  
Have you found a solution to this problem?  
I am using a simple script in python to split the video into separate frames and save them as pictures. And since I reinstalled anaconda it doesn’t work anymore and gives the same errors as yours.  
The script stops at  
cap = cv2.VideoCapture(‘50.mp4’)

Have you fixed the link with GStreamer or have you solved it in a different way?

Thank you in advance!
