Page 1 of 1
Audio Information Not Displaying Properly
Posted: 17 Dec 2019, 02:59
by cloak
My audio bindings aren't displaying the correct details. For example, with the Mediainfo log displaying the following audio details:
The {channels} binding returns 5.1 whereas it is actually 7.1
(The {af} binding does display as 8 ch but I would rather use {channels} to show 7.1)
Also, how can I include Dolby Digital Plus in the renaming (or preferably to show as DD+ )?
Code: Select all
Audio
ID : 2
Format : E-AC-3
Format/Info : Enhanced AC-3
Commercial name : Dolby Digital Plus
Format profile : Blu-ray Disc
Codec ID : A_EAC3
Duration : 2 h 41 min
Bit rate mode : Constant
Bit rate : 1 536 kb/s
Channel(s) : 8 channels
Channel layout : L R C LFE Ls Rs Lb Rb
Sampling rate : 48.0 kHz
Frame rate : 31.250 FPS (1536 SPF)
Compression mode : Lossy
Stream size : 1.73 GiB (7%)
Title : DDP 7.1 @ 1536 kbps
Language : English
Service kind : Complete Main
Default : Yes
Forced : No
Re: Audio Information Not Displaying Properly
Posted: 17 Dec 2019, 08:39
by rednoah
Are you using the same version of MediaInfo that FileBot is using internally?
filebot -script fn:sysinfo will tell.

Please copy filebot mediainfo script output, so we can see what FileBot sees:
Code: Select all
filebot -script fn:mediainfo /path/to/file
Re: Audio Information Not Displaying Properly
Posted: 18 Dec 2019, 04:59
by cloak
I am using MediaInfo 19.09. FileBot is using MediaInfo 18.12.
Not sure how to do the script but hopefully the GUI method provides the information needed:
I notice the ChannelPositions/String2 of 3/2/0.1 may be where FileBot is pulling the 5.1 from. What is this information referring to?
Re: Audio Information Not Displaying Properly
Posted: 18 Dec 2019, 11:16
by kim
ChannelPositions/String2 is used yes
MediaInfo is the problem here.... update it if you can or report the file to MediaInfo
btw: you can test file here:
https://mediaarea.net/MediaInfoOnline
Re: Audio Information Not Displaying Properly
Posted: 18 Dec 2019, 12:04
by rednoah
1.
Indeed,
ChannelPositions/String2 is what is being used here to add up the
{channels} value.

You can try the latest beta, which bundles a more recent libmediainfo, to see if it works better with the latest and greatest:
viewtopic.php?t=1609

Alternatively, you can use
{af} which will give a value of
8ch based on the
Channel(s) field.
2.
I see that
Dolby Digital Plus is available via MediaInfo, so you can access it for Audio Stream #1 like so:
If you wanna tag files with
DD+ if any audio stream matches, then you can do that like so:
Code: Select all
audio.FormatCommercial =~ /Dolby Digital Plus/ ? /DD+/ : null
Re: Audio Information Not Displaying Properly
Posted: 19 Dec 2019, 02:16
by cloak
Unfortunately FileBot 4.9 also is using ChannelPositions/String2 to add up the channels to 5.1.
My logs and the information from
https://mediaarea.net/MediaInfoOnline does not show the ChannelPositions/String2 field at all. Can FileBot ignore ChannelPositions/String2 and pull the information from another field for {channels}?
Re: Audio Information Not Displaying Properly
Posted: 19 Dec 2019, 05:08
by kim
I made an alternative... using e.g. 'Front: L C R, Side: L R, LFE' instead of '3/2/0.1'
Code: Select all
{ any{ audio.ChannelPositions*.replaceAll(/Front:|Side:|Back:|Wide:|Object Based|,/).findAll()*.replaceAll(/LFE/, '0.1')*.replaceAll(/L|C|R/, '1')*.split().collect{it*.toDouble().sum() }.max() } { audio.Channels*.toDouble().max() } }
Re: Audio Information Not Displaying Properly
Posted: 19 Dec 2019, 09:10
by rednoah
cloak wrote: ↑19 Dec 2019, 02:16
Can FileBot ignore ChannelPositions/String2 and pull the information from another field for {channels}?
Is the information we need available or encoded in some way in another field? If
ChannelPositions contains the information you need then @kim already has a solution for you.

