flathub / io.mpv.Mpv

https://flathub.org/apps/details/io.mpv.Mpv
8 stars 19 forks source link

Unsupported hwdec: vulkan #466

Closed keftie22 closed 1 month ago

keftie22 commented 1 month ago

I get this error and vulkan video decode does not work. Tested with an Nvidia RTX 4060 vulkan video decode works using the mpv package from the Fedora 40 repos, but does not work with the flatpak.

image

fastrizwaan commented 1 month ago

Looks like driver issue. do you have flatpak's nvidia drivers installed? check

$ flatpak list|grep -i nvidia
nvidia-550-78   org.freedesktop.Platform.GL.nvidia-550-78       1.4 flathub system
nvidia-550-78   org.freedesktop.Platform.GL32.nvidia-550-78     1.4 flathub system

test it with

flatpak run io.mpv.Mpv --gpu-api=vulkan VIDEO.mp4

change VIDEO.mp4 with your video.

keftie22 commented 1 month ago

Yes, I have the drivers or else most of my other flatpaks wouldn't even boot. This is also a problem I have on Intel and AMD machines as well, not just Nvidia. My primary machine that I'm typing this message now from is using Intel integrated graphics and gives me the same message. I'm already using the vulkan api for mpv through my mpv.conf file. I can show you my entire config below (I know it's not the best organized):

#video settings
profile=high-quality
vo=gpu-next
gpu-api=vulkan
hwdec=vulkan,auto
#target-colorspace-hint=yes
gpu-context=waylandvk
saturation=15
cursor-autohide=100

#interpolation
#video-sync=display-resample
#interpolation=yes
#interpolation-preserve=no

#dithering
#depth of auto if not 10 bit screen
#dither-depth=auto
#dither=ordered

#deband
#deband=yes
deband-iterations=6
deband-threshold=64
deband-range=32
deband-grain=0

#language and subs
alang=ja,jp,jpn,en,eng
slang=en,eng,jp,jpn
sub-visibility=yes
sub-auto=fuzzy
audio-file-auto=fuzzy
sub-font-size=50
demuxer-mkv-subtitle-preroll=yes
blend-subtitles=yes
sub-gauss=1.0

#screenshots 
screenshot-format=png
screenshot-high-bit-depth=yes
screenshot-png-compression=9
screenshot-directory='~/Pictures/mpv/'
screenshot-template="%f-%wH.%wM.%wS.%wT-#%#00n"

#general
save-position-on-quit=yes
autofit-larger=35%
geometry=35%:35%
keep-open=yes
audio-channels=stereo
wayland-configure-bounds=yes

#Some settings overwriting the default Arial for .srt subtitles (or .ass if you force it)
sub-font=Cabin
sub-font-size=52
sub-blur=0.1
sub-color=1.0/1.0/1.0/1.0
sub-border-color=0.0/0.0/0.0/1.0
sub-border-size=3.4
sub-margin-x=100
sub-margin-y=50
sub-shadow-color=0.0/0.0/0.0/0.4
sub-shadow-offset=0.5
fastrizwaan commented 1 month ago

https://github.com/mpv-player/mpv/issues/11739

as can be seen above The Vulkan Video Decoding specs only cover H.264, H.265, and AV1.

fedora's flatpak mpv, does not support h264, here's the output of mpv:

flatpak run --filesystem=host io.mpv.Mpv  --hwdec=vulkan --gpu-api=vulkan --gpu-context=waylandvk 202* 
Playing: 2024_05_01_11_08_42_cut_de603f9c-9cd9-4c23-a6a8-fcc8330634c7.mp4
 (+) Video --vid=1 (*) (h264 854x480 25.000fps)
 (+) Audio --aid=1 (*) (aac 2ch 44100Hz)

[ffmpeg/video] libopenh264: Unable to create decoder
Could not open codec.
Decoder init failed for libopenh264
Failed to initialize a decoder for codec 'h264'.

I've raised an issue at https://github.com/mpv-player/mpv/issues/14269;

fastrizwaan commented 1 month ago

have you tested any other flatpak which has mpv which can play hwdec=vulkan? If you are able to play with vulkan from system mpv then flatpak has limitation compared to system mpv (dnf install mpv).

I have tried celluloid, which also gives the same error.

rizvan@fedora:~/Videos/mpv$ flatpak run --filesystem=host --command=mpv io.github.celluloid_player.Celluloid  --hwdec=vulkan --gpu-api=vulkan --gpu-context=waylandvk 2*
Playing: 2024_05_01_11_08_42_cut_de603f9c-9cd9-4c23-a6a8-fcc8330634c7.mp4
 (+) Video --vid=1 (*) (h264 854x480 25.000fps)
 (+) Audio --aid=1 (*) (aac 2ch 44100Hz)
MESA-INTEL: warning: ../src/intel/vulkan/anv_formats.c:794: FINISHME: support more multi-planar formats with DRM modifiers
Unsupported hwdec: vulkan
AO: [pipewire] 44100Hz stereo 2ch floatp
VO: [gpu] 854x480 yuv420p
AV: 00:00:01 / 00:00:47 (4%) A-V: -0.000
Exiting... (Quit)
fastrizwaan commented 1 month ago

fedora uses ffmpeg n6.1.1 with patches. whereas flathub ffmpeg is n7.0.x.

I could not find any useful info which helps in making ffmpeg n7.0.1 build with --enable-vulkan.

keftie22 commented 1 month ago

I got it to build but it brings up another error I mention here https://github.com/flathub/io.mpv.Mpv/pull/470

Likely needs a tweak somewhere to get it to actually work right. I also don't have the x-checker-data part yet because I've never done that. Pretty new to this and mostly copying the vulkan header module formatting I got from the GPUViewer yaml. Ffmpeg was not building with --enable-vulkan until I added that stuff. volk was needed by one of the vulkan modules as well so I had to add that.

Really confused currently as to how adding these modules and then adding this option for the ffmpeg build causes vo=gpu-next to no longer work.

keftie22 commented 1 month ago

I've actually got it working now. We just needed the one module for the vulkan headers and the flag to enable vulkan in the ffmpeg build. The extra stuff was interfering somehow. It's working on my intel graphics. It's building now and I'll test again with the flathubbot built version and also test with an AMD machine. I don't have an Nvidia machine to test on currently but that should work too if Intel and AMD both work.

fastrizwaan commented 1 month ago

Yes, it works on both Nvidia and Intel Systems:

Nvidia GPU with x11 context (using nvidia with xorg)

flatpak run --filesystem=host io.mpv.Mpv --vo=gpu-next --hwdec=vulkan --gpu-api=vulkan --gpu-context=x11vk S*

 (+) Video --vid=1 (*) (h264 1920x1080 25.000fps)
 (+) Audio --aid=1 --alang=hin (*) (aac 2ch 48000Hz)
Using hardware decoding (vulkan).
AO: [pipewire] 48000Hz stereo 2ch floatp
VO: [gpu-next] 1920x1080 vulkan[nv12]
AV: 00:05:26 / 00:28:32 (19%) A-V:  0.000

and waylandvk works with intel, should work well with amd.

So thanks. Merging it.