luisbocanegra / plasma-smart-video-wallpaper-reborn

Plasma 6 wallpaper plugin to play videos on your Desktop/Lock Screen.
https://store.kde.org/p/2139746
GNU General Public License v2.0
70 stars 1 forks source link

Black screen with gstreamer as Qt Media backend (Recent KDE Neon update) #8

Open linlinxza opened 6 months ago

linlinxza commented 6 months ago

This is what I get according to journalctl -f:

Failed to initialize QMediaPlayer "Could not find the videoconvertscale GStreamer element"

Yes, I have gstreamer1.0-libav installed.

luisbocanegra commented 6 months ago

According to a search in Ubuntu's package files database the package that provides libgstvideoconvertscale.so is gstreamer1.0-plugins-base please check that you have it installed. Install it if you don't, then reboot and try again.

If you do but still isn't working please send the output of apt policy gstreamer1.0-plugins-base.

According to that database, versions of ubuntu older than lunar (23.04) don't include that library and you may be in one of those versions or maybe the library moved to another package, to check if your package provides the library run apt-file list gstreamer1.0-plugins-base should return the files of the package and it must contain libgstvideoconvertscale.so

linlinxza commented 6 months ago

According to sudo apt-file list gstreamer1.0-plugins-base, this is what I get:

gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstadder.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstapp.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstaudioconvert.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstaudiomixer.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstaudiorate.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstaudioresample.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstaudiotestsrc.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstcdparanoia.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstcompositor.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstencoding.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstgio.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstlibvisual.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstogg.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstopus.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstoverlaycomposition.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstpbtypes.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstplayback.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstrawparse.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstsubparse.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgsttcp.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgsttheora.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgsttypefindfunctions.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvideoconvert.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvideorate.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvideoscale.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvideotestsrc.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvolume.so
gstreamer1.0-plugins-base: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvorbis.so
gstreamer1.0-plugins-base: /usr/share/doc/gstreamer1.0-plugins-base/changelog.Debian.gz
gstreamer1.0-plugins-base: /usr/share/doc/gstreamer1.0-plugins-base/copyright

Guess I am shit out of luck given that KDE Neon is still using 22.04 as the Ubuntu base.

Unless you have an older version I could use until the 24.04 upgrade is available?

luisbocanegra commented 6 months ago

Hmm I don't think using an older package is a good idea. You would need to downgrade qt6-multimedia but I am sure other packages that require the latest version will break. What you could try instead is manually building and installing gstreamer1.0-plugins-base but is an advanced task.

Maybe you can open an issue in KDE's bug tracker requesting an updated package as it is breaking qt-multimedia functionality.

luisbocanegra commented 6 months ago

What happens if you run the test.qml as per instructions here?

linlinxza commented 6 months ago

No. I am talking about you having an older version of your plugin. Because that worked. Before I updated my system today.

Anyway, I ran this: QSG_INFO=1 QT_LOGGING_RULES="qml.debug=true" qml test.qml

Changed the qml6 to a qml because it wouldn't work otherwise.

This is what I got:

qt.scenegraph.general: threaded render loop
qt.scenegraph.general: Using sg animation driver
qt.scenegraph.general: Animation Driver: using vsync: 13.35 ms
Failed to initialize QMediaPlayer "Could not find the videoconvertscale GStreamer element"
qt.scenegraph.general: Using sg animation driver
qt.scenegraph.general: Animation Driver: using vsync: 13.35 ms
qt.scenegraph.general: Creating QRhi with backend OpenGL for window 0x5c583af61de0 (wflags 0x1)
  Graphics API debug/validation layers: 0
  Debug markers: 0
  Timestamps: 0
  Prefer software device: 0
  Shader/pipeline cache collection: 0
