What's the current state of GStreamer support for Kivy?

435 views
Skip to first unread message

Brian Madden

unread,
Jun 12, 2022, 7:26:16 PM6/12/22
to Kivy users support
Hello Everyone!

I wonder if someone can give me some more information about Kivy's current (mid 2022) support for GStreamer? I have not yet been able to get Kivy to work with GStreamer (M1 macOS Monterey (12.4), using Python 3.9. I've been digging into this over the past 2 days, and so much of what I'm seeing is years old. (osxrelocator tool which seems to be needed is only Python 2.x compatible with no updates in 5 years. Is that even current or needed?) Or the macports conversations about GStreamer there are 8 years old. Etc.)

I don't mind digging in and figuring things out, but I want to make sure I'm even chasing the right path. Is GStreamer the right way to get video playback support into a Kivy app in 2022, or is there a better method? Or is video playback not really even within the scope of Kivy?

The reason I ask is because I'm working with a project which uses Kivy which I originally developed in the 2013-2016 timeframe. Now after 6 years away, I'm giving it some more love, but I can't even get Kivy to find GStreamer. (I've just tried on ARM64 Mac so far, I also need to get this working on Windows, Linux, and RPi, but one step at a time.)

So, any advice on whether GStreamer is the right way to play video in Kivy today? And if so, any hints on how to get it working on a Mac? Brew versus Ports versus native versus??

Thanks!
Brian

Elliot Garbus

unread,
Jun 12, 2022, 8:07:34 PM6/12/22
to kivy-...@googlegroups.com

I’ve not used Gstreamer on mac, looking at the install directions: https://kivy.org/doc/stable/gettingstarted/installation.html#install-pip

  • kivy_deps.gstreamer is an optional dependency which is only needed for audio/video support. We only provide it on Windows, for other platforms it must be installed independently. Alternatively, use ffpyplayer instead.

Have you installed kivy_deps.gstreamer?

https://pypi.org/project/kivy-deps.gstreamer/

 

For my python work I prefer to do native installs, rather than using brew.

I work primarily on Windows and use the mac for doing ports.

--
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/bf4fd38b-3850-423d-9367-085f1a431b05n%40googlegroups.com.

 

Brian Madden

unread,
Jun 12, 2022, 8:55:56 PM6/12/22
to Kivy users support
Hi Elliot,

Thanks for your reply! I've been through these instructions and documentation and searched and tried everything I could think of over the past 2 days, so my confusion is based on reading everything they have which is why I'm interested in what a more experienced person with Mac & Kivy would suggest.

I can install ffpyplayer and it's super easy to do via pip, and it has Universal2 wheels for Mac (just like Kivy 2.1.0), so you'd think that should make everything work. Unfortunately if I do that then try a very simple Python command, such as:

>>> import kivy.uix.video

Then I get the following. (And it stalls for several seconds). So I assume this is not the preferred / current way? Even though it's easiest to install?

[INFO   ] [Logger      ] Record log in /Users/brian/.kivy/logs/kivy_22-06-12_8.txt

[INFO   ] [Kivy        ] v2.1.0

[INFO   ] [Kivy        ] Installed at "/Users/brian/venv/kivy/lib/python3.9/site-packages/kivy/__init__.py"

[INFO   ] [Python      ] v3.9.13 (v3.9.13:6de2ca5339, May 17 2022, 11:37:23) 

[Clang 13.0.0 (clang-1300.0.29.30)]

[INFO   ] [Python      ] Interpreter at "/Users/brian/venv/kivy/bin/python"

[INFO   ] [Logger      ] Purge log fired. Processing...

[INFO   ] [Logger      ] Purge finished!

[INFO   ] [Factory     ] 189 symbols loaded

objc[24982]: Class SDLApplication is implemented in both /Users/brian/venv/kivy/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x1023b0240) and /Users/brian/venv/kivy/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x104a608e0). One of the two will be used. Which one is undefined.

objc[24982]: Class SDLAppDelegate is implemented in both /Users/brian/venv/kivy/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x1023b0290) and /Users/brian/venv/kivy/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x104a60930). One of the two will be used. Which one is undefined.

objc[24982]: Class SDLTranslatorResponder is implemented in both /Users/brian/venv/kivy/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x1023b03a8) and /Users/brian/venv/kivy/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x104a609a8). One of the two will be used. Which one is undefined.

