[DOCS] {hd} video definition class binding

All about user-defined episode / movie format expressions
Post Reply
User avatar
rednoah
The Source
Posts: 21687
Joined: 16 Nov 2011, 08:59

[DOCS] {hd} video definition class binding

Post by rednoah »

The {hd} binding will give you access to the video definition class:
  • SD for low definition video files (e.g. 480p or 576p)
  • HD for high definition video files (e.g. 720p or 1080p)
  • UHD for 4K and ultra high definition video files (e.g. 2160p)

e.g. sort movie files into SD / HD / UHD folders:

Code: Select all

Movies/{ hd }/{ plex.name }

e.g. sort movie files into 4K and non-4K movie folders:

Code: Select all

{ hd =~ /UHD/ ? 'Movies 4K' : 'Movies' }/{ plex.name }

e.g. sort movie files into HD and non-HD movie folders:

Code: Select all

{ hd =~ /HD/ ? 'Movies HD' : 'Movies SD' }/{ plex.name }
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 21687
Joined: 16 Nov 2011, 08:59

How does the {hd} binding work?

Post by rednoah »

FileBot 4.9.6 currently implements {hd} like so:

Code: Select all

if (w >= 3840 || h >= 2160) return "UHD"
if (w >= 1280 || h >= 720) return "HD"
return "SD"

However, newer revisions (i.e. FileBot r9341 and higher) support more fine-grained HD classes and implement {hd} like so:

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"

:arrow: See MediaBindingBean::getVideoDefinitionCategory for implementation details.
:idea: Please read the FAQ and How to Request Help.
Post Reply