6.0 instead of 5.1 recognized for EAC3

All about user-defined episode / movie format expressions
Post Reply
devster
Posts: 284
Joined: 06 Jun 2017, 22:56

6.0 instead of 5.1 recognized for EAC3

Post by devster » 28 Nov 2017, 22:13

I'm using this test file HERE to test my naming format.
Here it is:

Code: Select all

{ import java.math.RoundingMode
  import net.filebot.Language
  def norm = { it.replaceTrailingBrackets()
                 .replaceAll(/[`´‘’ʻ""“”]/, "'")
                 .replaceAll(/[:|]/, " - ")
                 .replaceAll(/[?]/, "\uFE56")
                 .replaceAll(/[*\s]+/, " ")
                 .replaceAll(/\b[IiVvXx]+\b/, { it.upper() })
                 .replaceAll(/\b[0-9](?i:th|nd|rd)\b/, { it.lower() }) }

  def transl = { it.transliterate("Any-Latin; NFD; NFC; Title") }
  def isLatin = { java.text.Normalizer.normalize(it, java.text.Normalizer.Form.NFD)
                                  .replaceAll(/\p{InCombiningDiacriticalMarks}+/, "") ==~ /^\p{InBasicLatin}+$/ }

allOf
  // { if (vf.minus("p").toInteger() < 1080 || ((media.OverallBitRate.toInteger() / 1000 < 3000) && vf.minus("p").toInteger() >= 720)) { } }
  { if ((media.OverallBitRate.toInteger() / 1000 < 3000) && vf.minus("p").toInteger() >= 720) {
      return "LQ_Movies"
    } else {
      return "Movies"
    } }
  // Movies directory
  // {n.colon(" - ") + " ($y, $director)"}
  { def film_directors = info.directors.sort().join(", ")
    n.colon(" - ") + " ($y; $film_directors)" }
  // File name
  { allOf
    { isLatin(primaryTitle) ? primaryTitle.colon(" - ") : transl(primaryTitle).colon(" - ") }
    {" ($y)"}
    // tags + a few more variants
    { specials = { allOf
                     {tags}
                     { def last = n.tokenize(" ").last()
                       fn.after(/(?i:$last)/).findAll(/(?i:alternate[ ._-]cut|limited)/)*.upperInitial()*.lowerTrail()*.replaceAll(/[._-]/, " ") }
                     .flatten().sort() }
      specials().size() > 0 ? specials().join(", ").replaceAll(/^/, " - ") : "" }
    {" PT $pi"}
    {" ["}
    { allOf
      // Video stream
      { allOf{vf}{vc}.join(" ") }
      { audio.collect { au ->
        def channels = any{ au['ChannelPositions/String2'] }{ au['Channel(s)_Original'] }{ au['Channel(s)'] }
        def ch = channels.replaceAll(/Object\sBased\s\/|0.(?=\d.\d)/, '')
                         .tokenize('\\/').take(3)*.toDouble()
                         .inject(0, { a, b -> a + b }).findAll { it > 0 }
                         .max().toBigDecimal().setScale(1, RoundingMode.HALF_UP).toString()
        def codec = any{ au['CodecID/Hint'] }{ au['Format'] }.replaceAll(/['`´‘’ʻ\p{Punct}\p{Space}]/, '')
        def profile_m = any{au['Format_Profile']}{''} =~ /(?<fp>ES|Pro|MA Core|LC)/
        def profile = profile_m ? profile_m.group('fp') : ''
        return allOf{ch}{allOf{codec}{profile}.join('-')}{Language.findLanguage(au['Language']).ISO3.upperInitial()}
      }.sort().reverse()*.join(" ").join(", ") }
      {source}
      .join(" - ") }
    {"]"}
    { def ed = fn.findAll(/(?i:repack|proper)/)*.upper().join()
      if (ed) { return "." + ed } }
    {"-" + group}
    {subt}
    .join("") }
  .join("/") }
The result is 6.0 EAC3, it seems it's because both ChannelPositions/String2 and Channel(s)_Original are missing so it defaults to the simple 6 channels.
Any help to fix this?

