Video in Kivy lags in the beginning

Viewed 17

I wanted to play an intro video whenever my kivy-app starts, so i added a video widget in the build-method of the app. It kind of works as intended and plays the video in the beginning; the issue is that the video lags when it starts to play (meaning that the visual part starts before the audio, then it pauses for a short time and then it runs the rest of the video completely fine). I tried a lot but couldnt figure out a solution. Here is my code:

    from kivy.app import App
    from kivy.uix.floatlayout import FloatLayout
    from kivy.uix.video import Video


    class TestApp(App):
        def build(self):
            layout = FloatLayout()
            intro = Video(source="my_video.mp4", state="play")
            layout.add_widget(intro)
            return layout


    if __name__ == "__main__":
        TestApp().run()

I installed ffpyplayer to make the video run in the first place. I placed the video in the directory.

Interesting is by the way the last part of the log. There is one warning and one error displayed but i dont know what they are trying to tell me and my research had no helpful results:

    [INFO   ] [Logger      ] Record log in C:\Users\Umpalumpa\.kivy\logs\kivy_22-09-20_24.txt
    [INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.3.2
    [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\Umpalumpa\PycharmProjects\testing\venv\lib\site-packages\kivy\__init__.py"
    [INFO   ] [Python      ] v3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)]
    [INFO   ] [Python      ] Interpreter at "C:\Users\Umpalumpa\PycharmProjects\testing\venv\Scripts\python.exe"
    [INFO   ] [Logger      ] Purge log fired. Processing...
    [INFO   ] [Logger      ] Purge finished!
    [INFO   ] [Factory     ] 189 symbols loaded
    [INFO   ] [ImageLoaderFFPy] Using ffpyplayer 4.3.5
    [INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_ffpyplayer 
    [INFO   ] [VideoFFPy   ] Using ffpyplayer 4.3.5
    [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.5.0 - Build 25.20.100.6518'>
    [INFO   ] [GL          ] OpenGL vendor <b'Intel'>
    [INFO   ] [GL          ] OpenGL renderer <b'Intel(R) HD Graphics 520'>
    [INFO   ] [GL          ] OpenGL parsed version: 4, 5
    [INFO   ] [GL          ] Shading version <b'4.50 - Build 25.20.100.6518'>
    [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
    [ERROR  ] [Image       ] Error loading <my_video.mp4>
    [INFO   ] [Base        ] Start application main loop
    [WARNING] [ffpyplayer  ] [ffpyplayer_abuffersink @ 000002bc20a7be40] Removing channel layout 0x3, redundant with 2 channels
    [INFO   ] [GL          ] NPOT texture support is available

i tried to install pillow and pygame as well (I have no idea why i did that. It was more an act of despair. Spoiler alert: It didnt help).

I am still new to kivy so it could be that i am just not seeing a simple solution. Thanks for any help in advance.

0 Answers
Related