Bug 477091

Summary: Qt Multimedia backend cannot show embedded images
Product: [Applications] Elisa Reporter: Jack Hill <jackhill3103>
Component: generalAssignee: Matthieu Gallien <matthieu_gallien>
Status: RESOLVED UPSTREAM    
Severity: major CC: nate
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Jack Hill 2023-11-16 12:04:28 UTC
SUMMARY
Git master. I only just realised I've been building Elisa with LibVLC so didn't notice this sooner.

STEPS TO REPRODUCE
1. Build Elisa with Qt Multimedia
2. Add tracks to the queue
3. Start playing a track

OBSERVED RESULT
When I add a track to the queue the image (in header bar, and in playlist sidebar) displays as normal.
When I start playing the track the image  (in header bar, and in playlist sidebar) turns to an error icon and I get this message in the console.
The images in the grid/list view are fine

[mjpeg_cuvid @ 0x36a1c80] Codec mjpeg_cuvid is not supported.
qrc:/qml/ImageWithFallback.qml:39:5: QML QQuickImage: Failed to get image from provider: image://icon/error

EXPECTED RESULT
Cover image displays properly

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20231108
KDE Plasma Version: 5.27.9
KDE Frameworks Version: 5.111.0
Qt Version: 5.15.11
Kernel Version: 6.5.9-1-default (64-bit)
Graphics Platform: X11
Processors: 4 × Intel® Core™ i5-5200U CPU @ 2.20GHz
Memory: 7.7 GiB of RAM
Graphics Processor: NVIDIA GeForce 840M/PCIe/SSE2
Manufacturer: Dell Inc.
Product Name: Inspiron 5749
System Version: A09

ADDITIONAL INFORMATION
Comment 1 Jack Hill 2023-11-16 15:51:53 UTC
Also this has the effect of making the track appear unplayable in the playlist. I can play/pause/seek from the main controls, but the track in the playlist sidebar becomes unavailable
Comment 2 Nate Graham 2023-11-16 21:34:28 UTC
Can confirm.
Comment 3 Jack Hill 2023-11-16 23:26:30 UTC
I'm not very knowledgable about ffmpeg, but if I run `ffmpeg -hwaccels` I get 
```
Hardware acceleration methods:
vdpau
cuda
vaapi
qsv
drm
vulkan
```

so clearly cuvid is not supported by my hardware. If I then try to run `ffmpeg -hwaccel cuvid -i track.mp3 "cover.jpg"` I get the two lines:
```
[mjpeg @ 0x55665d6f00c0] Hardware is lacking required capabilities
[mjpeg @ 0x55665d6f00c0] Failed setup for format cuda: hwaccel initialisation returned error.
```

ffmpeg still extracts the cover image successfully though. So maybe Qt is somehow forcing ffmpeg to use cuvid and not letting it fall back to software? I'll look into making a minimally reproducible example tomorrow.

But regardless we should see if we can make Elisa still handle the track if the embedded image extractor doesn't work.
Comment 4 Jack Hill 2023-12-03 18:10:19 UTC
Here is the upstream bug report: https://bugreports.qt.io/browse/QTBUG-119361

Looks like this will probably be fixed in Qt 6.6.2 which'll be released on 17.01.2024, so before 24.02. I can't confirm the fix since I building Qt from source will probably take a very long time on my PC.