Dolby Atmos and DTS-X Naming

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
CHA0SENG7NE
Posts: 70
Joined: 19 Apr 2017, 22:13

Dolby Atmos and DTS-X Naming

Post by CHA0SENG7NE »

Hi
With 4k Movies can filebot recognise it is an Dolby Atmos or DTS-X soundtrack, My files are always named TrueHD 7.1
using the {ac} {channels}
Remux 4k files can have a few audio streams, is it possible for filebot to find the biggest/best audio and name accordingly? Depending if it Atmos or DTS-X?

Many thanks for any advice

:D
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Dolby Atmos and DTS-X Naming

Post by rednoah »

Possibly yes, but you might have to come with the rules for what constitutes Dolby Atmos or DTS-X yourself:
viewtopic.php?f=5&t=4285

The {aco} (based on audio stream Codec_Profile field) is probably the most related top-level binding. But you can access any MediaInfo field directly and then have your own logic come up with some value based on that.

Finding the "biggest" audio stream is easy, since you just need to compare the stream size, but "best" is highly subjective and so you'd have to encode your preferred sort order in your format as well. I'd go with "biggest" audio stream, or check if any audio stream matches your Atmos / DTS-X criteria, and then just print that.
:idea: Please read the FAQ and How to Request Help.
CHA0SENG7NE
Posts: 70
Joined: 19 Apr 2017, 22:13

Re: Dolby Atmos and DTS-X Naming

Post by CHA0SENG7NE »

That's excellent. I didn't realise you can pull so much info.
So going with the biggest audio file would make sense as it's most likely to be the best audio file with Atmos/dts-x

Now I just need to work out how to make this happen!

Thank you
CHA0SENG7NE
Posts: 70
Joined: 19 Apr 2017, 22:13

Re: Dolby Atmos and DTS-X Naming

Post by CHA0SENG7NE »

Any possible guidance on how to find the largest audio file from mediainfo?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Dolby Atmos and DTS-X Naming

Post by rednoah »

Not sure. I'd need a sample file for testing, so I can see what MediaInfo fields are available.
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Dolby Atmos and DTS-X Naming

Post by kim »

Code: Select all

{audio.StreamSize*.toInteger().max()}
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Dolby Atmos and DTS-X Naming

Post by kim »

Code: Select all

{audio.max{it.StreamSize.toInteger()}.Codec}
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Dolby Atmos and DTS-X Naming

Post by kim »

Code: Select all

{def best = any{audio.max{it.StreamSize.toInteger()}}{audio}; (ac == 'MP3'|| ac == 'AAC'|| ac == 'EAC3') ? ac :  any{(best.Codec+'.'+best.FormatProfile.replaceAll(/\/.*/))}{audio.Codec.join()}}
CHA0SENG7NE
Posts: 70
Joined: 19 Apr 2017, 22:13

Re: Dolby Atmos and DTS-X Naming

Post by CHA0SENG7NE »

Hi Kim
Thank you for all the information.
Does the last piece of code find the biggest file and rename? Or does it display the name of the audio file as displayed in mediainfo. My mind is a little blown how in-depth this is.

Generally my files are named DTS 5.1, DTS 7.1, Dolby TrueHD etc With the info you have provided would I need to rename the audio file it finds based on logic as Mediainfo doesnt state Dolby Atmos or DTS:X?
CHA0SENG7NE
Posts: 70
Joined: 19 Apr 2017, 22:13

Re: Dolby Atmos and DTS-X Naming

Post by CHA0SENG7NE »

so I gave
{def best = any{audio.max{it.StreamSize.toInteger()}}{audio}; (ac == 'MP3'|| ac == 'AAC'|| ac == 'EAC3') ? ac : any{(best.Codec+'.'+best.FormatProfile.replaceAll(/\/.*/))}{audio.Codec.join()}}
that worked by listing all the audio files names next to each other. e.g DTS-HDDTSAC3AC3
This is from a file with a atmos track, how can you use this info to label correctly?
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Dolby Atmos and DTS-X Naming

Post by kim »

version 2

Code: Select all