objc[24982]: Class SDLMessageBoxPresenter is implemented in both /Users/brian/venv/kivy/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x1023b03d0) and /Users/brian/venv/kivy/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x104a609d0). One of the two will be used. Which one is undefined.

objc[24982]: Class SDL_cocoametalview is implemented in both /Users/brian/venv/kivy/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x1023b0330) and /Users/brian/venv/kivy/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x104a60a20). One of the two will be used. Which one is undefined.

objc[24982]: Class SDLOpenGLContext is implemented in both /Users/brian/venv/kivy/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x1023b02e0) and /Users/brian/venv/kivy/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x104a60a70). One of the two will be used. Which one is undefined.

objc[24982]: Class SDLWindow is implemented in both /Users/brian/venv/kivy/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x1023b0420) and /Users/brian/venv/kivy/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x104a60ac0). One of the two will be used. Which one is undefined.

objc[24982]: Class Cocoa_WindowListener is implemented in both /Users/brian/venv/kivy/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x1023b0448) and /Users/brian/venv/kivy/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x104a60ae8). One of the two will be used. Which one is undefined.

objc[24982]: Class SDLView is implemented in both /Users/brian/venv/kivy/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x1023b04c0) and /Users/brian/venv/kivy/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x104a60b60). One of the two will be used. Which one is undefined.

objc[24982]: Class METAL_RenderData is implemented in both /Users/brian/venv/kivy/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x1023b01a0) and /Users/brian/venv/kivy/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x104a60bb0). One of the two will be used. Which one is undefined.

objc[24982]: Class METAL_TextureData is implemented in both /Users/brian/venv/kivy/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x1023b01f0) and /Users/brian/venv/kivy/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x104a60c00). One of the two will be used. Which one is undefined.

[INFO   ] [ImageLoaderFFPy] Using ffpyplayer 4.3.5

[INFO   ] [Image       ] Providers: img_tex, img_imageio, img_dds, img_sdl2, img_pil, img_ffpyplayer 

[INFO   ] [VideoFFPy   ] Using ffpyplayer 4.3.5

[INFO   ] [Video       ] Provider: ffpyplayer(['video_ffmpeg'] ignored)


kivy_deps.gstreamer only contains compiled wheels for Windows, so that doesn't help me here.

So I guess that leaves me with my initial question, which is I want to know the most proper way for video support in Kivy in 2022?

Thanks!
Brian

Elliot Garbus

unread,
Jun 13, 2022, 12:24:51 AM6/13/22
to kivy-...@googlegroups.com

I’ll try a quick experiment on my mac tomorrow and see what happens.   There are a number of the kivy devs on the kivy discord channel.  They may have a clearer answer.

 

You might want to try setting the appropriate environment variable.  This needs to be set prior to importing kivy.

https://kivy.org/doc/stable/guide/environment.html?highlight=env

Elliot Garbus

unread,
Jun 13, 2022, 12:51:50 PM6/13/22
to kivy-...@googlegroups.com
Summary: I see the same wanings in the log that you see, but the code runs properly. 

Details:

I installed Kivy per the instructions into a venv.  
python -m pip install "kivy[base, media]" kivy_examples
I could see that ffpyplayer was installed.
Package            Version
------------------ -----------
certifi            2022.5.18.1
charset-normalizer 2.0.12
docutils           0.18.1
ffpyplayer         4.3.5
idna               3.3
Kivy               2.1.0
Kivy-examples      2.1.0
Kivy-Garden        0.1.5
Pillow             9.1.1
pip                22.1.2
Pygments           2.12.0
requests           2.28.0
setuptools         62.4.0
urllib3            1.26.9
wheel              0.37.1



The log shows a similar set of warnings that you saw, but the app launched with no delay,  The test app and log are below



/Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/bin/python /Users/elliotgarbus/PycharmProjects/kivyhelp210/videotest.py
[INFO   ] [Logger      ] Record log in /Users/elliotgarbus/.kivy/logs/kivy_22-06-13_0.txt
[INFO   ] [Kivy        ] v2.1.0
[INFO   ] [Kivy        ] Installed at "/Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/kivy/__init__.py"
[INFO   ] [Python      ] v3.9.13 (v3.9.13:6de2ca5339, May 17 2022, 11:37:23) 
[Clang 13.0.0 (clang-1300.0.29.30)]
[INFO   ] [Python      ] Interpreter at "/Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/bin/python"
[INFO   ] [Logger      ] Purge log fired. Processing...
[INFO   ] [Logger      ] Purge finished!
[INFO   ] [Factory     ] 189 symbols loaded
objc[1941]: Class SDLApplication is implemented in both /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x10ed462b0) and /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x112335d80). One of the two will be used. Which one is undefined.
objc[1941]: Class SDLAppDelegate is implemented in both /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x10ed46300) and /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x112335dd0). One of the two will be used. Which one is undefined.
objc[1941]: Class SDLTranslatorResponder is implemented in both /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x10ed46418) and /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x112335e48). One of the two will be used. Which one is undefined.
objc[1941]: Class SDLMessageBoxPresenter is implemented in both /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x10ed46440) and /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x112335e70). One of the two will be used. Which one is undefined.
objc[1941]: Class SDL_cocoametalview is implemented in both /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x10ed463a0) and /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x112335ec0). One of the two will be used. Which one is undefined.
objc[1941]: Class SDLOpenGLContext is implemented in both /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x10ed46350) and /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x112335f10). One of the two will be used. Which one is undefined.
objc[1941]: Class SDLWindow is implemented in both /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x10ed46490) and /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x112335f60). One of the two will be used. Which one is undefined.
objc[1941]: Class Cocoa_WindowListener is implemented in both /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x10ed464b8) and /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x112335f88). One of the two will be used. Which one is undefined.
objc[1941]: Class SDLView is implemented in both /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x10ed46530) and /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x112336000). One of the two will be used. Which one is undefined.
objc[1941]: Class METAL_RenderData is implemented in both /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x10ed46210) and /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x112336050). One of the two will be used. Which one is undefined.
objc[1941]: Class METAL_TextureData is implemented in both /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/kivy/.dylibs/SDL2 (0x10ed46260) and /Users/elliotgarbus/PycharmProjects/kivyhelp210/venv/lib/python3.9/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x1123360a0). One of the two will be used. Which one is undefined.
[INFO   ] [ImageLoaderFFPy] Using ffpyplayer 4.3.5
[INFO   ] [Image       ] Providers: img_tex, img_imageio, img_dds, img_sdl2, img_pil, img_ffpyplayer 
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL ES 2" graphics system
[INFO   ] [GL          ] Backend used <sdl2>
[INFO   ] [GL          ] OpenGL version <b'2.1 INTEL-14.7.26'>
[INFO   ] [GL          ] OpenGL vendor <b'Intel Inc.'>
[INFO   ] [GL          ] OpenGL renderer <b'Intel(R) UHD Graphics 617'>
[INFO   ] [GL          ] OpenGL parsed version: 2, 1
[INFO   ] [GL          ] Shading version <b'1.20'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <16>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [VideoFFPy   ] Using ffpyplayer 4.3.5
[INFO   ] [Video       ] Provider: ffpyplayer(['video_ffmpeg'] ignored)
[INFO   ] [Base        ] Start application main loop
[WARNING] [ffpyplayer  ] [ffpyplayer_abuffersink @ 0x7f872d72ab00] Removing channel layout 0x3, redundant with 2 channels
[INFO   ] [GL          ] NPOT texture support is available
[INFO   ] [Base        ] Leaving application in progress...

Process finished with exit code 0

  
Test code:
from kivy.lang import Builder
from kivy.app import App

KV = '''
Screen:
Video:
source: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4' #'Video1.mp4'
state: 'play'
allow_fullscreen: False
'''


class TestVideoPlayer(App):
def build(self):
return Builder.load_string(KV)


TestVideoPlayer().run()







Elliot Garbus

unread,
Jun 13, 2022, 1:32:54 PM6/13/22
to kivy-...@googlegroups.com

Brian Madden

unread,
Jun 13, 2022, 2:41:25 PM6/13/22
to Kivy users support
Hi Elliot,

This is all a huge help, I appreciate it, thanks!

Do you have an ARM or x86 Mac? Also, did you install GStreamer or any of the SDL2 frameworks ahead of time, and if so, how did you install them? (Native installers, brew, ports, manually?)

Good to know about the known issue of those duplicated classes. At least that's something I can ignore now.

Again, thanks!
Brian

Elliot Garbus

unread,
Jun 13, 2022, 5:26:01 PM6/13/22
to kivy-...@googlegroups.com

I have an Intel x86 based Mac.  I did NOT separately install Gstreamer, or any SDL Framework.  I created a venv, and pip installed kivy as described earlier.  I installed python manually from the python web site.

Reply all
Reply to author
Forward
0 new messages