Rafostar / clapper

Level up your video experience with a modern and user-friendly media player.
https://rafostar.github.io/clapper/
GNU General Public License v3.0
773 stars 36 forks source link

AV1 encoded videos fails to play when vaapi decoder is used #336

Closed Shished closed 1 year ago

Shished commented 1 year ago

Clapper shows the 1st frame of the video and then empty window when trying to open an AV1 encoded video but only if the vaapi decoder vaav1dec0 is used. Terminal output:

Error from element /GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstVaAV1Dec:vaav1dec0: Could not decode stream.
Failed to handle the frame 0
../gstreamer/subprojects/gst-plugins-bad/gst-libs/gst/codecs/gstav1decoder.c(651): gst_av1_decoder_handle_frame (): /GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstVaAV1Dec:vaav1dec0

This happens with the version installed from AUR on Arch Linux and with the flatpak version as well. OS: Arch Linux GPU: Intel Alder Lake-S GT1 (UHD Graphics 770).

Rafostar commented 1 year ago

I know that there were quite a lot of fixes regarding AV1 playback done during GStreamer 1.22 development cycle. It should be released in a week or two, unless some blocker bugs are found.

If you want to try it right now, you can temporarily replace your installation with Clapper Nightly Flatpak build that can be found on GitHub Actions tab. Although bear in mind that those are highly unstable builds from git that are good for testing purposes, but not recommended to be used long term.

Shished commented 1 year ago

It seems that nightly builds does not have the vaav1dec0 decoder.

зображення

Rafostar commented 1 year ago

@Shished Does your system have two GPUs?

Rafostar commented 1 year ago

According to above screenshot, GStreamer detected dual GPUs, where 1st one can do HW decoding of h264, h265, JPEG, MPEG2, while second device ("renderD128") can do the same formats + AV1 and VP9 in addition.

A situation like this can happen when for example you have integrated Intel graphic and an additional GPU that also supports VAAPI (e.g. from AMD). If this is correct and you are running multi GPU system, then all you have to do is to tell which GPU should be used for decoding which codec by enabling rank override in prefs and setting it rank to higher value then the other GPU (in this case varenderD128av1dec is the GPU that can do AV1).

Shished commented 1 year ago

Yes, I have also Radeon GPU installed but the desktop is running on Intel iGPU. I set the overrides for those decoders to 281 and now clapper can play AV1 videos without problems. Those decoders are available only in flatpak nightly builds, though. The version from AUR does not have D128 av1 and vp9 decoders.

Rafostar commented 1 year ago

Yes, I have also Radeon GPU installed but the desktop is running on Intel iGPU.

It's not completely disabled if it shows up here and we can still use it. For optimal performance its usually best to decode video on the same GPU that is set to be running (rendering) Clapper application. But we do not know what user prefers in case of multiple GPUs so that is why it is configurable in preferences like you just did.

Those decoders are available only in flatpak nightly builds, though.

The support for multiple GPUs detection in VA plugin was also added to GStreamer during 1.22 development, so once this version is released the list will be the same in other packages.

Rafostar commented 1 year ago

now clapper can play AV1 videos without problems

Since the problem is solved and the rest depends on the installed GStreamer version. I think this issue can be closed now.

Shished commented 1 year ago

Arch got the gst libraries upgraded to 1.22 and now stable Clapper from AUR works without problems.