kivy: ffpyplayer video freezes app if ffpyplayer fails to initialize SDL audio
Versions
- Python: 3.7.3
- OS: Raspbian Buster Lite (Linux octopi 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l GNU/Linux)
- Kivy: 1.10.1 and 1.11.1
- Kivy installation method: Install OctoPi image, recreate virtual environment as Python 3, install Kivy per the documentation into this virtual environment, install ffpyplayer via pip install.
Description
I could have sworn that I tested this earlier and that it was working as expected. Today, though, I’m seeing that attempting to bring up a Kivy Video using the ffpyplayer provider on this platform is silently crashing the app. It goes unresponsive, probably blocks the main Python thread in doing so. The only thing I see in the log is:
Code and Logs
2019-12-09 11:02:56,523 - kivy - ERROR - Image: Error reading file http://localhost:8080/?action=stream
This link of course is the output from the mjpg_streamer service.
Raspberry Pi 4B (4GB) Raspbian Buster Lite OctoPi 0.17.0 IMG with OctoPrint 1.3.12 ffpyplayer 4.3.1.dev0 Kivy 1.10.1 (also 1.11.1) Python 2.7 (also 3.7.3) nodm 0.13 with xserver-xorg installed mjpg_streamer git rev 501f6362c5afddcfb41055f97ae484252c85c912 Pi NoIR webcam v2 provided by Adafruit
All this was an issue before at the ffpyplayer repository but it was closed there and suggested that it be reopened over here. There’s more information on that issue.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 17 (9 by maintainers)
Commits related to this issue
- Disable audio workaround for kivy freeze https://github.com/kivy/kivy/issues/6744 — committed to oneclickmetal/ffpyplayer by matthiasharrer 3 years ago
The error happens here https://github.com/matham/ffpyplayer/blob/master/ffpyplayer/player/player.pyx#L435
For some reason the app is not able to initialize SDL audio. Without calling initialize_sdl_aud() the video plays flawlessly.
What i can tell so far is that it works on systems where pulseaudio is running and fails on systems where only alsa is available. Thats a somewhat wild guess though, but actually the most obvious difference between my systems where it works vs. where it not works
As quickfix you can add
'an': True
to the settings dict here https://github.com/kivy/kivy/blob/master/kivy/core/video/video_ffpyplayer.py#L340 , which simply disables audio output.Anyway. We need to figure out:
@matham any hint how i can figure out what’s wrong with the audio installation? Or any way to get the failure more verbose?