I am building my first app with kivy but cannot make the VideoPlayer work.
There is a error-message stating: Provider: ffpyplayer(['video_ffmpeg'] ignored) which seems to be the problem.
I have already installed ffpyplayer (aswell as Pillow) using pip install.
When I type:
import kivy
print(kivy.kivy_options['VIDEO'])
It says: ('gstplayer', 'ffmpeg', 'ffpyplayer', 'null')
However, here is a minimal example:
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.videoplayer import VideoPlayer
class VideoPlayerWindow(Widget):
def __init__(self, **kwargs):
super(VideoPlayerWindow, self).__init__(**kwargs)
self.player = VideoPlayer(
source=r"D:\kivy-thelab\resources\commercial_free\videos\pilates1.mp4",
state='play',
)
class MainApp(App):
def build(self):
return VideoPlayerWindow()
if __name__ == "__main__":
MainApp().run()
And the full debugging output:
[INFO ] [Logger ] Record log in C:\Users\Home\.kivy\logs\kivy_23-05-08_10.txt
[INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.3.3
[INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.3.1
[INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.4.5
[INFO ] [Kivy ] v2.1.0
[INFO ] [Kivy ] Installed at "C:\Users\Home\miniconda3\envs\kivy_env\lib\site-packages\kivy\__init__.py"
[INFO ] [Python ] v3.9.0 | packaged by conda-forge | (default, Nov 26 2020, 07:53:15) [MSC v.1916 64 bit (AMD64)]
[INFO ] [Python ] Interpreter at "C:\Users\Home\miniconda3\envs\kivy_env\python.exe"
[INFO ] [Logger ] Purge log fired. Processing...
[INFO ] [Logger ] Purge finished!
[INFO ] [Factory ] 189 symbols loaded
[INFO ] [ImageLoaderFFPy] Using ffpyplayer 4.5.0
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_ffpyplayer
[INFO ] [Text ] Provider: sdl2
[INFO ] [VideoFFPy ] Using ffpyplayer 4.5.0
[INFO ] [Video ] Provider: ffpyplayer(['video_ffmpeg'] ignored)
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] GLEW initialization succeeded
[INFO ] [GL ] Backend used <glew>
[INFO ] [GL ] OpenGL version <b'4.6.0 - Build 27.20.100.8682'>
[INFO ] [GL ] OpenGL vendor <b'Intel'>
[INFO ] [GL ] OpenGL renderer <b'Intel(R) HD Graphics 620'>
[INFO ] [GL ] OpenGL parsed version: 4, 6
[INFO ] [GL ] Shading version <b'4.60 - Build 27.20.100.8682'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [Base ] Start application main loop
[ERROR ] [Image ] Error loading <D:\kivy-thelab\resources\commercial_free\videos\pilates1.mp4>
[INFO ] [GL ] NPOT texture support is available
What am I doing wrong?
You code is creating a VideoPlayer
, but is not using it. Try modifying your VideoPlayerWindow
like this:
class VideoPlayerWindow(FloatLayout):
def __init__(self, **kwargs):
super(VideoPlayerWindow, self).__init__(**kwargs)
self.player = VideoPlayer(
source=r"D:\kivy-thelab\resources\commercial_free\videos\pilates1.mp4",
state='play',
)
# add the VideoPlayer
self.add_widget(self.player)
Test if the above works.