example;
k:\movies\webdl\
webdl format expression:
Code: Select all
{n} ({y}) - {any{hd}{'HD'}} - {vs} - {vf} - {mbps} - {video[0].'framerate'} - {any{hdr}{'SDR - 8'}} - {aco} - {((audio[0].'BitRate' as float) / 1e6).round()} Mbps
k:\movies\hd\
hd format expression;
Code: Select all
{n} ({y}) - {"HD - BluRay"} - {vf} - {mbps} - {video[0].'framerate'} - {"SDR - 8"} - {aco} - {((audio[0].'BitRate' as float) / 1e6).round()} Mbps
k:\movies\uhd\
uhd format expression; (This one is pretty long, I don't recall the reason this one is longer)
Code: Select all
{n} ({y}) - {"UHD - BluRay"} - {vf} - {mbps} - {video[0].'framerate'} - {HDR} - { any{video[0].MaxCLL.replace('cd/m2','nits')}{'1000 nits'} } -
{def preferredLang = 'Eng';
def filter = { [it.codec,] };
def codecList = [
'PCM' : 'PCM',
'AC 3' : 'AC3',
'Dolby Digital' : 'Dolby Digital',
'AC 3 Dep' : 'Dolby TrueHD with Dolby Atmos',
'E AC 3' : 'Dolby TrueHD with Dolby Atmos',
'E AC 3 JOC' : 'Dolby TrueHD with Dolby Atmos',
'AC 3 Dep JOC' : 'Dolby TrueHD with Dolby Atmos',
'DTS' : 'DTS-HD Master Audio',
'DTS ES' : 'DTS-HD Master Audio',
'DTS ES XXCH' : 'DTS-HD Master Audio',
'DTS XBR' : 'DTS-HD Master Audio',
'DTS ES XBR' : 'DTS-HD Master Audio',
'DTS XBR AC 3' : 'DTS-HD Master Audio',
'DTS ES XXCH XBR' : 'DTS-HD Master Audio',
'DTS XLL' : 'DTS-HD Master Audio',
'DTS ES XLL' : 'DTS-HD Master Audio',
'DTS ES XLL AC 3' : 'DTS-HD Master Audio',
'DTS ES XXCH XLL' : 'DTS-HD Master Audio',
'DTS-HD Master Audio' : 'DTS-HD Master Audio',
'DTS XLL X' : 'DTS X',
'MLP FBA' : 'Dolby TrueHD with Dolby Atmos',
'MLP FBA 16 ch' : 'Dolby TrueHD with Dolby Atmos',
'AC 3 MLP FBA 16 ch' : 'Dolby TrueHD with Dolby Atmos',
];
def audioStreams = []
def audioClean = { it.replaceAll(/\p{Punct}/, ' ') }
def channelClean = { it.replaceAll(/Debug.+|Object\sBased\s?\/?|(\d+)?\sobjects\s\/\s|0.(?=\d.\d)|20/).replaceAll(/6.0/,'5.1').replaceAll(/8.0/,'7.1') }
def listStream = { it.sort{ a, b -> b.bitrate <=> a.bitrate }.collect{ filter(it) }.unique()*.join(' ') }
def oneStream = { listStream(it)[0] }
def dString = { it.toDouble().toString() }
def toInt = { it.toInteger() }
any{audio.collect{ au ->
def codec = audioClean(any{ au['CodecID/Hint'] }{ au['Format'] })
def format_profile = any{ audioClean(au['Format_AdditionalFeatures'])}{}
def String ch = any{ channelClean(au.ChannelPositionsString2).tokenize('\\/')*.toDouble().sum() }
{ channelClean(au.ChannelLayout_Original).split().collect{ it == 'LFE' ? 0.1 : 1 }.sum() }
{ channelClean(dString(au.ChannelsOriginal)) } { channelClean(dString(au.Channels)) }
def combined = allOf{codec}{format_profile}.join(' ')
audioStreams << ['index' : codecList.findIndexOf { it.key == combined }, 'default' : any {au['default'][0].toBoolean() }{ audio.size == 1 ? true : '' },
'codec' : codecList.get(combined, 'Add "' + combined + '" to codecList'), 'combined' : combined, 'ch' : ch,
'bitrate' : any{ toInt(au.BitRate) }{ toInt(au.BitRate_Maximum) }{ au.FrameRate.toDouble() }{null}, 'lang' : any{ au.'LanguageString2'.upper() }{null} ]
}
def addToList = audioStreams.codec.findAll{ it.contains('to codecList') }.unique().sort()
any{addToList}{( audioStreams.findAll{ it.lang == preferredLang }.sort{ a, b -> b.bitrate <=> a.bitrate } + audioStreams.findAll{ it.bitrate == audioStreams.bitrate.max() }.sort{ a, b -> b.default <=> a.default }.unique{ it.bitrate } ).unique{ it.lang }.unique{ it.codec }.collect{ filter(it) }*.join(' ').join(' & ')}
}{'NO_AUDIO'}
} -
{((audio[0].'BitRate' as float) / 1e6).round()} Mbps