Hardware acceleration switch for files

Hello everyone.
I tried to find similar request but i couldn’t, thus, i apologies if this will duplicate another one which i didn’t found, please point me.
As you know different devices have variety of hardware/software decode capabilities.
As an example - RPi4 can hardware decode 8 bit 4:2:0 h.264 videos but it cannot hardware decode 10 bit h.264 and/or 4:2:2 / 4:4:4 h.264
But it can do it in software decode easily. ARM power is enough.
On the other hand HEVC (h.265) files cannot be reproduced in software mode because codec complexity is too high.
Thus, if you have a bunch of different videos (like music video clips, series, anime etc) that have different formats (8 bit / 10 bit, 4:2:0 / 4:2:2 ) this quite annoying to go to system settings and enable/disable hardware decode in order to be able to view all files.

Is it possible to add hardware/software decode override flag to video property dialogue here

settings

to be able to watch convenient all video library content?

You can manually disable it under Settings → Playback,

Sorry, did you mean this ?

or which one ?

That’s the one.

Yeah, but that’s the exact problem i am talking about.
Think like that
There are some files in a folder being played it a row:

Franz Ferdinand - Love Illumination (1920x1080 h264 4:20: 8bit) - could be played both hardware/software decoded
Lady Gaga - Alejandro.mkv (3820x2160 hevc 4:2:0 8bit) - could be played only hardware-decoded
Miley Cyrus - Wrecking Ball.mkv (1920x1080 h264 4:2:2 8bit) - could be played software-decoded only
30 Seconds to Mars - Hurricane.mkv (1920x1080 h265 4:2:0 8bit) - could be played hardware-decoded only
Rammstein - Angel (Neon Genesis Evangelion fanfic).mp4 (1920x1080 h264 4:2:0 10bit) - could be played software-decoded only

So i couldn’t play them in a row because i have to enable/disable hardware decode for this files.
Therefore having hardware decode override for each particular file could be handy.
Thus i can globally enable it but disable for certain files or vice versa globally disable but enable for HEVC videofiles only.

This would be a Kodi specific feature.

On the Vero we have such an option for specific codecs; but that’s because we have a downstream implementation

Sam

So, you suggest to write this request on official Kodi’s support forum, right ?

Is there any kind of workarounds which could lead to force Kodi to use or not to use HW decode ? Like forcefully change something in MyVideos121.db in some table or similar “strange” solution ?

Obviously i can recode all my h264 10bit videos to h265 10bit videos because hevc 10 bit HW decode works fine on RPi4, but it will take time and codec parameter learning to preserve original quality and size balance.
Also i found that 4:2:2 HEVC videos on RPi4 automatically falls back to SW decode. Not sure RPi can handle that, but i will do tests.

Storing this on a file by file basis would presumably require a change to the Kodi db, which is obviously a Kodi change. But could you implement a simple “hardware decoding on/off” toggle during playback which could be mapped to a remote button? Or would that also require a Kodi change? I can think of other situations where that might be useful, for example when viewing a blu ray menu - you might want to turn hardware decoding off for the menu but back on for the movie.

1 Like

I’m not sure I understand. If you turn on HW decoding and RPi doesn’t support that format, doesn’t Kodi automatically fall back to SW decode?