Re: Audio Information Not Displaying Properly
Posted: 20 Dec 2019, 04:19
by cloak
Thanks kim! Your alternative works perfectly! Thanks rednoah for your help as well.
Re: Audio Information Not Displaying Properly
Posted: 20 Dec 2019, 13:21
by rednoah
kim wrote: ↑19 Dec 2019, 05:08
I made an alternative... using e.g. 'Front: L C R, Side: L R, LFE' instead of '3/2/0.1'
Code: Select all
{ any{ audio.ChannelPositions*.replaceAll(/Front:|Side:|Back:|Wide:|Object Based|,/).findAll()*.replaceAll(/LFE/, '0.1')*.replaceAll(/L|C|R/, '1')*.split().collect{it*.toDouble().sum() }.max() } { audio.Channels*.toDouble().max() } }
@kim Do you think this approach is better than adding up
ChannelPositions/String2 or are there any pitfalls you can think of that might make it work less well? Because if this approach generally works better, then maybe changing the internal implementation for
{channels} makes sense.
Re: Audio Information Not Displaying Properly
Posted: 20 Dec 2019, 17:22
by kim
I dont' know how it's generated, but my guess is after looking at this that "ChannelLayout" is the primary (base) for Channel(s), Channel(s)/String, ChannelPositions, ChannelPositions/String2 ?
https://sourceforge.net/p/mediainfo/dis ... /959f2a6b/
You can ask Jerome Martinez how it works:
https://sourceforge.net/u/zenitram/profile/
so maybe this is better ?
Code: Select all
{ any{ audio.ChannelLayout*.replaceAll(/Object Based/)*.split()*.collect{ it.replace(/LFE/, '0.1').replaceFirst(/(\b(?:L|R|C)(?:b+|s+|w+)?\b)/, '1').toDouble() }.findAll()*.sum().max()}{ audio.Channels*.toDouble().max() } }
but then again... WEIRD
Channel(s) 2
Channel(s)/String 2 channels
ChannelPositions Front: L R
ChannelPositions/String2 12/1/0.1
ChannelLayout ? Cb LFE
btw: 2 ch is correct
+
Channel(s) 8
Channel(s)/String 8 channels
Channel(s)_Original Object Based
Channel(s)_Original/String Object Based
ChannelPositions Object Based
ChannelPositions/String2 Object Based
ChannelLayout Object Based
EDIT:
https://mediaarea.net/AudioChannelLayout
Re: Audio Information Not Displaying Properly
Posted: 20 Dec 2019, 18:55
by kim
version 2
Code: Select all
{ any{ audio.ChannelLayout*.replaceAll(/Object Based/)*.split()*.collect{ it.replace(/LFE/, '0.1').replaceFirst(/(\b(?:L|R|C)(?:b+|s+|w+)?\b)/, '1').toDouble() }*.sum().collect{ it == null ? audio.findAll{ it.ChannelLayout == /Object Based/ }.Channels*.replace(/8/,'7.1')*.replace(/6/,'5.1')[0] + ' (Objs)' : it }[0] }{ audio.Channels[0].toDouble() } }
e.g. output
7.1 (Objs)
5.1
2.0
Re: Audio Information Not Displaying Properly
Posted: 21 Dec 2019, 08:15
by PRAGMA
kim wrote: ↑20 Dec 2019, 18:55
version 2
Code: Select all
{ any{ audio.ChannelLayout*.replaceAll(/Object Based/)*.split()*.collect{ it.replace(/LFE/, '0.1').replaceFirst(/(\b(?:L|R|C)(?:b+|s+|w+)?\b)/, '1').toDouble() }*.sum().collect{ it == null ? audio.findAll{ it.ChannelLayout == /Object Based/ }.Channels*.replace(/8/,'7.1')*.replace(/6/,'5.1')[0] + ' (Objs)' : it }[0] }{ audio.Channels[0].toDouble() } }
e.g. output
7.1 (Objs)
5.1
2.0

This ends up in the any's fallback (audio.Channels[0].toDouble(), result is "8.0") but it should end up being "7.1"
Re: Audio Information Not Displaying Properly
Posted: 21 Dec 2019, 08:42
by rednoah
FileBot r6975 will be counting {channels} based on audio.ChannelLayout, but default to {af} is it's all Object Based or plain undefined.
Re: Audio Information Not Displaying Properly
Posted: 21 Dec 2019, 19:27
by kim
ok then
version 3
just replace the '0' in "def au0 = 0" to change audio channel
Code: Select all
{
def au0 = 0; def ch0 = audio.Channels[au0]?.toInteger();
any{ audio.ChannelLayout*.replaceAll(/Object Based/)*.split()*.collect{ it.replace(/LFE/, '0.1').replaceFirst(/(\b(?:L|R|C)(?:b+|s+|w+)?\b)/, '1').toDouble() }*.sum().collect{ it == null ? audio.findAll{ it.ChannelLayout == /Object Based/ }.Channels*.replace(/8/,'7.1')*.replace(/6/,'5.1')[au0] + ' (Objs)' : it }[au0] }
{audio.Title[au0].match(/\d\.\d/)}
{ ch0 >= 6 ? (ch0 - 1 + 0.1) : ch0.toDouble() }
}
@rednoah
it looks like "audio.Title" often has the channels info