Trying to learn rtsp gstreamer with opencv connections. Searched for the error i had like 2 days nothing has helped.
I’m trying to learn this topic for one week and couldn’t run even a single example. At first, i tried it on my conda env then I yielded and installed MSYS2 MINGW and installed everything I find necessary. Don’t sure i’ve installed everything but i’ve installed ” gstreamer, gst-plugins-(base,good,bad,ugly) , gst-devtools , glib 2.0 , pygobject — at least these i know. “
py file:
from threading import Thread
from time import sleep
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst, Glib
Gst.init()
main_loop = Glib.MainLoop()
main_loop_thread = Thread(target=main_loop.run)
main_loop_thread.start()
pipeline = Gst.parse_launch("ksvideosrc ! decodebin ! videoconvert ! autovideosink")
pipeline.set_state(Gst.State.PLAYING)
try:
while True:
sleep(0.1)
except KeyboardInterrupt:
pass
pipeline.set_state(Gst.State.NULL)
main_loop.quit()
main_loop_thread.join()
error msg:
File "c:/msys64/home/husey/thy.py", line 5, in <module>
from gi.repository import Gst, Glib
File "C:msys64mingw64libpython3.11site-packagesgiimporter.py", line 133, in create_module
raise ImportError('cannot import name %s, '
ImportError: cannot import name Glib, introspection typelib not found
this is the link that i used for trying to learn: https://gist.github.com/velovix/8cbb9bb7fe86a08fb5aa7909b2950259
Tried to make sure add wingmw directory to path in the system variables. This solved my “gst-inspect-1.0” problem in the terminal it works as it is listing all the gstreamer library. Also have tried use pip for installing some of the dependencies but it said I’ve already installed them.
1
I’m so dumb… I looked to gitrepository-1.0 and saw “Glib” .typelib file named as “GLib”. I changed it on my code and it worked. Hoping for someone doesn’t encounter this situation like me 🙂
1