hydrus icon indicating copy to clipboard operation
hydrus copied to clipboard

Implement mpv render API to improve mpv on Qt5/KDE and Wayland

Open hjri opened this issue 3 years ago • 2 comments

Hydrus version

v504

Qt major version

Qt 5

Operating system

Linux (specify distro and version in comments)

Install method

Running from source

Install and OS comments

Running without a venv, have most stuff needed installed as system packages.

OS - Debian Testing with KDE 5

Bug description and reproduction

When using Qt5 (doesn't matter if it's PySide2 or PyQt5) mpv player doesn't appear most of the time. It appears most of the time THE first time you open up a video file, but opening other files and even going back renders black frame. Audio still plays however. Switching to PyQt6 fixes the problem, however.

Also, when using Wayland mpv does appear in a separate window, but that's partially an mpv problem, same happens in SMPlayer, supposedly because mpv's window gets embedded into other application and that's just not supported on wayland. Folks at #mpv irc channel told me there is a way to do it properly with libmpv.

Log output

no relevant log sections, no errors happen

hjri avatar Nov 03 '22 23:11 hjri

Thank you for this report. I'm sorry for the trouble. I remember another user telling me that mpv was going weird on wayland because of that embedding issue. My current mpv solution is really held together by duct tape, and changing too much leads to insta-crashes on all systems, and macOS itself cannot show the current solution without crashing/going 100% CPU, so an alternate (preferably more stable) solution is really needed. Thankfully, some users were telling me about a different 'render api' of some sort that mpv supports. I have not played with this tech yet, but when I do get to it, I will be adding an 'EXPERIMENTAL' option so users with more unusual situations can test it out as an alternative. Please try that out when I eventually roll this tech out and let me know how it goes.

Since you are already running from source, I cannot give my stock advice to try doing that to improve compatibility. I am not sure why Qt5 is failing you here while Qt6 is ok, but since that does work for you, my best advice is to keep using that. I feel like I have heard this 'works ok first time, then black after' problem before. Essentially, to improve stability, I don't make and destroy my mpv windows over and over, but I re-cycle them, and when they aren't in use, they are waiting in the background. I presume your Qt5 + KDE 5 somehow can't reinitialise the mpv window after it has been hidden. Maybe that bug was fixed for your window manager in Qt6.

As a side thing, this week in v505 I will be launching easy setup scripts (and revised 'running from source' help) for all platforms. There will be a nice and simple setup_venv.sh file in the main install dir that will set up your venv for you. It doesn't offer PyQt5/6 yet, just PySide2/6, but you might like to play with it.

Since this is technically fixable by using Qt6, and I do not feel confident that I can fix the Qt5 issue without plugging into this new render api, I'm going to rename and switch this to a feature-request.

hydrusnetwork avatar Nov 08 '22 04:11 hydrusnetwork

Here's the link to the relevant issue r.e. Wayland:

https://github.com/jaseg/python-mpv/issues/222#issuecomment-1179721210

So when I have some time, I'll see if I can implement this idea and we'll see if it works better for other window managers.

hydrusnetwork avatar Nov 08 '22 04:11 hydrusnetwork