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:


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.

1 Like

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:

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):

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

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

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

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.

So, now Kodi v20 is out, I wonder if I could bring this one up again? The original issue this thread was about - the way 960x540 videos are handled - was fixed; but the subsequent one is still outstanding.

Just to recap: the key problem is that if you tick the box to allow double refresh rates, then instead of merely allowing double refresh rates, Kodi actively prefers double refresh rates. So, for example, if the video is 1080p/25fps, and both 1080p/25Hz and 1080p/50Hz output modes are whitelisted, Kodi switches to 1080p/50Hz by default if the box is checked. Similarly, 2160p/25fps videos default to 2160p/50Hz instead of 2160p/25Hz.

This wouldn’t matter except that there’s a long-standing (probably kernel-level?) bug on the Vero 4K which means that 25fps videos output at 50Hz sometimes experience jerky playback. It would be great to fix that; but in the absence of a fix, tweaking the whitelisting logic would be a good partial work-around. (And, if it were up to me, I would make Kodi prefer 1080p/25Hz for 1080p/25fps videos even if there’s no whitelist active).

Because of the way the Vero 4K handles deinterlacing, interlaced videos should (by default) be output at the higher frame rate (e.g. 1080i/50 as 1080p/50Hz) even if the video is frame-interlaced. Unchecking the “double refresh rate” check box is not currently a viable work-around, as it results in 1080i/50 videos being output at 1080p/25Hz, which causes all kinds of problems.

1 Like

Let me get this straight. Interlaced should always be output at the field rate (2xframerate) while progressive 25p/30p should not be doubled up. That should be possible to do and if so should be upstreamed.

1 Like

That’s what makes the most sense to me - at least in terms of what mode it should default to. (There are one or two cases I can think of where you might want to manually override that, but they wouldn’t affect the default choice).

Obviously, you need to check what modes are actually available/whitelisted - my TV, for example, doesn’t have a 1080p/30Hz mode, and in that case (if the checkbox is checked and the video is 1080p/30fps) it makes sense to default to 1080p/60, not 2160p/30.

But yes, basically. :smiley:

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.
1 Like

I’ll need to think about that. We changed the default Kodi behaviour for a user (stateside so no 25/50Hz at 1080) that found 2160 at the correct refreshrate better than resampling at 1080 but I see your point.

1 Like

There are actually two different ways you could approach this… My original suggestion was to change the checkbox behaviour so that, if checked, it is interpreted as “allow double frame rates” instead of “prefer double frame rates”. That’s still my preferred option. But there is another way you could go: keep the checkbox as meaning “prefer double frame rates” but change the default frame rate for interlaced videos when the box is not checked.

At the moment, unchecking the box isn’t a viable option because a 1080i/50 frame-interlaced video gets output at 25Hz, which goes crazy. But if you were to change that behaviour so that, even with the box not checked, 1080i/50 is still output as 50Hz, then unchecking the box would then be a safe way to output 1080p/25fps as 1080p/25Hz if desired.

(In fact, now that I think about it, it might even be better to make both of those changes: change the default output mode for interlaced videos with the box not checked, and change the box being checked to mean “allow” rather than “prefer”).

Assuming your user who prefers 1080p/30 to be output as 2160p/30 is using the whitelist, he could uncheck the “allow double frame rate” box - for a 1080p/30fps video, Kodi would then prefer 2160p/30Hz over 1080p/60Hz. It seems to me it would be better to give the user the option to control what happens rather than forcing the same behaviour on everyone.

How you handle the behaviour when the whitelist is not enabled is something that probably does require some thought; in particular, the question of whether 1080p/30fps should default to 1080p/60Hz or 2160p/30Hz isn’t obvious (given the problems that Vero 4K has with doubling frame rates). But with the whitelist active, you want the user to be able to choose the behaviour for themselves.


Actually, the more I think about this, the more it makes sense to make both of those changes.

So, in the American case:

  • A 1080i/60 video should never be output as 1080p/30Hz by default, even if 1080p/30Hz is whitelisted and the checkbox is not checked.

  • If the video is 1080p/30fps and 1080p/30Hz is available and whitelisted, Kodi should use that, regardless of checkbox status.

  • If 1080p/30Hz is not available, and the checkbox is checked, Kodi should output 1080p/60Hz.

  • If 1080p/30Hz is not available, and the checkbox is not checked, it should output 2160p/30Hz.

Same principle applies for 25/50 in Europe.

As I say, I’ll leave it up to you to decide what the behaviour should be if the whitelist isn’t active. But with the whitelist active, that covers all possibilities.

1 Like

So, er, sorry to nag, @grahamh , and I understand you might not want to make any changes to the behaviour when the whitelist isn’t active - that’s cool - but when the whitelist is active, the way this ought to work seems pretty clear-cut. You need two changes:

  1. If the video is interlaced, it should always default to the field-rate even if the “double frame rates” box is not checked.

  2. If the video is progressive, the checkbox should be changed to mean “allow double refresh rates if there’s no exact match” instead of “prefer double refresh rates”.

Would you be willing and able to include those changes at some point?

Willing to have another look at it but I only have so much time for OSMC. And ideally, we would bring Team Kodi along with us.