How do i get Both audio ac with channels data ?

Any questions? Need some help?
Post Reply
Keven07
Posts: 20
Joined: 13 Apr 2020, 08:39

How do i get Both audio ac with channels data ?

Post by Keven07 » 30 Jun 2020, 05:11

using this movie format :

Code: Select all

{n} [{y}] [ {ac} {channels} ] {audioLanguages.name}
Result :

Code: Select all

Sherlock Holmes A Game Of Shadows [2011] [ AAC 2.0 ] [Spanish, English]
but i want movie name look like this :

Code: Select all

Sherlock Holmes A Game Of Shadows [2011] [ Spanish AAC 2.0, English AAC 5.1 ]

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

Re: How do i get Both audio ac with channels data ?

Post by rednoah » 30 Jun 2020, 05:38

You won't be able to rely on built-in bindings for this particular use case.


You can make it work by iterating through each audio stream and reading the properties you want and combining them:
viewtopic.php?t=4285


:!: Basic coding skills required. I'd stick to the built-in bindings to just keep things simple, even if the result isn't exactly what you want.
:idea: Please read the FAQ and How to Request Help.

Keven07
Posts: 20
Joined: 13 Apr 2020, 08:39

Re: How do i get Both audio ac with channels data ?

Post by Keven07 » 30 Jun 2020, 05:52

rednoah wrote:
30 Jun 2020, 05:38
You won't be able to rely on built-in bindings for this particular use case.


You can make it work by iterating through each audio stream and reading the properties you want and combining them:
viewtopic.php?t=4285


:!: Basic coding skills required. I'd stick to the built-in bindings to just keep things simple, even if the result isn't exactly what you want.
thanks for fast reply ;)

at least how can i get both audio ac with channels data like this :

Code: Select all

Sherlock Holmes A Game Of Shadows [2011] [ AAC 2.0, AAC 5.1 ] [Spanish, English]

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

Re: How do i get Both audio ac with channels data ?

Post by rednoah » 30 Jun 2020, 06:08

{channels} will give you the best value across all audio streams. {channels} cannot be used to get individual channel information for individual audio streams. You'll have to access the corresponding MediaInfo properties for that directly.


You can try to extract MediaInfo properties directly as explained above though. This may or may not be easy and may or may not require some degree of coding.


e.g.

Code: Select all

{audio.Format}

Code: Select all

{audio.LanguageString}

Code: Select all

{audio.collect{ it.Format + ' ' + it.LanguageString }}
:idea: Please read the FAQ and How to Request Help.

Keven07
Posts: 20
Joined: 13 Apr 2020, 08:39

Re: How do i get Both audio ac with channels data ?

Post by Keven07 » 30 Jun 2020, 06:41

rednoah wrote:
30 Jun 2020, 06:08
{channels} will give you the best value across all audio streams. {channels} cannot be used to get individual channel information for individual audio streams. You'll have to access the corresponding MediaInfo properties for that directly.


You can try to extract MediaInfo properties directly as explained above though. This may or may not be easy and may or may not require some degree of coding.


e.g.

Code: Select all

{audio.Format}

Code: Select all

{audio.LanguageString}

Code: Select all

{audio.collect{ it.Format + ' ' + it.LanguageString }}
thanks for reply and help.

got it bro

Code: Select all

{audio.collect{ it.Format + ' ' + it.channels + ' ' + it.LanguageString}}
Result :

Code: Select all

Sherlock Holmes A Game Of Shadows [2011] [AAC 2 Spanish, AAC 2 English]

Keven07
Posts: 20
Joined: 13 Apr 2020, 08:39

Re: How do i get Both audio ac with channels data ?

Post by Keven07 » 30 Jun 2020, 09:55

hello rednoah finally figured it out.
I post format code here, if in future anyone need.

format code :

Code: Select all

{n} [{y}] [{ import java.math.RoundingMode
  import net.filebot.Language
  audio.collect {
    def au = it
    def channels = any{ au['ChannelPositions/String2'] }{ au['Channel(s)_Original'] }{ au['Channel(s)'] } 
    def ch = channels.tokenize('\\/')*.toDouble().inject(0, { a, b -> a + b }).findAll { it > 0 }
    max().toBigDecimal().setScale(1, RoundingMode.HALF_UP).toString()
    def codec = any{ au['Format'] }{ au['CodecID/Hint'] }.replaceAll(/['`´‘’ʻ\p{Punct}\p{Space}]/, '')
    return [Language.findLanguage(au['Language']).name.upperInitial(), codec, ch,  ]
  }*.join(" ").join(", ") }]
  
Result :

Code: Select all

Sherlock Holmes A Game Of Shadows [2011] [Spanish AAC 2.0, English AAC 2.0]

Post Reply