<div dir="ltr"><div>Hello,</div><div><br></div><div>There is clearly something wrong with your gst-python installation. What does `print(Gst.Fraction)` do? It should print:                                                                                                                              `<class 'gi.overrides.Gst.Fraction>`</div><div><br></div><div>- Thibault<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 21, 2020 at 6:38 PM joseph <<a href="mailto:joseph.celi@jci.com">joseph.celi@jci.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I'm trying to query the framerate from a simple Python gstreamer script and<br>
seeing the following error<br>
<br>
TypeError: unknown type GstFraction<br>
<br>
I'm getting the same error on Ubuntu and Mac.  Here is the code snippet<br>
attempting to get the framerate<br>
<br>
<br>
    def get_frame_res(self, sample):<br>
        caps_format = sample.get_caps().get_structure(0)<br>
        frmt_str = caps_format.get_value('format')<br>
        video_format = GstVideo.VideoFormat.from_string(frmt_str)<br>
        width = caps_format.get_value('width')<br>
        height = caps_format.get_value('height')<br>
        fps = caps_format.get_value('framerate')<br>
        return width, height, fps<br>
<br>
<br>
The above method is called from my on_buffer method when I receive the first<br>
sample<br>
<br>
def on_buffer(self, sink: GstApp.AppSink, data: typ.Any) -> Gst.FlowReturn:<br>
        sample = sink.emit("pull-sample")<br>
        if self.frame_num == 0:<br>
            w, h, fps = self.get_frame_res(sample)<br>
            print("width::height::fps == {}:{}".format(w,h,fps))<br>
<br>
I have read through a lot of posts about installing the correct version of<br>
python-gst but nothing was able to allow me to get past the TypeError for<br>
GstFraction<br>
(ex. sudo apt-get install python-gst-1.0)<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://gstreamer-devel.966125.n4.nabble.com/" rel="noreferrer" target="_blank">http://gstreamer-devel.966125.n4.nabble.com/</a><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</blockquote></div>