For ease of use here is just the audio part:

Code: Select all

{ import java.math.RoundingMode
  import net.filebot.Language
  audio.collect { au ->
        def channels = any{ au['ChannelPositions/String2'] }{ au['Channel(s)_Original'] }{ au['Channel(s)'] }
        def ch = channels.replaceAll(/Object\sBased\s\/|0.(?=\d.\d)/, '')
                         .tokenize('\\/').take(3)*.toDouble()
                         .inject(0, { a, b -> a + b }).findAll { it > 0 }
                         .max().toBigDecimal().setScale(1, RoundingMode.HALF_UP).toString()
        def codec = any{ au['CodecID/Hint'] }{ au['Format'] }.replaceAll(/['`´‘’ʻ\p{Punct}\p{Space}]/, '')
        def profile_m = any{au['Format_Profile']}{''} =~ /(?<fp>ES|Pro|MA Core|LC)/
        def profile = profile_m ? profile_m.group('fp') : ''
        return allOf{ch}{allOf{codec}{profile}.join('-')}{Language.findLanguage(au['Language']).ISO3.upperInitial()}
      }.sort().reverse()*.join(" ").join(", ") }
I only work in black and sometimes very, very dark grey. (Batman)

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

Re: 6.0 instead of 5.1 recognized for EAC3

Post by rednoah » 28 Nov 2017, 23:19

Here's the MediaInfo for that audio stream:

Code: Select all

Format	E-AC-3
Format/Info	Enhanced Audio Coding 3
Format_Commercial	E-AC-3
Format_Settings_Endianness	Big
InternetMediaType	audio/eac3
CodecID	A_EAC3
Codec	AC3+
Codec/String	AC3+
Codec/Family	AC3
Codec/Info	Dolby Ehanced AC3
Duration	7141690
Duration/String	1 h 59 min
Duration/String1	1 h 59 min 1 s 690 ms
Duration/String2	1 h 59 min
Duration/String3	01:59:01.690
Duration/String5	01:59:01.690
BitRate_Mode	CBR
BitRate_Mode/String	Constant
BitRate	1536000
BitRate/String	1 536 kb/s
Channel(s)	6
Channel(s)/String	6 channels
ChannelPositions	Front: L C R, Side: L R, LFE
ChannelLayout	L C R LFE Ls Rs
SamplesPerFrame	256
SamplingRate	48000
SamplingRate/String	48.0 kHz
FrameRate	187.500
FrameRate/String	187.500 FPS (256 SPF)
Compression_Mode	Lossy
Compression_Mode/String	Lossy
Delay	0
Delay/String3	00:00:00.000
Delay_Source	Container
Delay_Source/String	Container
Video_Delay	0
Video_Delay/String3	00:00:00.000
Video0_Delay	0
Video0_Delay/String3	00:00:00.000
StreamSize	1371204480
StreamSize/String	1.28 GiB
StreamSize/String1	1 GiB
StreamSize/String2	1.3 GiB
StreamSize/String3	1.28 GiB
StreamSize/String4	1.277 GiB
ServiceKind	CM
ServiceKind/String	Complete Main
Default	Yes
Default/String	Yes
Forced	No
Forced/String	No
bsid	16
dialnorm	-27
dialnorm/String	-27 dB
compr	-0.28
compr/String	-0.28 dB
acmod	7
lfeon	1
dialnorm_Average	-27
dialnorm_Average/String	-27 dB
dialnorm_Minimum	-27
dialnorm_Minimum/String	-27 dB
dialnorm_Maximum	-27
dialnorm_Maximum/String	-27 dB
compr_Average	-0.32
compr_Average/String	-0.32 dB
compr_Minimum	-1.80
compr_Minimum/String	-1.80 dB
compr_Maximum	1.94
compr_Maximum/String	1.94 dB
No idea how I'd guess 5.1 from that instead of 6.0 because it could be either. Unless you assume that 6 channels is always 5.1 which you could do in your format with a simple replacement.
:idea: Please read the FAQ and How to Request Help.

devster
Posts: 284
Joined: 06 Jun 2017, 22:56

Re: 6.0 instead of 5.1 recognized for EAC3

Post by devster » 28 Nov 2017, 23:56

Oh, now I see, this should be 5.1(side) according to ffprobe.

Code: Select all

    Stream #0:1: Audio: eac3, 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)
I'll see if I can extract it from ChannelLayout, the Ls and Rs seem telling.
Otherwise is there any way to get it from ffprobe itself?
I only work in black and sometimes very, very dark grey. (Batman)

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

Re: 6.0 instead of 5.1 recognized for EAC3

Post by rednoah » 29 Nov 2017, 00:19

No, but if ffprobe works and libmediainfo doesn't, then please report this issue (and the sample file you already have) to the MediaInfo developer.
:idea: Please read the FAQ and How to Request Help.

devster
Posts: 284
Joined: 06 Jun 2017, 22:56

Re: 6.0 instead of 5.1 recognized for EAC3

Post by devster » 29 Nov 2017, 19:13

rednoah wrote:
28 Nov 2017, 23:19
Here's the MediaInfo for that audio stream:

Code: Select all

Format	E-AC-3
Format/Info	Enhanced Audio Coding 3
Format_Commercial	E-AC-3
Format_Settings_Endianness	Big
InternetMediaType	audio/eac3
CodecID	A_EAC3
Codec	AC3+
Codec/String	AC3+
Codec/Family	AC3
Codec/Info	Dolby Ehanced AC3
Duration	7141690
Duration/String	1 h 59 min
Duration/String1	1 h 59 min 1 s 690 ms
Duration/String2	1 h 59 min
Duration/String3	01:59:01.690
Duration/String5	01:59:01.690
BitRate_Mode	CBR
BitRate_Mode/String	Constant
BitRate	1536000
BitRate/String	1 536 kb/s
Channel(s)	6
Channel(s)/String	6 channels
ChannelPositions	Front: L C R, Side: L R, LFE
ChannelLayout	L C R LFE Ls Rs
SamplesPerFrame	256
SamplingRate	48000
SamplingRate/String	48.0 kHz
FrameRate	187.500
FrameRate/String	187.500 FPS (256 SPF)
Compression_Mode	Lossy
Compression_Mode/String	Lossy
Delay	0
Delay/String3	00:00:00.000
Delay_Source	Container
Delay_Source/String	Container
Video_Delay	0
Video_Delay/String3	00:00:00.000
Video0_Delay	0
Video0_Delay/String3	00:00:00.000
StreamSize	1371204480
StreamSize/String	1.28 GiB
StreamSize/String1	1 GiB
StreamSize/String2	1.3 GiB
StreamSize/String3	1.28 GiB
StreamSize/String4	1.277 GiB
ServiceKind	CM
ServiceKind/String	Complete Main
Default	Yes
Default/String	Yes
Forced	No
Forced/String	No
bsid	16
dialnorm	-27
dialnorm/String	-27 dB
compr	-0.28
compr/String	-0.28 dB
acmod	7
lfeon	1
dialnorm_Average	-27
dialnorm_Average/String	-27 dB
dialnorm_Minimum	-27
dialnorm_Minimum/String	-27 dB
dialnorm_Maximum	-27
dialnorm_Maximum/String	-27 dB
compr_Average	-0.32
compr_Average/String	-0.32 dB
compr_Minimum	-1.80
compr_Minimum/String	-1.80 dB
compr_Maximum	1.94
compr_Maximum/String	1.94 dB
How did you obtain this output?
I can't figure out a way to dump everything from the CLI tool.
I only work in black and sometimes very, very dark grey. (Batman)

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

Re: 6.0 instead of 5.1 recognized for EAC3

Post by rednoah » 29 Nov 2017, 19:51

1.
I used the GUI. Open MediaInfo inspector, Select All, then Copy. CTRL+A, CTRL+C.

@see viewtopic.php?f=5&t=4285


2.
The mediainfo command-line tool probably has a way to dump all information. AFAIK, the filebot command can't dump raw mediainfo.
:idea: Please read the FAQ and How to Request Help.

Post Reply