{
def best = any{audio.max{it.StreamSize.toInteger()}}{null};
def ChannelString = any{(best.'ChannelPositionsString2'.replaceAll(/Object\sBased\s\/|(\d+)?\sobjects\s\/|0.(?=\d.\d)/, '').split(' / ').collect{ it.split('/')*.toDouble().sum() }.max()).toString()}{null};
def audioCodec = (ac == 'MP3'|| ac == 'AAC'|| ac == 'EAC3') ? ac : any{best.FormatProfile ? (best.Codec+'.'+best.FormatProfile.replaceAll(/\s?\/.*/)) : null}{best.Codec}{aco}{(audio.Codec+'.'+audio.FormatProfile).join().replaceAll(/\s?\/.*/)}{ac}{'ERROR'};
allOf{audioCodec}{any{ChannelString}{channels}}.join(' ')
}
e.g.
DTS-HD.MA 7.1
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Dolby Atmos and DTS-X Naming

Post by kim »

version 3

Code: Select all

{
def best = any{audio.max{it.StreamSize.toInteger()}}{ audio.max{it.BitRate.replaceAll(/Unknown\s?\/\s?/).split(' / ')*.toInteger().max()}}{null};
def ChannelString = any{(best.'ChannelPositionsString2'.replaceAll(/Object\sBased\s\/|(\d+)?\sobjects\s\/|0.(?=\d.\d)/, '').split(' / ').collect{ it.split('/')*.toDouble().sum() }.max()).toString()}{null};
def audioCodec = (ac == 'MP3'||ac == 'AAC') ? ac : any{best.FormatProfile ? (best.Codec+'.'+best.FormatProfile.replaceAll(/\s?\/.*|E-AC-3\+/)) : null}{best.Codec}{aco}{ac}{'ERROR'};
allOf{audioCodec}{any{ChannelString}{channels}}.join(' ');
}
CHA0SENG7NE
Posts: 70
Joined: 19 Apr 2017, 22:13

Re: Dolby Atmos and DTS-X Naming

Post by CHA0SENG7NE »

wow thank you kim for all the effort, I will try again later.

I honestly don't understand how you do this!
CHA0SENG7NE
Posts: 70
Joined: 19 Apr 2017, 22:13

Re: Dolby Atmos and DTS-X Naming

Post by CHA0SENG7NE »

Hi Kim I have tried version 3. It works well but sometimes it will name a file

\\192.168.0.111/uhd movies/Avatar (2009) [PG-13] [☆7.3] [162mins]/Avatar (2009) [ 2160p x265 10bit TrueHD.TrueHD+Atmos 7.1 ]

Its only on some files? any suggestions? every other format works.

I just tried version 2 and the problem file changed?

Thank you again
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Dolby Atmos and DTS-X Naming

Post by kim »

you can fix this yourself like so

change

Code: Select all

{audioCodec}
to

Code: Select all

{audioCodec.replaceAll(/TrueHD.TrueHD/, 'TrueHD')}
CHA0SENG7NE
Posts: 70
Joined: 19 Apr 2017, 22:13

Re: Dolby Atmos and DTS-X Naming

Post by CHA0SENG7NE »

Thank you
CHA0SENG7NE
Posts: 70
Joined: 19 Apr 2017, 22:13

Re: Dolby Atmos and DTS-X Naming

Post by CHA0SENG7NE »

Another question, is it possible to have a few options with replaceAll e.g TrueHD.TrueHD and also TrueHD.AC3 so if any option comes up you can add it into

{audioCodec.replaceAll(/TrueHD.TrueHD/, 'TrueHD')}

Thank you
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Dolby Atmos and DTS-X Naming

Post by kim »

Code: Select all

{audioCodec.replaceAll(/TrueHD.TrueHD/, 'TrueHD').replaceAll(/TrueHD.AC3/, 'TrueHD')}
this is "Regular Expression"
make/test your own here:
http://www.regexplanet.com/advanced/java/index.html
https://regexr.com/

hmm
weird file you have... have you changed the format in any way or are you using old filebot/mediainfo version ?
what is output from this ?

Code: Select all

{audio.collect{a -> a.Codec+'*'+{any{a.FormatProfile}{'NO_FormatProfile'} }}.unique()}
MediaInfo Inspector: viewtopic.php?f=5&t=4285