qt.rhi.general: Created OpenGL context QSurfaceFormat(version 4.6, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::DefaultSwapBehavior, swapInterval 1, colorSpace QColorSpace(), profile  QSurfaceFormat::CompatibilityProfile)
qt.rhi.general: OpenGL VENDOR: AMD RENDERER: AMD Radeon RX 580 Series (polaris10, LLVM 15.0.7, DRM 3.54, 6.5.0-26-generic) VERSION: 4.6 (Compatibility Profile) Mesa 23.2.1-1ubuntu3.1~22.04.2
qt.scenegraph.general: Created QRhi 0x7d27ec00d8a0 for window 0x5c583af61de0
qt.scenegraph.general: MSAA sample count for the swapchain is 1. Alpha channel requested = no.
qt.scenegraph.general: rhi texture atlas dimensions: 2048x2048
qml: playing next video
qml: playing next video
qml: playing next video
qml: playing next video
qml: playing next video
qml: PAUSING ABOUT TO QUIT
qml: PAUSING ON DESTRUCTION
qt.scenegraph.general: Total time spent on pipeline creation during the lifetime of the QRhi 0x7d27ec00d8a0 was 7 ms
luisbocanegra commented 6 months ago

Unfortunately I am not sure its possible to get around that error aside from trying to switch back to ffmeg to see if the situation has improved with it.

luisbocanegra commented 6 months ago

The test.qml shows a black video too right? I am going to make the bug report if that's true.

linlinxza commented 6 months ago

The test.qml shows a black video too right? I am going to make the bug report if that's true.

Yeah. No video.

linlinxza commented 6 months ago

Unfortunately I am not sure its possible to get around that error aside from trying to switch back to ffmeg to see if the situation has improved with it.

I tried ffmpeg. Still a crashing. And it was just working with gstreamer fine before I updated KDE Neon. Pain in the ass.

luisbocanegra commented 6 months ago

Yeah, searching for package related errors there are many examples of this kind of problem where a dependency is not up-to date which I think is unfortunate and I'd rather would have preferred KDE people recommended Fedora instead of what seems to be a KDE demo distro mostly intended for developers?

linlinxza commented 6 months ago

Yeah, searching for package related errors there are many examples of this kind of problem where a dependency is not up-to date which I think is unfortunate and I'd rather would have preferred KDE people recommended Fedora instead of what seems to be a KDE demo distro mostly intended for developers?

Meanwhile, I have been using this 'demo distro' for about 8 years as my daily driver for myself and the entire household now. Like, there is a user edition of KDE Neon. But with how crap Ubuntu has become due to Canonical, I may consider the Fedora KDE spin at some point. lol

Anyway, if there was no more issue with ffmpeg as the backend that made plasmashell crash, then I wouldn't need gstreamer.

luisbocanegra commented 6 months ago

I really need to get my hands on a AMD system to investigate these ffmpeg crashes, I am not even sure if that has been reported yet.

For the packaging problem maybe this but for gstreamer1.0-plugins-base could work?

linlinxza commented 6 months ago

I really need to get my hands on a AMD system to investigate these ffmpeg crashes, I am not even sure if that has been reported yet.

For the packaging problem maybe this but for gstreamer1.0-plugins-base could work?

Nah. I think I am done for tonight. Can live without it for now. Besides, I don't feel like screwing with my system. It's stable, and that's what's important right now. Since Plasma 6 came out, I had a few dependency issues. Much rather not mess with something that works; especially late in the evening.

And yeah, please get an AMD system. A lot of people who want better GPU drivers turn to AMD because of the better out of box experience that it is on Linux. Compared to Nvidia's nonsense (where they give the second class provider treatment to Linux users). It's precisely why I no longer use anything Nvidia.

All I have left is an old 750 Ti that I use for GPU pass through for a Spydows virtual machine that I keep completely offline and isolated like the malware that it is (which I don't even use anymore; it's just there).

luisbocanegra commented 6 months ago

Nah. I think I am done for tonight. Can live without it for now. Besides, I don't feel like screwing with my system. It's stable, and that's what's important right now. Since Plasma 6 came out, I had a few dependency issues. Much rather not mess with something that works; especially late in the evening.

Good call, I wouldn't mess with it either. I do for Arch but only because here is pretty easier for me to undo everything.

