Anyone have a format expression for "guessing" at quality?

All about user-defined episode / movie / file name format expressions
Post Reply
jbrukardt
Posts: 1
Joined: 04 Aug 2017, 03:17

Anyone have a format expression for "guessing" at quality?

Post by jbrukardt »

I've seen a few expressions that try to approximate quality based on filesize, resolution, etc. But I havent seen a comprehensive one that takes all factors into account. I find that audio may in fact be the greatest differentiating factor.

In addition, does anyone have a wordlist for what "{source}" covers? Tying the above expression to an existing source definition would be best
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: Anyone have a format expression for "guessing" at quality?

Post by devster »

Unless I'm mistaken {source} should cover:

Code: Select all

pattern.video.source: CAMRip|CAM|PDVD|TS|TELESYNC|PDVD|PTVD|PPVRip|Screener|SCR|SCREENER|DVDSCR|DVDSCREENER|BDSCR|R4|R5|R5LINE|R5.LINE|DVD|DVD5|DVD9|DVDRip|DVDR|TVRip|DSR|PDTV|SDTV|HDTV|HDTVRip|DVB|DVBRip|DTHRip|VODRip|VODR|BDRip|BRRip|BR.Rip|BluRay|Blu.Ray|BD|BDR|BD25|BD50|3D.BluRay|3DBluRay|3DBD|BR.Scr|BR.Screener|HDDVD|HDRip|WorkPrint|VHS|VCD|TELECINE|WEBRip|WEB.Rip|WEBDL|WEB.DL|WEBCap|WEB.Cap|ithd|iTunesHD|Laserdisc|AmazonHD|NetflixHD|NetflixUHD|VHSRip|LaserRip|URip|UnknownRip|MicroHD
Regarding quality I'm not sure I understand what you mean. There are bindings that allow you full access to mediainfo information, so whatever's available there you can use as you please.
I only work in black and sometimes very, very dark grey. (Batman)
Cutha
Posts: 13
Joined: 21 Aug 2017, 09:16

Re: Anyone have a format expression for "guessing" at quality?

Post by Cutha »

jbrukardt wrote: 04 Aug 2017, 16:40 I find that audio may in fact be the greatest differentiating factor.
Yup, its sad when I accidentally grab a big movie and expecting because its 8+Gigs that its not going to be 2Ch AAC!

This might help or give you some ideas, or not. My attempt at scoring:
Cutha wrote: 21 Aug 2017, 10:11
I started using filebot a few days ago and quickly ran into a problem with naming my files based on audio stream. Turns out some of my movies do not have the best track set to the default and/or to audio[0]. I noticed others on here also wanting to have the "best" audio shown in the file name, or at least tag it with Atmos or DTS-X if it had it.

Once I started working with it I couldn't stop until I had it the way I wanted. Crouching Tiger has DTS 6Ch English on audio[0] and it is set as the default and Atmos is on [3]. I also decided to do a best audio option based on my own scale where object based sound gets a score of 10, DTS-HD MA gets a score of 20 and
AAC gets 50. I haven't fully fleshed this out.

The primary goal was to get the audio track that is set as default, which may not be [0] and use that for the file name. I also wanted to make sure my Atmos movies got tagged as such even if the Atmos track was not set as default.

Example where DTS is set as default but Atmos is available and where DTS-X is the default.

Crouching Tiger, Hidden Dragon (2000) DTS-HDMA 6Ch [Best Available TrueHD(Atmos) OB+8Ch]
The Huntsman - Winter's War (2016) DTS-HDMA(DTS-X) OB+8Ch

Image

It iterates through all the audio channels, scores them and based on that makes the string for the audio part of the file name. It's my first Groovy code so I apologize if its not the most efficient.

Code: Select all

