Getting video width / height
kip at thevertigo.com
Sun Apr 7 17:57:48 PDT 2013
On Sat, 2013-04-06 at 10:20 +0100, Tim-Philipp Müller wrote:
> The PyGI API works pretty much exactly like the C API, the only thing
> where it's a bit different is when there are 'out' arguments (like &pad
> here) in the C API, then you might get a tuple with multiple return
> values in python.
Hey Tim. I wish it were that straightforward. My experience has been the
PyGI API tends to not always use namespaces with predictable names or
members. Sometimes it misses things completely in its bindings (.gir
issues), and other times it has them available, but the documentation
misses key things a developer needs (e.g. calling Gst.init()). But I
think that I will definitely consider using the C API over PyGI for
future applications until the documentation is more complete.
> Try something like this (untested):
> from gi.repository import Gst
> #wait for state change to finish, but max 5secs
> print caps.to_string()
Thanks a lot. Here's what I'm trying...
# Check the video's dimensions...
(success, videoWidth) = \
(success, videoHeight) = \
It works fine, but I'd like to understand better what the get_state call
and its magic number parameter is doing? I'm guessing you are trying to
buffer enough data for the video's metadata (e.g. width / height) to
have been extracted from the stream? But as usual, when I check
get_state's documentation, it leaves me wanting:
It doesn't look like it takes a parameter, or maybe it's overridden at
a higher level? Or am I just totally reading the API documentation
wrong? The link is, after all, for the old Python 2 bindings.
> I'm sure you can find a pygi tutorial somewhere so you don't have to
> stab in the dark any longer.
The tutorials are great, but they can cover only so much. That's really
where API documentation comes in. But if you try and look for complete
PyGI documentation anywhere, you won't find it. The best you'll be able
to come up with is generating your own via g-ir-doc-tool which are
still incomplete unfortunately. But hey, I'm grateful that Gst even
> On the python interpreter command line you can also do
> to see what methods are offered.
I haven't tried it for playbin, but I've found that most of the time I
need to use the help function, what I end up getting is a documentation
stub that was machine generated and lacking what I actually needed
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 198 bytes
Desc: This is a digitally signed message part
More information about the gstreamer-devel