All I have left is an old 750 Ti that I use for GPU pass through for a Spydows virtual machine that I keep completely offline and isolated like the malware that it is (which I don't even use anymore; it's just there).

You just described how I have my GTX 1650 (laptop) lol. I still use it for windows sometimes and for testing things on other distributions but normally is just disabled like it doesn't exist.

linlinxza commented 6 months ago

I thought about Arch based systems. But I don't think I'd want something that temperamental as a daily driver. I don't need bleeding edge either. Just need something that works.

BTW, the more people stop using the Windows and switch to Linux, the better it will be. I think Valve is helping much with that one. Not to mention MS's hostility which is making more people not want to use their platform anymore.

luisbocanegra commented 6 months ago

Hi again. I found the Qt issue for broken gstreamer video playback https://bugreports.qt.io/browse/QTBUG-123312 the solution is to wait for an update of either gstreamer or qt-multimedia to land in Neon

linlinxza commented 6 months ago

Yup. Okay. Just try getting an AMD system so that you can test the plugin on that. Because I'm sure many other AMD users would just prefer to go with the default backend; which is ffmpeg.

luisbocanegra commented 6 months ago

Can you please switch back to ffmpeg and run the test.qml file again? If that one crashes I can skip KDE and report this problem to Qt/AMD

linlinxza commented 6 months ago

Yeah. I switched to ffmpeg last night to see if the plugin would work. Anyway, I tried the test file. This is what I got after running it. It just played one of the videos before crashing.

[AVHWFramesContext @ 0x71cc40004ec0] Failed to sync surface 0x19: 13 (the requested VAEntryPoint is not supported).
Error transferring the data to system memory: -5
Cannot map a video frame in ReadOnly mode!
Cannot represent the plane 0 as an image
Cannot represent the plane 1 as an image
malloc(): mismatching next->prev_size (unsorted)
Aborted (core dumped)
luisbocanegra commented 6 months ago

Can you please try to get a backtrace? https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports

$ gdb qml6

Reading symbols from qml6...
Enable debuginfod for this session? (y or [n]) y
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.          
(gdb) run /home/luis/projects/plasma-smart-video-wallpaper/playground/000videoTest.qml

Wait for debug symbols to finish downloading if needed. Wait for the video window to show. This process may take a while.

When the crash occurs you'll see something like this:

Thread 1 "qml6" received signal SIGSEGV, Segmentation fault.
0x00007ffff6b54b0a in QRhi::makeThreadLocalNativeContextCurrent (this=<optimized out>)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.3/src/gui/rhi/qrhi.cpp:9624
9624        return d->makeThreadLocalNativeContextCurrent();
(gdb) set logging file ~/backtrace.txt
(gdb) set logging enabled on
Copying output to /home/luis/backtrace.txt.
Copying debug output to /home/luis/backtrace.txt.
(gdb) thread apply all bt full
...
--Type <RET> for more, q to quit, c to continue without paging--
c
set logging enabled off
Done logging to /home/luis/backtrace.txt.
(gdb) quit

Finally share the contents of backtrace.txt recording of the process in case you need it

linlinxza commented 6 months ago

Well, here is the backtrace.

Keep in mind that if I attempt to run gdb qml6 I get this: qml6: No such file or directory.

So, I had to run this gdb qml to get it to work.

Backtrace attached:

backtrace.txt

luisbocanegra commented 6 months ago

Thank you. Can you also send the updated kinfo. Oh and try setting this environment variable QT_DISABLE_HW_TEXTURES_CONVERSION=1 it supposedly helped fix a crash on windows maybe it helps here too.

Edit: Here is the bug report where I found that env var https://bugreports.qt.io/browse/QTBUG-113832?jql=text%20~%20%22ffmpeg%20amd%22

linlinxza commented 6 months ago

Here is the result of kinfo:

