Windows / Gstreamer and camera_gi

264 views
Skip to first unread message

Edwin Fromme

unread,
Dec 22, 2020, 3:22:18 AM12/22/20
to Kivy users support
Hi everyone,

I'm coding an application that need webcam devices and I'm using 'python-opencv' provider through Kivy 2.0.
It's working but it takes a while to open the webcam or change device index.

So, I would like to try 'camera_gi' provider but I'm unable to use it, I get the following error:
"gi - ModuleNotFoundError: No module named 'gi'
File "...\venv_test\lib\site-packages\kivy\core\__init__.py", line 62, in core_select_lib
  fromlist=[modulename], level=0)
File "...\venv_test\lib\site-packages\kivy\core\camera\camera_gi.py", line 10, in <module>
  from gi.repository import Gst "

I also tried to setup MSYS and MinGW, with python3 and python3-gobject and all gstreamer framework. In this case, I was able to import Gst (from a basic sample) but I cannot setup Kivy in this environment.

Briefly, on a clean python windows env, I cannot use "camera_gi" because it missing PyGobject. In a second time, I'm unable to install Kivy in a MSYS env with Gstreamer and PyGObject.

Do you know if "camera_gi" is only available for Linux ? If not, do you have any suggest ?
I would like to avoid doing a Kivy build for MinGW.

Thanks ;)
 

Elliot Garbus

unread,
Dec 22, 2020, 10:30:02 AM12/22/20
to kivy-...@googlegroups.com

It looks like you have discovered a bug in Kivy 2.0.0

I suggest you file an issue on the GitHub site.

 

I ran this simple code that runs under my kivy 1.11.1 installation, and see the failures below.

 

from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
import time


kv =
'''
CameraClick:
    orientation: 'vertical'
    Camera:
        id: camera
        resolution: (640, 480)
        play: True
    Button:
        text: 'Capture'
        size_hint_y: None
        height: '48dp'
        on_release: root.capture()
'''


class CameraClick(BoxLayout):
   
def capture(self):
        camera =
self.ids.camera
        time_str = time.strftime(
"%Y%m%d_%H%M%S")
        camera.export_to_png(
f'IMG_{time_str}.png')
       
print("Captured")


class TestCamera(App):
   
def build(self):
       
return Builder.load_string(kv)


TestCamera().run()

 

 

I I have installed Kivy 2.0.0 with the [base, media] options.

On kivy 2.0.0  with the -d option set I get the following log:

 

(kivy_venv200) C:\Users\ellio\PycharmProjects\KivyHelp200>python cameratest.py -d

[INFO   ] [Logger      ] Record log in C:\Users\ellio\.kivy\logs\kivy_20-12-22_4.txt

[INFO   ] [deps        ] Successfully imported "kivy_deps.gstreamer" 0.3.1