{def ADef = 0;
def ADefScore = 100;
def ACurrent = 100;
def ABest = 100;
def ABestIndex;
def ACnt = audio.size;
def iCnt = 0;

//map of scoring, Codec + FormatProfile with '+' and '/' stripped
def mAudioScore =[
"DTS-HDXMACore" : 10, "DTS-HDMACore" : 20, "DTS-HDMAES MatrixCore" : 20, "DTSES DiscreteCore" : 25, "DTS" : 30,  "DTS-HDHRACore" : 25,
"TrueHDTrueHDAtmosTrueHD" : 10, "TrueHD" : 18, 
"AC3" : 30, "AC3+" : 20, "AAC" : 50, "AAC LCLC" : 45, "AAC LC-SBRHE-AACLC" : 40,
"MPA1L3Layer 3" : 60, "MPA1L2Layer 2" : 70,
"Vorbis" : 65,
"PCM" : 90, "Qclp" : 90, "161" : 90];

//map of Codec + FormatProfile made nice for file name
def mAFP = [ 
"DTS-HDXMACore" : "DTS-HDMA(DTS-X)", "DTS-HDMACore" : "DTS-HDMA", "DTS" : "DTS",  "DTS-HDMAES MatrixCore" : "DTS-HDMA",  "DTSES DiscreteCore" : "DTS-ES", "DTS-HDHRACore" : "DTS-HDHRA",
"TrueHDTrueHDAtmosTrueHD" : "TrueHD(Atmos)", "TrueHD" : "TrueHD", 
"AC3" : "AC3", "AC3+" : "DDP", 
"AAC LCLC" : "AAC", 
"MPA1L3Layer 3" : "MP3", "MPA1L2Layer 2" : "MP2",
"PCM" : "PCM", "Qclp" : "Qclp", "161" : "161"];

//map of Audio Channels(minus the slash) to pretty name
def mACH = [ 
"Object Based10" : "OB+10Ch", 
"Object Based8" : "OB+8Ch", "Object Based86" : "OB+8Ch", 
"Object Based6" : "OB+6Ch", 
"Object Based" : "OBCh", 
"9" : "9Ch", 
"8" : "8Ch", "86" : "8Ch",  "876" : "8Ch",
"7" : "7Ch", "76" : "7Ch",
"6" : "6Ch", 
"5" : "5Ch", 
"4" : "4Ch", "3" : "3Ch", "2" : "2Ch", "1" : "1Ch" ];

//Intermederia used to make finding missing strings from the maps
def CmACH = { if(mACH.get(it) != null) mACH.get(it) else " (mACH:" + it + " NOT FOUND)"};
def CmAFP = { if(mAFP.get(it) != null) mAFP.get(it) else " (mAFP:" + it + " NOT FOUND)"};
def CmAudioScore = { if(mAudioScore.get(it) != null) mAudioScore.get(it) else " (mAudioScore:" + it + " NOT FOUND)"};

//simple functions for creating audio text for file name
def GetFPSafe = {if(self.audio[it].FormatProfile != null) audio[it].FormatProfile.slash('').replace("+","") else ""};
//def GetAText = {mAFP.get( audio[it].codec + GetFPSafe(it)) + " " + mACH.get( audio[it].channels.slash('') ) };
def GetAText = {CmAFP( audio[it].codec + GetFPSafe(it)) + " " + CmACH( audio[it].channels.slash('') ) };

//Get index # that the default audio is using (only expecting 1 default audio)
audio.eachWithIndex{ a, idx -> if(call{a.default} == "Yes") ADef = idx};
//Get score for default audio
ADefScore = CmAudioScore(self.audio[ADef].codec + GetFPSafe(ADef))
//ADefScore = 50; //for your testing

//Check all audio streams, rank them against one another, get best score
for (iCnt = 0; iCnt < ACnt; iCnt++){

ACurrent = CmAudioScore(self.audio[iCnt].codec + GetFPSafe(iCnt))
if(ACurrent != null && ACurrent.toInteger() < ABest) ABestIndex = iCnt;
if(ACurrent != null && ACurrent.toInteger() < ABest) ABest = ACurrent.toInteger();
};

//end
if(ADefScore.toInteger() == ABest) GetAText(ABestIndex) + ")" else GetAText(ADef) + " [BA " + GetAText(ABestIndex) + "]" + ")";
}
My previous post..
Cutha
Posts: 13
Joined: 21 Aug 2017, 09:16

Re: Anyone have a format expression for "guessing" at quality?

Post by Cutha »

I am curious to know how others would rank these. Yes, I know, bitrate and # of channels are also a factor. One step at a time.

I scored these with the lowest number being the best. The text is created by adding codec+FormatProfile.

"DTS-HDXMACore" : 10
"DTS-HDMACore" : 20
"DTS-HDMAES MatrixCore" : 20
"DTSES DiscreteCore" : 25
"DTS" : 30
"DTS-HDHRACore" : 25

"TrueHDTrueHDAtmosTrueHD" : 10
"TrueHD" : 18
"AC3" : 30
"AC3+" : 20

"AAC" : 50
"AAC LCLC" : 45
"AAC LC-SBRHE-AACLC" : 40

"MPA1L3Layer 3" : 60
"MPA1L2Layer 2" : 70

"Vorbis" : 65

"PCM" : 90

"Qclp" : 90
"161" : 90
Post Reply