Any chance of a tweak to whitelisting logic?

There’s a slight problem with the whitelist logic on my Vero 4K+. It seems very likely that this is a Kodi issue and not an OSMC one; but there is a historical precedent for OSMC using different whitelist logic from vanilla Kodi, so I’m wondering if this issue could also be fixed in an OSMC-specific way? (Hence I’m raising this as a feature request rather than as a bug report!)

The problem is with videos that have a resolution of 960x540, with a frame-rate of 25 or 50fps. (These are quite common nowadays on iPlayer). With all available resolutions whitelisted, Kodi defaults to playing these at 576p/50Hz. This means we are losing some of the horizontal resolution, by downscaling from 960 pixels to 720; and the way the whitelist is supposed to work (I think!) is that it should never result in a video being downscaled, only upscaled. (There’s obviously some vertical scaling involved as well).

It seems obvious to me that Kodi should be switching up to 720p/50Hz, or 1080p/50Hz (or maybe 1080p/25Hz if it’s a 25fps video).

Is this possible?

Yes. It will be in the next update.

1 Like

This should now be in the staging repository.

1 Like

Finally got around to testing this, and yes, it’s working nicely. :+1:

2 Likes

Come to think of it, there’s another bit of whitelist logic that seems odd to me. I’ve been playing some videos today that are 2160p/25fps. I’ve got 2160p/25Hz whitelisted. But the output mode defaults to 2160p/50Hz instead of 25. That wouldn’t be a problem except that the Vero 4K+ seems to have occasional issues with outputting 25fps at 50Hz - sometimes leads to jerky playback.

So, low priority, but maybe that could be tweaked too at some point? In general, if there’s a mode that exactly matches the video’s dimensions and frame rate, it doesn’t make sense to output at double the refresh rate; that should only be a fallback if there’s no exact match.

So, @sam_nazarko and @grahamh , I’m just coming back to this for the first time after the latest update. 4K/25fps videos are still being output as 4K/50Hz, even though 4K/25Hz is whitelisted. Any chance this could be changed?

(Playback is actually a bit jerky at 50Hz but smooth at 25Hz. And obviously I can change it manually each time, but you know…)

Can we see some logs?

Oh, yeah, sure: https://paste.osmc.tv/zuzovufeva

In case I wasn’t clear, what I’m agitating about right now is simply the fact that the video is 2160p/25fps, and I’ve got 2160p/25Hz whitelisted, but the default output mode is 2160p/50Hz, which doesn’t make sense to me.

I’ll add MediaInfo for the file in another post in a minute. I can upload a sample too, if you like?

MediaInfo (slightly redacted for anonymity):

General
Unique ID                                : [REDACTED]
Complete name                            : [REDACTED]
Format                                   : Matroska
Format version                           : Version 4
File size                                : 5.36 GiB
Duration                                 : 49 min 44 s
Overall bit rate                         : 15.4 Mb/s
Writing application                      : mkvmerge v49.0.0 ('Sick Of Losing Soulmates') 64-bit
Writing library                          : libebml v1.4.0 + libmatroska v1.6.1

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L5@High
Codec ID                                 : V_MPEGH/ISO/HEVC
Duration                                 : 49 min 44 s
Width                                    : 3 840 pixels
Height                                   : 2 160 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : A_AAC-2
Duration                                 : 49 min 44 s
Channel(s)                               : 6 channels
Channel layout                           : C L R Ls Rs LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Language                                 : English
Default                                  : Yes
Forced                                   : No

Text
ID                                       : 3
Format                                   : UTF-8
Codec ID                                 : S_TEXT/UTF8
Codec ID/Info                            : UTF-8 Plain Text
Title                                    : English [SDH]
Language                                 : English
Default                                  : No
Forced                                   : No


I hear you. Kodi’s logic is that for the default whitelist (ie if the user hasn’t set a whitelist) is to prefer 2x framearate over 1x framerate for 25Hz and 29/30Hz. If you do specify a whitelist, you can exclude 25Hz and 29/30Hz for the HD modes. After complaints from users, we changed that in OSMC so that the 2x modes are preferred even if you do specify a whitelist.

Now I suspect the issue Kodi is addressing applies only to interlaced modes. If you’ve got some SD/HD progressive 25Hz clips, what do you get if you disable 50Hz modes? If that’s good, maybe we can prefer 2x only when playing interlaced.

Otherwise a hacky solution would be to check for 2x modes only for SD/HD and not for UHD.

What do you think?

You’re right that I should probably find some test clips and double-check what’s happening in other cases :grinning: but off the top of my head…

Interlaced stuff should indeed always be played at the higher frame rate (1080i/50 at 50Hz, and 1080i/60 at 60Hz) because you can’t be entirely sure whether it’s field-interlaced or frame-interlaced or a mixture - even if there’s metadata, it may be wrong.

For progressive stuff, assuming all modes are whitelisted and double frequency is allowed, I think that exactly matching resolution should take precedence over exactly matching frame rate; so, for example, 720p/25fps should be output as 720p/50Hz, not 1080p/25Hz. But if there is a precise match for resolution and refresh rate available, it should be used - so 1080p/25fps should be output as 1080p/25Hz if that’s available; 2160p/25fps should be output as 2160p/25Hz; etc.

So yes, interlaced videos probably should be treated as a special case. Otherwise, keep it simple.

I guess I should also say that the only reason this really matters is that the Vero 4K seems to have a general issue with converting 25fps video to 50Hz output; if that weren’t the case, I probably wouldn’t even have noticed that it was outputting 50Hz in the first place, and it wouldn’t generally be a problem that it decides to do that. At some point it would be nice to look into that; but I’m sure that’s going to be horrible! In the mean time, making the whitelist logic a bit more logical nicely works around the issue a lot of the time. And honestly, I think it just makes more sense anyway; it might occasionally be useful for people who have unstable HDMI connections, etc.; and there’s really no obvious downside to not doubling the output frequency unless you actually need to.

So the precedence (assuming all modes whitelisted and both “multiples” checkboxes checked, and the video is progressive) should be:

  1. Exact match of resolution and refresh rate.
  2. Exact match of resolution with double refresh rate.
  3. Exact match of resolution with 3:2 refresh rate (e.g. 480p/24 as 480p/60).
  4. Higher resolution with same refresh rate.
  5. Higher resolution with double refresh rate.
  6. Higher resolution with 3:2 refresh rate.

Treat interlaced videos as if they were progressive but with the higher frame rate, so treat 1080i/50 as if it were 1080p/50, 1080i/60 as 1080p/60, etc.

And obviously options 2, 3, 5 and 6 should be ignored if the appropriate Settings checkbox isn’t checked.