Querying framerate in Python

joseph joseph.celi at jci.com
Wed Jul 22 17:24:36 UTC 2020


It seems to be able to support Gst.Fraction.

I get the following output ... I also included the snippet

$ python run_appsink.py 
GSTSample - constructor
width == 640
height == 480
<class 'gi.repository.Gst.Fraction'>
An exception occurred
Exception ignored in: <module 'threading' from
'/Users/josephceli/.pyenv/versions/3.6.1/lib/python3.6/threading.py'>
Traceback (most recent call last):
  File "/Users/josephceli/.pyenv/versions/3.6.1/lib/python3.6/threading.py",
line 1296, in _shutdown
    _main_thread._delete()
  File "/Users/josephceli/.pyenv/versions/3.6.1/lib/python3.6/threading.py",
line 1015, in _delete
    del _active[get_ident()]
KeyError: 123145386319872

-----------------------------------------------------------------------------------------------

def get_frame_res(self, sample):
        caps_format = sample.get_caps().get_structure(0)
        frmt_str = caps_format.get_value('format')
        video_format = GstVideo.VideoFormat.from_string(frmt_str)
        width = caps_format.get_value('width')
        print("width == {}".format(width))
        height = caps_format.get_value('height')
        print("height == {}".format(height))
        print(Gst.Fraction)
        try:
            fps = caps_format.get_value('framerate')
            print("fps == {}".format(fps))
        except:
            print("An exception occurred")
        sys.exit()
        return width, height, fps



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list