Audio Information Not Displaying Properly

Any questions? Need some help?
Post Reply
cloak
Posts: 11
Joined: 02 Jun 2013, 05:21

Audio Information Not Displaying Properly

Post by cloak » 17 Dec 2019, 02:59

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

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

Re: Audio Information Not Displaying Properly

Post by rednoah » 17 Dec 2019, 08:39

Are you using the same version of MediaInfo that FileBot is using internally? filebot -script fn:sysinfo will tell.


:arrow: Please copy filebot mediainfo script output, so we can see what FileBot sees:

Code: Select all

filebot -script fn:mediainfo /path/to/file
:idea: Please read the FAQ and How to Request Help.

cloak
Posts: 11
Joined: 02 Jun 2013, 05:21

Re: Audio Information Not Displaying Properly

Post by cloak » 18 Dec 2019, 04:59

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:

Image

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?

kim
Power User
Posts: 855
Joined: 15 May 2014, 16:17

Re: Audio Information Not Displaying Properly

Post by kim » 18 Dec 2019, 11:16

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

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

Re: Audio Information Not Displaying Properly

Post by rednoah » 18 Dec 2019, 12:04

1.
Indeed, ChannelPositions/String2 is what is being used here to add up the {channels} value.

:arrow: 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

:arrow: 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:

Code: Select all

audio[0].FormatCommercial
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
:idea: Please read the FAQ and How to Request Help.

cloak
Posts: 11
Joined: 02 Jun 2013, 05:21

Re: Audio Information Not Displaying Properly

Post by cloak » 19 Dec 2019, 02:16

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}?

kim
Power User
Posts: 855
Joined: 15 May 2014, 16:17

Re: Audio Information Not Displaying Properly

Post by kim » 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() } }

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

Re: Audio Information Not Displaying Properly

Post by rednoah » 19 Dec 2019, 09:10

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. ;)
:idea: Please read the FAQ and How to Request Help.

cloak
Posts: 11
Joined: 02 Jun 2013, 05:21

Re: Audio Information Not Displaying Properly

Post by cloak » 20 Dec 2019, 04:19

Thanks kim! Your alternative works perfectly! Thanks rednoah for your help as well.

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

Re: Audio Information Not Displaying Properly

Post by rednoah » 20 Dec 2019, 13:21

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.
:idea: Please read the FAQ and How to Request Help.

kim
Power User
Posts: 855
Joined: 15 May 2014, 16:17

Re: Audio Information Not Displaying Properly

Post by kim » 20 Dec 2019, 17:22

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

kim
Power User
Posts: 855
Joined: 15 May 2014, 16:17

Re: Audio Information Not Displaying Properly

Post by kim » 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

PRAGMA
Posts: 1
Joined: 21 Dec 2019, 08:13

Re: Audio Information Not Displaying Properly

Post by PRAGMA » 21 Dec 2019, 08:15

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
Image
This ends up in the any's fallback (audio.Channels[0].toDouble(), result is "8.0") but it should end up being "7.1"

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

Re: Audio Information Not Displaying Properly

Post by rednoah » 21 Dec 2019, 08:42

FileBot r6975 will be counting {channels} based on audio.ChannelLayout, but default to {af} is it's all Object Based or plain undefined.
:idea: Please read the FAQ and How to Request Help.

kim
Power User
Posts: 855
Joined: 15 May 2014, 16:17

Re: Audio Information Not Displaying Properly

Post by kim » 21 Dec 2019, 19:27

ok then
version 3 :D

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

Post Reply