Getting video width / height
Tim-Philipp Müller
t.i.m at zen.co.uk
Sat Apr 6 02:20:46 PDT 2013
On Fri, 2013-04-05 at 20:42 -0700, Kip Warner wrote:
> > g_signal_emit_by_name (playbin, "get-video-pad", 0, &pad, NULL);
>
> Hey Stirling. That's a great start, but sadly the PyGi documentation is
> really scant and I'm having a hard time digging up anything on how to do
> this. I've tried get_property("get-video-pad") on the playbin object,
> but it knows of no such property. I tried a get_pad() call also on the
> playbin object and there's no such method either. It's really shooting
> in the dark with PyGi on most days it seems.
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.
Try something like this (untested):
from gi.repository import Gst
Gst.init(None)
playbin=Gst.ElementFactory.make('playbin',None)
playbin.set_property('uri','file:///path/to/video')
playbin.set_state(Gst.State.PLAYING)
#wait for state change to finish, but max 5secs
playbin.get_state(5000000000)
pad=playbin.emit('get-video-pad',0)
caps=pad.get_current_caps()
print caps.to_string()
I'm sure you can find a pygi tutorial somewhere so you don't have to
stab in the dark any longer.
On the python interpreter command line you can also do
help(playbin)
to see what methods are offered.
Cheers
-Tim
More information about the gstreamer-devel
mailing list