I am looking into gstreamer as a means to choose a video device from a list to feed it to an opencv script.
I absolutely do not understand how to use gstreamer with python in windows. I installed the Windows gstreamer 1.07 binaries from the gstreamer official website. However, I could not import the pygst
and gst
modules in python.
>>> import pygst
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pygst
ImportError: No module named pygst
>>>
I checked the gstreamer installation, and there seems to be no pygst.py
provided. There is however a file named gst-env
that contains paths for environnement variables (that were not added to the system variables on installation. I checked.
Other questions on the same problem here and here, for example, do all use the winbuild versions of gstreamer. Why is that so?
I am totally lost on this one.
Ok, I managed it using the SDK for Gstreamer 0.10 (in which there is a pygst.py
), but is there not a way to use the Gstreamer 1.0 series, since 0.10 is "end-of-life"?
This is a bit late, but hopefully it will help.
The easiest way to use GStreamer 1.0 is to download the latest version from: http://sourceforge.net/projects/pygobjectwin32/files/
This will install Python (2.7 or 3.3) modules and, optionally, GStreamer with plugins.
However, if you already have GStreamer 0.10 SDK (from docs.gstreamer.com/display/GstSDK/Home) and old installation of GStreamer 1.0 somewhere, there might be some problems with running Gstreamer 0.10 Python programs, like ImportError: DLL load failed etc. Here's my detailed setup for everything:
Installation of Gst 0.10 SDK and Python modules
Installation of Gst 1.0 and Python modules
You may test your installation like this:
python2 -c "import gi; gi.require_version('Gst', '1.0'); from gi.repository import Gst; Gst.init(None); pipeline = Gst.parse_launch('playbin uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm'); pipeline.set_state(Gst.State.PLAYING); bus = pipeline.get_bus();msg = bus.timed_pop_filtered(Gst.CLOCK_TIME_NONE, Gst.MessageType.ERROR | Gst.MessageType.EOS)"
Edit: If you use both GStreamer0.10 and GStreamer1.0 it's better to create a separate virtual environment for GStreamer0.10 and put .pth files in its site-packages directory. See my comment below.
HTH, Tom