{hd} and {vf} bindings for odd video resolutions (e.g. 3832x1602)

Support for Windows users
Post Reply
jerome
Posts: 31
Joined: 25 Feb 2019, 02:21

{hd} and {vf} bindings for odd video resolutions (e.g. 3832x1602)

Post by jerome »

How are the {hd} and {vf} bindings defined?

I notice that some of the files I am renaming get tagged as HD under the {hd} binding but as 2160p under the {vf} binding. In those instances, I notice that the resolution Height is less than 2160 pixels but yet the {vf} is returning a 2160p binding. If you are defining {vf} as 2160p for pixel height between 1081 and 2160 then should it not also return UHD for the {hd} binding to be consistent?

Here is example data of one such file:

Code: Select all

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L5@High
HDR format                               : SMPTE ST 2086, HDR10 compatible
Codec ID                                 : V_MPEGH/ISO/HEVC
Duration                                 : 1 h 32 min
Bit rate                                 : 14.4 Mb/s
Width                                    : 3 832 pixels
Height                                   : 1 602 pixels
Display aspect ratio                     : 2.40:1
Frame rate mode                          : Constant
Frame rate                               : 23.976 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0 (Type 2)
Bit depth                                : 10 bits
Bits/(Pixel*Frame)                       : 0.098
Stream size                              : 9.31 GiB (95%)
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                 : PQ
Matrix coefficients                      : BT.2020 non-constant
Mastering display color primaries        : BT.2020
Mastering display luminance              : min: 0.0050 cd/m2, max: 1000 cd/m2
Maximum Content Light Level              : 1127 cd/m2
Maximum Frame-Average Light Level        : 221 cd/m2
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: question regarding usage of {hd} and {vf} bindings

Post by rednoah »

1.
{hd} works like this:

Code: Select all

// UHD
if (resolution.getWidth() >= 3840 || resolution.getHeight() >= 2160) {
	return "UHD";
}
// HD
if (resolution.getWidth() >= 1280 || resolution.getHeight() >= 720) {
	return "HD";
}
// SD
return "SD";
:idea: The UHD value does not require a full 3840x2160 resolution, but does require at least either width or height to be up to standard. Your 3832x1602 resolution falls short in both width and height.

:?: Do you consider your file to be HD or UHD?



2.
{vf} is just the format class, e.g. 2160p or 1440p or 1080p. Your file seems to fit best into the first one. You can use {hpi} instead if you want exact values, i.e. 1602p for the file at hand.

:?: Which quality class would you pick for your file?



3.
You can always write your own code if the default behaviour doesn't work well for you:

Code: Select all

{ height > 1600 ? '4K' : 'HD' }

Code: Select all

{ vf == '2160p' ? '4K' : 'HD' }




EDIT:

FileBot r9329 makes the {hd} binding more lenient for files that are just a few pixels short in either width or height:

Code: Select all

// UHD (require 3840x2160 resolution but be lenient if the video is a few pixels short)
if (resolution.getWidth() >= 3800 || resolution.getHeight() >= 2100) {
	return "UHD";
}
// HD (require 1280x720 resolution but be lenient if the video is a few pixels short)
if (resolution.getWidth() >= 1200 || resolution.getHeight() >= 700) {
	return "HD";
}
// SD
return "SD";
:idea: Please read the FAQ and How to Request Help.
jerome
Posts: 31
Joined: 25 Feb 2019, 02:21

Re: {hd} and {vf} bindings for odd video resolutions (e.g. 3832x1602)

Post by jerome »

In my example, I was expecting it would be classified as UHD under {hd} and 2160p under {vf}.

This expectation is based on my impression that pixel height determined the {hd} classification based on the resolution table as follows.

SD 000p to 576p
HD 577p to 720p
FHD 721p to 1080p
QHD 1081p to 1440p
UHD 1440p to 2160p

I see I will need to modify my coding as the {hd} binding works differently from what I expected.
Would you be able to point me in the right direction on the easiest way to accomplish a classification above?
Thanks
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: {hd} and {vf} bindings for odd video resolutions (e.g. 3832x1602)

Post by rednoah »

e.g.

Code: Select all

{
	switch (height) {
		case 0..576: "SD"
		case 577..720: "HD"
		case 721..1080: "FHD"
		case 1081..1440: "QHD"
		case 1441..2160: "UHD"
	}
}

:idea: Your 3832x1602 file will thus fall into the 1440..2160: "UHD" case.




EDIT:

FileBot r9341 and higher will enhance the {hd} binding with the following conditions:

Code: Select all

if (w > 2560 || h > 1440)
	return "UHD";
if (w > 1920 || h > 1080)
	return "QHD";
if (w > 1280 || h > 720)
	return "FHD";
if (w > 1024 || h > 576)
	return "HD";

return "SD";
:idea: Please read the FAQ and How to Request Help.
Post Reply