Operating System: KDE neon 6.0
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.3
Kernel Version: 6.5.0-26-generic (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 5600G with Radeon Graphics
Memory: 31.1 GiB of RAM
Graphics Processor: AMD Radeon RX 580 Series

QT_DISABLE_HW_TEXTURES_CONVERSION=1 it supposedly helped fix a crash on windows maybe it helps here too.

But... that's for Windows? How does this relate?

luisbocanegra commented 6 months ago

It was added to windows but is also in ffmpeg if I understood correctly

linlinxza commented 6 months ago

Where would I add that environment variable?

luisbocanegra commented 6 months ago

In the same file where the qt media back end one ~/.config/plasma-workspace/env/qt-media-backend.sh is okay

linlinxza commented 6 months ago

So, just QT_DISABLE_HW_TEXTURES_CONVERSION=1 variable in the ~/.config/plasma-workspace/env/qt-media-backend.sh file and that's it? Nothing else?

luisbocanegra commented 6 months ago

Yeah

luisbocanegra commented 6 months ago

Just verify it shows up in echo $QT_DISABLE_HW_TEXTURES_CONVERSION=1

linlinxza commented 6 months ago

Well, when I paste this in the terminal echo $QT_DISABLE_HW_TEXTURES_CONVERSION=1, it gives me this:

=1

luisbocanegra commented 6 months ago

Is there any improvement on the crashes?

linlinxza commented 6 months ago

Never mind. It works now. Seems like that was the issue. But, right when it goes to loop, the background goes green for a second. Then it plays through fine again.

EDIT:

I was wrong. It seems to still crash plasmashell. But I think it's more irregular now.

luisbocanegra commented 6 months ago

Well, when I paste this in the terminal echo $QT_DISABLE_HW_TEXTURES_CONVERSION=1, it gives me this:

=1

without '=' right?

linlinxza commented 6 months ago

Nope. Give me that: =1

Guess that was a mistake. How do you put it in the file?

Just by adding this? QT_DISABLE_HW_TEXTURES_CONVERSION=1

luisbocanegra commented 6 months ago

This is what ~/.config/plasma-workspace/env/qt-media-backend.sh should have

#!/bin/bash
export QT_DISABLE_HW_TEXTURES_CONVERSION=1
linlinxza commented 6 months ago

Thanks. I forget the basics of scripting on Linux because I don't use it often.

Anyway, I set up the script properly. And it returns 1 when I paste in the command echo $QT_DISABLE_HW_TEXTURES_CONVERSION

After the first loop of the video clip, the background goes green for a second and then loops a second time. After the second loop, the background goes green again and then plasmashell finally crashes.

As someone who doesn't do any software dev, I think this is as much as I can contribute. As you said, you need to get your hands on an AMD system. Or, at least an AMD GPU that you could plug into a desktop even. And it doesn't have to be fancy either. I'm sure there are many used AMD systems you could get for cheap from an electronics recycling place. And I think Spyware 11's insane hardware requirements will help with that immensely.

luisbocanegra commented 6 months ago

After the first loop of the video clip, the background goes green for a second and then loops a second time. After the second loop, the background goes green again and then plasmashell finally crashes.

Well, at least seemed to do something

As someone who doesn't do any software dev, I think this is as much as I can contribute. As you said, you need to get your hands on an AMD system. Or, at least an AMD GPU that you could plug into a desktop even. And it doesn't have to be fancy either. I'm sure there are many used AMD systems you could get for cheap from an electronics recycling place. And I think Spyware 11's insane hardware requirements will help with that immensely.

Yeah I will try to get advice from KDE developers, then make the bug report and borrow a machine to test possible patches from Qt devs if needed. Thanks for all your time!

linlinxza commented 6 months ago

Good luck. As an AMD user, I hope to have video wallpapers again!

linlinxza commented 5 months ago

Has there been any developments for AMD users yet?

luisbocanegra commented 5 months ago

Sorry, I didn't have the time to make the bug report, so now the info it's out of date, also made some changes to the test.qml and added testMediaPlayer.qml can you check if that one crashes too?

With your system updated, please send kinfo, output of test.qml output (same command except qml executable should be /usr/lib/qt6/bin/qml) and the backtrace.

I have a qt account now and will create the bug as soon as I get these updated details.

linlinxza commented 5 months ago

kinfo (with up to date system):


Operating System: KDE neon 6.0
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0
Kernel Version: 6.5.0-28-generic (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 5600G with Radeon Graphics
Memory: 31.1 GiB of RAM
Graphics Processor: AMD Radeon RX 580 Series

test.qml backtrace: backtrace.txt

Also, where is that testMediaPlayer.qml file?

luisbocanegra commented 5 months ago

here please run it with QSG_INFO=1 QT_LOGGING_RULES="*.debug=true" and share the output

linlinxza commented 5 months ago

Done by running it as QSG_INFO=1 QT_LOGGING_RULES="*.debug=true" /usr/lib/qt6/bin/qml test.qml

Output: backtrace2.txt

I just saved the output of Konsole. Don't know it I got all of it.

luisbocanegra commented 5 months ago

Yeah, is not all of it, please pipe it to a file

luisbocanegra commented 5 months ago

Here's the bug report https://bugreports.qt.io/browse/QTBUG-124586

linlinxza commented 5 months ago

Here's the output.txt after running this: QSG_INFO=1 QT_LOGGING_RULES="*.debug=true" /usr/lib/qt6/bin/qml test.qml 2> output.txt

luisbocanegra commented 5 months ago

Thanks, additional information has been requested:

Liang Qi added a comment

Could you help to provide the output of lspci -k | grep -EA3 'VGA|3D|Display'? Thanks.

linlinxza commented 5 months ago
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] (rev e7)
        Subsystem: ASRock Incorporation Phantom Gaming X RX 580 OC
        Kernel driver in use: amdgpu
        Kernel modules: amdgpu
--
04:00.0 VGA compatible controller: NVIDIA Corporation GM107 [GeForce GTX 750 Ti] (rev a2)
        Subsystem: ZOTAC International (MCO) Ltd. GM107 [GeForce GTX 750 Ti]
        Kernel modules: nvidiafb, nouveau
04:00.1 Audio device: NVIDIA Corporation GM107 High Definition Audio Controller [GeForce 940MX] (rev a1)

Ignore the Nvidia one. That's just used for GPU passthrough.

luisbocanegra commented 5 months ago

Hi someone tried reproducing this bug but were unable to

Lars Sutterud added a comment - 10 hours ago I tried to reproduce this with an AMD RX 550 gpu on Ubuntu 22.04, but here the attached .qml file plays the video fine on both Wayland and Xorg. My lspci output:

Can you try reproducing this bug in Arch (pretty easy to install nowadays with archinstall)? You will have to install it in real hardware or pass the AMD to Arch VM and install there to confirm you can still reproduce (and if you test neon vm too that will be helpful)

If it also crashes there, it was suggested to build qt from source with address sanitizer enabled so you will have to do that (if you want to do it ofc), I could write a guide to do that on Arch after I figure out how to do it myself 😆

larsut commented 5 months ago

Hi linlinxza and luisbocanegra, I'm working on the QTBUG ticket Luis created for this issue. Thanks for you efforts so far. Linlinxza, It would be great if you could post the outputs from running a few command:

How did you install Qt and Qt Multimedia? If it wasn't with Qt maintenance tool / Online Installer, could you locate the Qt build containing this folder structure, plugins/multimedia/, navigate to that 'multimedia' folder in your terminal and run this command: ldd libffmpegmediaplugin.so | grep libavformat

And this command, which should show the path to your VAAPI library: dpkg -L libva2 libva-wayland2 libva-x11-2 libva-dev

And this, which should return your VAAPI version: (but must probably first be installed with 'sudo apt install vainfo') vainfo

And if it's not to much too ask, can you run Luis's qml test file again and pipe the output to a file, but this time add the following environment variable to activate ffmpeg debugging: QT_FFMPEG_DEBUG=1

That last task only makes sense if you can make it crash while running it. :)