version 3.1

Code: Select all

{
def best = any{audio.max{it.StreamSize.toInteger()}}{ audio.max{it.BitRate.replaceAll(/Unknown\s?\/\s?/).split(' / ')*.toInteger().max()}}{null};
def ChannelString = any{(best.'ChannelPositionsString2'.replaceAll(/Object\sBased\s\/|(\d+)?\sobjects\s\/|0.(?=\d.\d)/, '').split(' / ').collect{ it.split('/')*.toDouble().sum() }.max()).toString()}{null};
def audioCodec = (ac == 'MP3'||ac == 'AAC') ? ac : any{best.FormatProfile ? (best.Codec+'.'+best.FormatProfile.replaceAll(/\s?\/.*|E-AC-3\+|TrueHD|AC3|Matrix/)).replaceAll(/\.\+|\+\./, '+').replaceAll(/\.$/).replaceAll(/DTS\./, 'DTS-') : null}{best.Codec}{aco}{ac}{'ERROR'};
allOf{audioCodec}{any{ChannelString}{channels}}.join(' ');
}
btw: your output is from this part:

Code: Select all

best.Codec+'.'+best.FormatProfile.replaceAll(/\s?\/.*|E-AC-3\+/)
CHA0SENG7NE
Posts: 70
Joined: 19 Apr 2017, 22:13

Re: Dolby Atmos and DTS-X Naming

Post by CHA0SENG7NE »

H Kim
I apologise for giving a poor example of TrueHD.AC3
The errors I actually got were. TrueHD.TrueHD+Atmos 7.1 and also AC3+.Atmos 7.1
I do have the latest versions it was just error on my part.
Version 3.1 now works perfectly.
Thank you so much. I will try and learn some more with your advice.
CHA0SENG7NE
Posts: 70
Joined: 19 Apr 2017, 22:13

Re: Dolby Atmos and DTS-X Naming

Post by CHA0SENG7NE »

Hi
So the naming of DTS-X files has changed recently, instead i get DTS-HD Master Audio? I have checked file with Mediainfo and can see the commercial name is this... DTS-HD Master Audio is this right?

Im using ver3.1 of the audio naming by kim in this post, it used to rename to DTS-HD.X

Is it possible to use format from string below and then rename

e.g DTX XLL X to ' DTS-X ' and MLP FBA 16-ch to ' Dolby Atmos ' ?


Audio #1
ID : 2
Format : DTS XLL X
Format/Info : Digital Theater Systems
Commercial name : DTS-HD Master Audio
Codec ID : A_DTS
Duration : 2 h 11 min
Bit rate mode : Variable
Bit rate : 4 119 kb/s
Channel(s) : 8 channels
Channel(s)_Original : Object Based
Channel layout : Object Based
Sampling rate : 48.0 kHz
Frame rate : 93.750 FPS (512 SPF)
Bit depth : 24 bits
Stream size : 3.79 GiB (12%)
Title : Fast.Five.2011.EXTENDED.2160p.BluRay.x265.10bit.HDR.DTS-X.7.1-SWTYBLZ
Language : English
Default : Yes
Forced : No
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Dolby Atmos and DTS-X Naming

Post by kim »

You can use this
viewtopic.php?f=5&t=5285&p=43844#p43844

edit the "codecList"

Code: Select all

	'DTS XLL X' : 'DTS X',
	'MLP FBA 16 ch' : 'TrueHD Atmos'
and then, just choose the one you want

Code: Select all

	allStreams.join(' & ').space('.')
	preferredStream.space('.')
	defaultStream.space('.')
	bestBitRate.space('.')
	[bestBitRate, preferredStream].unique().join(' & ').space('.')
	[defaultStream, bestBitRate].unique().join(' & ').space('.')	
CHA0SENG7NE
Posts: 70
Joined: 19 Apr 2017, 22:13

Re: Dolby Atmos and DTS-X Naming

Post by CHA0SENG7NE »

Thanks Kim
Followed the link viewtopic.php?f=5&t=5285&p=43844#p43844

Using version 4 and producing great results, edited the codec list to suit my preference.

Thank you
Post Reply