I installed GStreamer using MSYS2 by following this tutorial.
I installed the necessary plugins on the tutorial and tried to run the following code (which is also in the tutorial):
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()
thread = Thread(target=main_loop.run)
thread.start()
pipeline = Gst.parse_launch("udpsrc port=5600 ! application/x-rtp,media=video,clock-rate=90000,encoding-name=H264,payload=96 ! rtph264depay ! avdec_h264 ! appsink")
pipeline.set_state(Gst.State.PLAYING)
try:
while True:
sleep(0.1)
except KeyboardInterrupt:
pass
pipeline.set_state(Gst.State.NULL)
main_loop.quit()
But I get the following error:
gi.repository.GLib.GError: gst_parse_error: no element "avdec_h264"
I had this issue before and I remember solving it by installing gst-libav and some other similar GStreamer packages.
I tried to install every possible package that I can think of in MSYS like:
pacman -S mingw-w64-x86_64-gst-libav
But none of them solved my issue. Maybe there are some other problems other than missing packages but maybe I’m just simply missing a package. I don’t know.
Any kind of help is highly appreciated. Thanks everyone in advance.
I started to wonder if I opened the topic in the wrong place, so I just wanted to ask if you can check and move the topic to it’s correct place (maybe somewhere more “general”) if necessary. Of course, I can just reopen it if you can suggest a better place.
We did not write that tutorial, so you may be better served by contacting the tutorial author, or searching online for your error traceback.
From a brief look, you seem to be installing libraries for a Windows 10, 64-bit Intel-x86 computer. Does that match the device you’re running on? If you’re using a different system (e.g. Windows 11, or 32-bit Windows 10, or on an ARM chip instead of Intel) then the instructions there may not apply.
We have our own OpenCV/gstreamer tutorial, but it is targeted at Linux environments. You may wish to consider trying Ubuntu on your computer via WSL2 - Windows can often be a bit extra challenging for software development.
From looking at the timestamps, you created the topic at ~11pm my time on Thursday evening, then I didn’t have time to respond to this post on my Friday, and today is Monday, when I have responded.
I expect others on the forum have not provided responses because the topic is quite niche, and is reasonably unrelated to what most of the community here has expertise in.
I have however also moved your post to the “General Discussion” category, because Gstreamer is not a Blue Robotics software, and your problem is unrelated to the ArduSub autopilot firmware which Blue Robotics helps to develop
I was frustrated with this problem for the last couple of days. I figured it out this morning, and just I like I guessed, it was so simple.
I told you that instead of building OpenCV with GStreamer, I had decided to go with MSYS2.
I am not sure of this analysis but I think that my environment variables (which I added after installing regular GStreamer for Windows for my previous attempt) was causing the problem. After removing GStreamer bin and lib folders from environment variables, I had no more missing GStreamer plugin errors.
Even though I had a different python interpreter inside MSYS2 environment, it was still using those environment variables I had and it was trying to use the GStreamer in the Windows, not in the MSYS2 environment.
So the tutorial had no problem and it was my fault. Problem is solved.