Nope. There are 2 possible behaviors depending on file:

  1. 10bit file played with HW decoding but video picture is full of scattered squares, like damaged video. (When SW decoding enabled everything played fine and RPi4 outputs HDMI as RGB 4:4:4 12bit according to my AVR input info (when played 8 bit video it outputs RGB 4:4:4 8 bit signal via HDMI)
  2. 4:2:2 file Video part not played, only audio playback goes. Kodi interface shows file list where I initiated playback instead of video.

I’ve made some screenshots to clarify the behavior

  1. 10 Bit anime video file with scattered squares looking like this with HW decoding

  1. Same 10 Bit anime video file with SW decoding (normal look)

  1. 4:2:2 h264 file - only audio, no video

Ouch! That’s not subtle like the other clips we have. Can you upload a bit of that? My anime collection is, er, limited.

Pretty much all H264 hardware decoders will behave like this if you feed 10-bit through them – it’s nothing new.

Only the anime scene seems to use Hi10.

Replied to PM.

Thanks for the clips. I don’t have a RPi4 but was interested in how Vero handles these. I confirm that both Vero 4k and Vero V automatically fall back to SW decode with all of them, even if I turn HW to ‘always’. Maybe @popcornmix knows why that doesn’t happen the same on RPi. Otherwise, your request is one for Team Kodi.

In case you are considering an upgrade, Vero V can play your animes fairly well (in SW). The 720p one easily, the 1080p ones with some glitches in video or sound but it’s difficult to tell on the clips that are mostly stills. I have one other anime clip that’s x264 profile 5.1 1080p24 10-bits which does not play smoothly, even on Vero V. Miley (422 x264) also plays in SW and doesn’t play video fast enough to keep up with the audio.

1 Like

Thanks for the information,
Well, RPI4 seemed to be a bit better in SW decoding.
Mentioned Miley’s music video which is

Video
ID                          : 1
Format                      : AVC
Format/Info                 : Advanced Video Codec
Format profile              : High 4:2:2@L4
Format settings             : CABAC / 2 Ref Frames
Format settings, CABAC      : Yes
Format settings, Reference  : 2 frames
Codec ID                    : V_MPEG4/ISO/AVC
Duration                    : 3 min 52 s
Bit rate                    : 41.0 Mb/s
Width                       : 1 920 pixels
Height                      : 1 080 pixels
Display aspect ratio        : 16:9
Frame rate mode             : Constant
Frame rate                  : 23.976 FPS
Color space                 : YUV
Chroma subsampling          : 4:2:2
Bit depth                   : 8 bits
Scan type                   : Progressive
Bits/(Pixel*Frame)          : 0.825
Stream size                 : 1.11 GiB (94%)
Language                    : English
Default                     : Yes
Forced                      : No
Color range                 : Limited
Color primaries             : BT.709
Transfer characteristics    : BT.709
Matrix coefficients         : BT.709

played quite smooth and by the end have about 70 skipped frames which is negligible and does not affect comfort (value 166 you can see on screenshot below caused by dispmanx_vncserver used to capture a screenshot)

Yes, IIRC RPI4 has the edge on Vero V for CPU grunt. I believe S905X4 was selected for V as the best bang-for-buck for media playback, while RPi seeks to be an all-rounder.

Users have reported that library scraping is faster on the V than the Pi 4.

That’s very CPU intensive

Software decode might be faster on Pi because they have some ffmpeg optimisations and the render pathway is lighter.

X4 was selected to support a wide variety of video formats including the increasingly popular AV1

Touché :sweat_smile:
RPi4 cannot HW decode VP9/AV1
VP9 plays well up to 1080p in SW. Starting from 1444p it freezes
AV1 cannot be played even 1080p. Too complex decoding.
So youtube 4k is not possible on RPi4 anymore since Youtube offers stream in h264 prior to 1080.
All resolutions above 1080 available only in VP9/AV1.

Also i have read h266 is coming :slight_smile:
Will be waiting for RPi6 :stuck_out_tongue_closed_eyes:

Both VP9 and AV1 work well on Vero V with full hardware acceleration.

VP9 can even be pushed at 8K albeit not in an official capacity.

We will support H266 when it’s relevant.

Keep in mind that Pi is not a media centre directly and not its direct target market.

Once you add up cost of ownership, factor in longevity (support, when you need to upgrade the device), it’s a no brainier to buy a Vero V. That is if your intention is to have a media device.

The Pi is great for hardware hacking, education and a cheap desktop. But that’s not why you are here.

There will be Vero 4K users that purchased their device in 2017 using their device in 2030 to play their 4K HEVC Blu-rays in HDR10+/HLG and stream VP9 videos via YouTube. And they paid £99 for the privilege as a one off…