[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.3.0

[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.3.0

[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.3.1

[INFO   ] [Kivy        ] v2.0.0

[INFO   ] [Kivy        ] Installed at "C:\Users\ellio\kivy_venv200\lib\site-packages\kivy\__init__.py"

[INFO   ] [Python      ] v3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)]

[INFO   ] [Python      ] Interpreter at "C:\Users\ellio\kivy_venv200\Scripts\python.exe"

[INFO   ] [Factory     ] 186 symbols loaded

[DEBUG  ] [Cache       ] register <kv.lang> with limit=None, timeout=None

[DEBUG  ] [Cache       ] register <kv.image> with limit=None, timeout=60

[DEBUG  ] [Cache       ] register <kv.atlas> with limit=None, timeout=None

[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)

[DEBUG  ] [Cache       ] register <kv.texture> with limit=1000, timeout=60

[DEBUG  ] [Cache       ] register <kv.shader> with limit=1000, timeout=3600

[DEBUG  ] [App         ] Loading kv <C:\Users\ellio\PycharmProjects\KivyHelp200\testcamera.kv>

[DEBUG  ] [App         ] kv <C:\Users\ellio\PycharmProjects\KivyHelp200\testcamera.kv> not found

[INFO   ] [Window      ] Provider: sdl2

[INFO   ] [GL          ] Using the "OpenGL" graphics system

[INFO   ] [GL          ] GLEW initialization succeeded

[DEBUG  ] [GL          ] available extensions: b'GL_3DFX_texture_compression_FXT1 GL_AMD_depth_clamp_separate GL_AMD_vertex_shader_layer GL_AMD_vertex_shader_viewport_index GL_ARB_ES2_com

patibility GL_ARB_ES3_1_compatibility GL_ARB_ES3_compatibility GL_ARB_arrays_of_arrays GL_ARB_base_instance GL_ARB_bindless_texture GL_ARB_blend_func_extended GL_ARB_buffer_storage GL_ARB

_cl_event GL_ARB_clear_buffer_object GL_ARB_clear_texture GL_ARB_clip_control GL_ARB_color_buffer_float GL_ARB_compatibility GL_ARB_compressed_texture_pixel_storage GL_ARB_compute_shader

GL_ARB_conditional_render_inverted GL_ARB_conservative_depth GL_ARB_copy_buffer GL_ARB_copy_image GL_ARB_cull_distance GL_ARB_debug_output GL_ARB_depth_buffer_float GL_ARB_depth_clamp GL_

ARB_depth_texture GL_ARB_derivative_control GL_ARB_direct_state_access GL_ARB_draw_buffers GL_ARB_draw_buffers_blend GL_ARB_draw_elements_base_vertex GL_ARB_draw_indirect GL_ARB_draw_inst

anced GL_ARB_enhanced_layouts GL_ARB_explicit_attrib_location GL_ARB_explicit_uniform_location GL_ARB_fragment_coord_conventions GL_ARB_fragment_layer_viewport GL_ARB_fragment_program GL_

ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_fragment_shader_interlock GL_ARB_framebuffer_no_attachments GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB GL_ARB_geometry_sha

der4 GL_ARB_get_program_binary GL_ARB_get_texture_sub_image GL_ARB_gl_spirv GL_ARB_gpu_shader5 GL_ARB_gpu_shader_fp64 GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_indirect_para

meters GL_ARB_instanced_arrays GL_ARB_internalformat_query GL_ARB_internalformat_query2 GL_ARB_invalidate_subdata GL_ARB_map_buffer_alignment GL_ARB_map_buffer_range GL_ARB_multi_bind GL_

ARB_multi_draw_indirect GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_occlusion_query2 GL_ARB_pipeline_statistics_query GL_ARB_pixel_buffer_object GL_ARB_point_para

meters GL_ARB_point_sprite GL_ARB_polygon_offset_clamp GL_ARB_post_depth_coverage GL_ARB_program_interface_query GL_ARB_provoking_vertex GL_ARB_query_buffer_object GL_ARB_robust_buffer_ac

cess_behavior GL_ARB_robustness GL_ARB_robustness_isolation GL_ARB_sample_shading GL_ARB_sampler_objects GL_ARB_seamless_cube_map GL_ARB_seamless_cubemap_per_texture GL_ARB_separate_shade

r_objects GL_ARB_shader_atomic_counter_ops GL_ARB_shader_atomic_counters GL_ARB_shader_bit_encoding GL_ARB_shader_draw_parameters GL_ARB_shader_group_vote GL_ARB_shader_image_load_store G

L_ARB_shader_image_size GL_ARB_shader_objects GL_ARB_shader_precision GL_ARB_shader_stencil_export GL_ARB_shader_storage_buffer_object GL_ARB_shader_subroutine GL_ARB_shader_texture_image

_samples GL_ARB_shading_language_100 GL_ARB_shading_language_420pack GL_ARB_shading_language_packing GL_ARB_shadow GL_ARB_spirv_extensions GL_ARB_stencil_texturing GL_ARB_sync GL_ARB_tess

ellation_shader GL_ARB_texture_barrier GL_ARB_texture_border_clamp GL_ARB_texture_buffer_object GL_ARB_texture_buffer_object_rgb32 GL_ARB_texture_buffer_range GL_ARB_texture_compression G

L_ARB_texture_compression_bptc GL_ARB_texture_compression_rgtc GL_ARB_texture_cube_map GL_ARB_texture_cube_map_array GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_c

rossbar GL_ARB_texture_env_dot3 GL_ARB_texture_filter_anisotropic GL_ARB_texture_float GL_ARB_texture_gather GL_ARB_texture_mirror_clamp_to_edge GL_ARB_texture_mirrored_repeat GL_ARB_text

ure_multisample GL_ARB_texture_non_power_of_two GL_ARB_texture_query_levels GL_ARB_texture_query_lod GL_ARB_texture_rectangle GL_ARB_texture_rg GL_ARB_texture_rgb10_a2ui GL_ARB_texture_st

encil8 GL_ARB_texture_storage GL_ARB_texture_storage_multisample GL_ARB_texture_swizzle GL_ARB_texture_view GL_ARB_timer_query GL_ARB_transform_feedback2 GL_ARB_transform_feedback3 GL_ARB

_transform_feedback_instanced GL_ARB_transform_feedback_overflow_query GL_ARB_transpose_matrix GL_ARB_uniform_buffer_object GL_ARB_vertex_array_bgra GL_ARB_vertex_array_object GL_ARB_vert

ex_attrib_64bit GL_ARB_vertex_attrib_binding GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_vertex_type_10f_11f_11f_rev GL_ARB_vertex_type_2_10_10_10_rev GL

_ARB_viewport_array GL_ARB_window_pos GL_ATI_separate_stencil GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_E

XT_blend_subtract GL_EXT_clip_volume_hint GL_EXT_compiled_vertex_array GL_EXT_direct_state_access GL_EXT_draw_buffers2 GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit

GL_EXT_framebuffer_multisample GL_EXT_framebuffer_object GL_EXT_geometry_shader4 GL_EXT_gpu_program_parameters GL_EXT_gpu_shader4 GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_E

XT_packed_float GL_EXT_packed_pixels GL_EXT_polygon_offset_clamp GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shader_framebuffer_fetch GL_EXT_shader_

integer_mix GL_EXT_shadow_funcs GL_EXT_stencil_two_side GL_EXT_stencil_wrap GL_EXT_texture3D GL_EXT_texture_array GL_EXT_texture_compression_s3tc GL_EXT_texture_edge_clamp GL_EXT_texture_

env_add GL_EXT_texture_env_combine GL_EXT_texture_filter_anisotropic GL_EXT_texture_integer GL_EXT_texture_lod_bias GL_EXT_texture_rectangle GL_EXT_texture_sRGB GL_EXT_texture_sRGB_decode

GL_EXT_texture_shared_exponent GL_EXT_texture_snorm GL_EXT_texture_storage GL_EXT_texture_swizzle GL_EXT_timer_query GL_EXT_transform_feedback GL_IBM_texture_mirrored_repeat GL_INTEL_con

servative_rasterization GL_INTEL_fragment_shader_ordering GL_INTEL_framebuffer_CMAA GL_INTEL_map_texture GL_INTEL_multi_rate_fragment_shader GL_INTEL_performance_query GL_KHR_blend_equati

on_advanced GL_KHR_blend_equation_advanced_coherent GL_KHR_context_flush_control GL_KHR_debug GL_KHR_no_error GL_KHR_shader_subgroup GL_KHR_shader_subgroup_arithmetic GL_KHR_shader_subgro

up_ballot GL_KHR_shader_subgroup_basic GL_KHR_shader_subgroup_clustered GL_KHR_shader_subgroup_quad GL_KHR_shader_subgroup_shuffle GL_KHR_shader_subgroup_shuffle_relative GL_KHR_shader_su

bgroup_vote GL_KHR_texture_compression_astc_hdr GL_KHR_texture_compression_astc_ldr GL_NV_blend_square GL_NV_conditional_render GL_NV_primitive_restart GL_NV_texgen_reflection GL_SGIS_gen

erate_mipmap GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod GL_SUN_multi_draw_arrays GL_WIN_swap_hint WGL_EXT_swap_control'

[DEBUG  ] [GL          ] glShaderBinary is not available

[INFO   ] [GL          ] Backend used <glew>

[INFO   ] [GL          ] OpenGL version <b'4.6.0 - Build 27.20.100.9030'>

[INFO   ] [GL          ] OpenGL vendor <b'Intel'>

[INFO   ] [GL          ] OpenGL renderer <b'Intel(R) UHD Graphics 620'>

[INFO   ] [GL          ] OpenGL parsed version: 4, 6

[INFO   ] [GL          ] Shading version <b'4.60 - Build 27.20.100.9030'>

[INFO   ] [GL          ] Texture max size <16384>

[INFO   ] [GL          ] Texture max units <32>

[DEBUG  ] [Shader      ] Fragment compiled successfully

[DEBUG  ] [Shader      ] Vertex compiled successfully

[DEBUG  ] [ImageSDL2   ] Load <C:\Users\ellio\kivy_venv200\lib\site-packages\kivy\data\glsl\default.png>

[INFO   ] [Window      ] auto add sdl2 input provider

[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked

[DEBUG  ] [Camera      ] Ignored <picamera> (import error)

[DEBUG  ] [Camera      ] Ignored <gi> (import error)

[DEBUG  ] [Camera      ] Ignored <opencv> (import error)

[CRITICAL] [Camera      ] Unable to find any valuable Camera provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) an

d re-run your app to identify potential causes

picamera - ModuleNotFoundError: No module named 'picamera'

  File "C:\Users\ellio\kivy_venv200\lib\site-packages\kivy\core\__init__.py", line 58, in core_select_lib

    mod = __import__(name='{2}.{0}.{1}'.format(

  File "C:\Users\ellio\kivy_venv200\lib\site-packages\kivy\core\camera\camera_picamera.py", line 18, in <module>

    from picamera import PiCamera

 

gi - ModuleNotFoundError: No module named 'gi'

  File "C:\Users\ellio\kivy_venv200\lib\site-packages\kivy\core\__init__.py", line 58, in core_select_lib

    mod = __import__(name='{2}.{0}.{1}'.format(

  File "C:\Users\ellio\kivy_venv200\lib\site-packages\kivy\core\camera\camera_gi.py", line 10, in <module>

    from gi.repository import Gst

 

opencv - ModuleNotFoundError: No module named 'cv2'

  File "C:\Users\ellio\kivy_venv200\lib\site-packages\kivy\core\__init__.py", line 58, in core_select_lib

    mod = __import__(name='{2}.{0}.{1}'.format(

  File "C:\Users\ellio\kivy_venv200\lib\site-packages\kivy\core\camera\camera_opencv.py", line 48, in <module>

    import cv2

 

Traceback (most recent call last):

   File "C:\Users\ellio\PycharmProjects\KivyHelp200\cameratest.py", line 35, in <module>

     TestCamera().run()

   File "C:\Users\ellio\kivy_venv200\lib\site-packages\kivy\app.py", line 949, in run

     self._run_prepare()

   File "C:\Users\ellio\kivy_venv200\lib\site-packages\kivy\app.py", line 919, in _run_prepare

     root = self.build()

   File "C:\Users\ellio\PycharmProjects\KivyHelp200\cameratest.py", line 32, in build

     return Builder.load_string(kv)

   File "C:\Users\ellio\kivy_venv200\lib\site-packages\kivy\lang\builder.py", line 408, in load_string

     self._apply_rule(

   File "C:\Users\ellio\kivy_venv200\lib\site-packages\kivy\lang\builder.py", line 659, in _apply_rule

     child = cls(__no_builder=True)

   File "C:\Users\ellio\kivy_venv200\lib\site-packages\kivy\uix\camera.py", line 91, in __init__

     on_index()

   File "C:\Users\ellio\kivy_venv200\lib\site-packages\kivy\uix\camera.py", line 101, in _on_index

     self._camera = CoreCamera(index=self.index, stopped=True)

TypeError: 'NoneType' object is not callable

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/c9c4cb7c-7d93-4355-b190-946c43c867cdo%40googlegroups.com.

 

Message has been deleted

Edwin Fromme

unread,
Dec 22, 2020, 7:28:20 PM12/22/20
to Kivy users support
Thanks for your feedback.

With my setup, it doesn't change anything, the error is the same with Kivy 1.11.1 and Kivy 2.0

Could you confirm that it possible to open a camera device with "camera_gi" module on Windows with Gstreamer deps ?
Does it need extra pip package ?

Shall you paste your pip list packages for Kivy 1.11.1 env ? That could helps.

Elliot Garbus

unread,
Dec 22, 2020, 7:32:49 PM12/22/20
to kivy-...@googlegroups.com

The installation for kivy 1.11.1 and kivy 2.0.0 are much different.  I’m away from that system at the moment…  check the install directions for 1.11.1 and make sure your install Gstreamer.

 

 

 

From: Edwin Fromme
Sent: Tuesday, December 22, 2020 5:28 PM
To: Kivy users support

--

You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.

edwin....@gmail.com

unread,
Dec 23, 2020, 3:38:31 AM12/23/20
to Kivy users support
No worries.
I followed those steps on a fresh new virtual env: https://kivy.org/doc/stable-1.11.0/installation/installation-windows.html
The std::out prints that ' kivy_deps.gstreamer' package is successfully loaded.

edwin....@gmail.com

unread,
Jan 11, 2021, 3:07:20 AM1/11/21
to Kivy users support
Thanks for your help ElliotG, I've seen that you raised a ticket on Kivy's git.

Just a quick update on my side, I have the issue on Linux as well, my apps with Camera object works fine in Kivy 1.11 and OpenCV, and I'm getting the following error when I'm using Kivy 2.0.
I also tried to use basic camera sample for Kivy, and I've got the same outcome.

"kivy.lang.builder.BuilderException: Parser: File "<inline>", line 6:
...
    4: id: camera
    5: index: self.index
    >> 6: resolution: (640, 480)
    7: allow_stretch: True
    8: play: True
...
"
Reply all
Reply to author
Forward
0 new messages