How to use Gst.Fraction in python

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use Gst.Fraction in python

Arjen Veenhuizen
I want to set the "framerate" and "pixel-aspect-ratio" properties in the videoparse element. These properties are of the type "Fraction" according to gst-inspect-1.0.

Unfortunately, I cannot get this to work with Gst.Fraction.

The following attempts all fail:
self.elementVideoparse.set_property("pixel-aspect-ratio", 16, 11)
TypeError: GObject.set_property() takes exactly 2 arguments (3 given)

self.elementVideoparse.set_property("pixel-aspect-ratio", Gst.Fraction())
TypeError: could not convert '<gi.repository.Gst.Fraction object at 0x7fcc468774d0>' to type 'GstFraction' when setting property 'GstVideoParse.pixel-aspect-ratio'

self.elementVideoparse.set_property("pixel-aspect-ratio", Gst.Fraction(16, 11))
TypeError: object() takes no parameters

I came across this Gst.py file in gst-python, but I am unsure how to use it.

Any thoughts?

Ps. using git head of a couple of weeks ago

Reply | Threaded
Open this post in threaded view
|

Re: How to use Gst.Fraction in python

Thibault Saunier-4
Hello,

You should make sure gst-python is installed and you will then be able
to use it (it basically adds overrides to the PyGObject runtime
generated bindings).

Once you get it working you can use it simple like
doing`Gst.Fraction(1, 2)` and such.

Br,

Thibault

On Wed, Aug 24, 2016 at 10:20 AM, Arjen Veenhuizen
<[hidden email]> wrote:

> I want to set the "framerate" and "pixel-aspect-ratio" properties in the
> videoparse element. These properties are of the type "Fraction" according to
> gst-inspect-1.0.
>
> Unfortunately, I cannot get this to work with Gst.Fraction.
>
> The following attempts all fail:
>
>
> I came across this  Gst.py
> <https://cgit.freedesktop.org/gstreamer/gst-python/tree/gi/overrides/Gst.py>
> file in gst-python, but I am unsure how to use it.
>
> Any thoughts?
>
> Ps. using git head of a couple of weeks ago
>
>
>
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/How-to-use-Gst-Fraction-in-python-tp4679228.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to use Gst.Fraction in python

Arjen Veenhuizen
Thanks Thibault for your reply.

For future reference, I wasn't able to to get gst-python running from git [1], but things work just fine when installing the following package from the repository (Ubuntu 14.04 x64): sudo apt-get install python-gst-1.0

[1]
configure, make and make install all go smooth, but it is just not popping up in gst-inspect-1.0 and the mentioned missing functionality is not added. Log:

0:00:08.363767549 26455      0x1f78800 LOG       GST_PLUGIN_LOADING gstplugin.c:1446:gst_plugin_ext_dep_extract_env_vars_paths:<plugin66> expanding HOME = '/home/arjen' (path suffix: .gstreamer-1.0/plugins/python)
0:00:08.363785682 26455      0x1f78800 LOG       GST_PLUGIN_LOADING gstplugin.c:1474:gst_plugin_ext_dep_extract_env_vars_paths:<plugin66> path: '/home/arjen/.gstreamer-1.0/plugins/python'
0:00:08.363798037 26455      0x1f78800 LOG       GST_PLUGIN_LOADING gstplugin.c:1446:gst_plugin_ext_dep_extract_env_vars_paths:<plugin66> expanding GST_PLUGIN_SYSTEM_PATH = '(NULL)' (path suffix: python)
0:00:08.363811282 26455      0x1f78800 LOG       GST_PLUGIN_LOADING gstplugin.c:1446:gst_plugin_ext_dep_extract_env_vars_paths:<plugin66> expanding GST_PLUGIN_PATH = '/home/arjen/Dropbox/Development/projects/gstreamer_python_elements/' (path suffix: python)
0:00:08.363826092 26455      0x1f78800 LOG       GST_PLUGIN_LOADING gstplugin.c:1474:gst_plugin_ext_dep_extract_env_vars_paths:<plugin66> path: '/home/arjen/Dropbox/Development/projects/gstreamer_python_elements/python'
0:00:08.363836423 26455      0x1f78800 LOG       GST_PLUGIN_LOADING gstplugin.c:1489:gst_plugin_ext_dep_extract_env_vars_paths:<plugin66> Extracted 2 paths from environment
0:00:08.363847221 26455      0x1f78800 LOG       GST_PLUGIN_LOADING gstplugin.c:1664:gst_plugin_ext_dep_get_stat_hash:<plugin66> path: '/usr/local/lib/gstreamer-1.0/python'
0:00:08.363857696 26455      0x1f78800 LOG       GST_PLUGIN_LOADING gstplugin.c:1664:gst_plugin_ext_dep_get_stat_hash:<plugin66> path: 'HOME/.gstreamer-1.0/plugins/python'
0:00:08.363867914 26455      0x1f78800 LOG       GST_PLUGIN_LOADING gstplugin.c:1664:gst_plugin_ext_dep_get_stat_hash:<plugin66> path: 'GST_PLUGIN_SYSTEM_PATH/python'
0:00:08.363877808 26455      0x1f78800 LOG       GST_PLUGIN_LOADING gstplugin.c:1664:gst_plugin_ext_dep_get_stat_hash:<plugin66> path: 'GST_PLUGIN_PATH/python'
0:00:08.363943331 26455      0x1f78800 LOG       GST_PLUGIN_LOADING gstplugin.c:1626:gst_plugin_ext_dep_scan_path_with_filenames:<plugin66> stat: /home/arjen/.gstreamer-1.0/plugins/python (error: No such file or directory)
0:00:08.363961769 26455      0x1f78800 LOG       GST_PLUGIN_LOADING gstplugin.c:1629:gst_plugin_ext_dep_scan_path_with_filenames:<plugin66> stat: /home/arjen/Dropbox/Development/projects/gstreamer_python_elements/python (result: 9db3798b)
0:00:08.363983455 26455      0x1f78800 LOG       GST_PLUGIN_LOADING gstplugin.c:1626:gst_plugin_ext_dep_scan_path_with_filenames:<plugin66> stat: /usr/local/lib/gstreamer-1.0/python (error: No such file or directory)
0:00:08.364001317 26455      0x1f78800 LOG       GST_PLUGIN_LOADING gstplugin.c:1626:gst_plugin_ext_dep_scan_path_with_filenames:<plugin66> stat: HOME/.gstreamer-1.0/plugins/python (error: No such file or directory)
0:00:08.364017844 26455      0x1f78800 LOG       GST_PLUGIN_LOADING gstplugin.c:1626:gst_plugin_ext_dep_scan_path_with_filenames:<plugin66> stat: GST_PLUGIN_SYSTEM_PATH/python (error: No such file or directory)
0:00:08.364035356 26455      0x1f78800 LOG       GST_PLUGIN_LOADING gstplugin.c:1626:gst_plugin_ext_dep_scan_path_with_filenames:<plugin66> stat: GST_PLUGIN_PATH/python (error: No such file or directory)
0:00:08.364046810 26455      0x1f78800 LOG       GST_PLUGIN_LOADING gstplugin.c:1678:gst_plugin_ext_dep_get_stat_hash:<plugin66> done, scan_hash: 9db37986
0:00:08.364057262 26455      0x1f78800 DEBUG     GST_PLUGIN_LOADING gstplugin.c:1794:gst_plugin_add_dependency:<plugin66> added dependency:
0:00:08.364065385 26455      0x1f78800 DEBUG     GST_PLUGIN_LOADING gstplugin.c:1796:gst_plugin_add_dependency:<plugin66>  evar: HOME/.gstreamer-1.0/plugins/python
0:00:08.365781113 26455      0x1f78800 DEBUG     GST_PLUGIN_LOADING gstplugin.c:1796:gst_plugin_add_dependency:<plugin66>  evar: GST_PLUGIN_SYSTEM_PATH/python
0:00:08.365792066 26455      0x1f78800 DEBUG     GST_PLUGIN_LOADING gstplugin.c:1796:gst_plugin_add_dependency:<plugin66>  evar: GST_PLUGIN_PATH/python
0:00:08.365797361 26455      0x1f78800 DEBUG     GST_PLUGIN_LOADING gstplugin.c:1798:gst_plugin_add_dependency:<plugin66>  path: /usr/local/lib/gstreamer-1.0/python
0:00:08.365801598 26455      0x1f78800 DEBUG     GST_PLUGIN_LOADING gstplugin.c:1798:gst_plugin_add_dependency:<plugin66>  path: HOME/.gstreamer-1.0/plugins/python
0:00:08.365815157 26455      0x1f78800 DEBUG     GST_PLUGIN_LOADING gstplugin.c:1798:gst_plugin_add_dependency:<plugin66>  path: GST_PLUGIN_SYSTEM_PATH/python
0:00:08.365821063 26455      0x1f78800 DEBUG     GST_PLUGIN_LOADING gstplugin.c:1798:gst_plugin_add_dependency:<plugin66>  path: GST_PLUGIN_PATH/python
0:00:08.365826234 26455      0x1f78800 LOG                 pyplugin gstpythonplugin.c:231:plugin_init: Checking to see if libpython is already loaded
0:00:08.365837103 26455      0x1f78800 LOG                 pyplugin gstpythonplugin.c:236:plugin_init: loading libpython
0:00:08.365917426 26455      0x1f78800 LOG                 pyplugin gstpythonplugin.c:248:plugin_init: python wasn't initialized
0:00:08.374926489 26455      0x1f78800 LOG                 pyplugin gstpythonplugin.c:257:plugin_init: initializing pygobject

** (gst-plugin-scanner:26455): CRITICAL **: Could not get Gst.Element
0:00:08.390208275 26455      0x1f78800 WARN      GST_PLUGIN_LOADING gstplugin.c:526:gst_plugin_register_func: plugin "/usr/local/lib/gstreamer-1.0/libgstpythonplugin.so" failed to initialise
0:00:08.390221208 26455      0x1f78800 DEBUG     GST_PLUGIN_LOADING gstplugin.c:829:_priv_gst_plugin_load_file_for_registry: gst_plugin_register_func failed for plugin "/usr/local/lib/gstreamer-1.0/libgstpythonplugin.so"
0:00:08.390230795 26455      0x1f78800 DEBUG     GST_PLUGIN_LOADING gstplugin.c:125:gst_plugin_finalize: finalizing plugin <plugin66>