Channels information doesn't seem available

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

Channels information doesn't seem available

Post by devster » 17 Mar 2018, 23:24

I'm starting to notice that with my format a lot of E-AC3 files don't get renamed as 5.1 but as 6.0, which seems kind of weird.
Format for reference below (minimum for audio):

Code: Select all

{ import java.math.RoundingMode
  import net.filebot.Language

def isEng = any{audio.language ==~ /en/}{true}

def audioClean = { it.replaceAll(/[\p{Pd}\p{Space}]/, ' ').replaceAll(/\p{Space}{2,}/, ' ') }
              // map Codec + Format Profile
def mCFP = [ "AC3" : "AC3",
             "AC3+" : "E-AC3",
             "AAC LC LC" : "AAC-LC",
             "AAC LC SBR HE AAC LC": "HE-AAC" ]
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 = audioClean(any{ au['CodecID/String'] }{ au['Codec/String'] }{ au['Codec'] })
	def format = any{ au['CodecID/Hint'] }{ au['Format'] }
	def format_profile = { if ( au['Format_Profile'] != null) audioClean(au['Format_Profile']) else '' }
	def combined = allOf{codec}{format_profile}.join(' ')
	def stream = allOf
		{ ch }
		{ mCFP.get(combined, format) }
		{ Language.findLanguage(au['Language']).ISO3.upperInitial() }
	return stream }*.join(" ").join(", ") }
However I also noticed that the ChannelPositions binding doesn't seem available in FileBot in the numerical form (Channel positions: 3/2/0.1) which is what I rely on in my format.
Below the output of mediainfo -Full <file> (with MediaInfoLib - v17.12):

Code: Select all

Audio
Count                                    : 296
Count of stream of this kind             : 1
Kind of stream                           : Audio
Kind of stream                           : Audio
Stream identifier                        : 0
StreamOrder                              : 1
ID                                       : 2
ID                                       : 2
Unique ID                                : 10661863499529789102
Format                                   : E-AC-3
Format/Info                              : Enhanced Audio Coding 3
Commercial name                          : E-AC-3
Format settings, Endianness              : Big
Internet media type                      : audio/eac3
Codec ID                                 : A_EAC3
Codec                                    : AC3+
Codec                                    : AC3+
Codec/Family                             : AC3
Codec/Info                               : Dolby Ehanced AC3
Duration                                 : 1776984
Duration                                 : 29 min 36 s
Duration                                 : 29 min 36 s 984 ms
Duration                                 : 29 min 36 s
Duration                                 : 00:29:36.984
Duration                                 : 00:29:36.984
Bit rate mode                            : CBR
Bit rate mode                            : Constant
Bit rate                                 : 640000
Bit rate                                 : 640 kb/s
Channel(s)                               : 6
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Channel positions                        : 3/2/0.1
ChannelLayout                            : L C R LFE Ls Rs
Samples per frame                        : 256
Sampling rate                            : 48000
Sampling rate                            : 48.0 kHz
Samples count                            : 85295232
Frame rate                               : 187.500
Frame rate                               : 187.500 FPS (256 SPF)
Compression mode                         : Lossy
Compression mode                         : Lossy
Delay                                    : 0
Delay                                    : 00:00:00.000
Delay, origin                            : Container
Delay, origin                            : Container
Delay relative to video                  : 0
Delay relative to video                  : 00:00:00.000
Video0 delay                             : 0
Video0 delay                             : 00:00:00.000
Stream size                              : 142158720
Stream size                              : 136 MiB (20%)
Stream size                              : 136 MiB
Stream size                              : 136 MiB
Stream size                              : 136 MiB
Stream size                              : 135.6 MiB
Stream size                              : 136 MiB (20%)
Proportion of this stream                : 0.20210
Language                                 : en
Language                                 : English
Language                                 : English
Language                                 : en
Language                                 : eng
Language                                 : en
Service kind                             : CM
Service kind                             : Complete Main
Default                                  : Yes
Default                                  : Yes
Forced                                   : No
Forced                                   : No
bsid                                     : 16
dialnorm                                 : -24
dialnorm                                 : -24 dB
compr                                    : -0.28
compr                                    : -0.28 dB
acmod                                    : 7
lfeon                                    : 1
dialnorm_Average                         : -24
dialnorm_Average                         : -24 dB
dialnorm_Minimum                         : -24
dialnorm_Minimum                         : -24 dB
dialnorm_Maximum                         : -24
dialnorm_Maximum                         : -24 dB
dialnorm_Count                           : 867
compr_Average                            : 1.50
compr_Average                            : 1.50 dB
compr_Minimum                            : -0.86
compr_Minimum                            : -0.86 dB
compr_Maximum                            : 5.16
compr_Maximum                            : 5.16 dB
compr_Count                              : 572
compared to what I see from the FileBot GUI (on MacOS if it makes any difference, compared to the mediainfo output from Linux).

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	1734358
Duration/String	28 min 54 s
Duration/String1	28 min 54 s 358 ms
Duration/String2	28 min 54 s
Duration/String3	00:28:54.358
Duration/String5	00:28:54.358
BitRate_Mode	CBR
BitRate_Mode/String	Constant
BitRate	640000
BitRate/String	640 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	138748640
StreamSize/String	132 MiB (21%)
StreamSize/String1	132 MiB
StreamSize/String2	132 MiB
StreamSize/String3	132 MiB
StreamSize/String4	132.3 MiB
StreamSize/String5	132 MiB (21%)
StreamSize_Proportion	0.20919
Language	en
Language/String	English
Language/String1	English
Language/String2	en
Language/String3	eng
Language/String4	en
ServiceKind	CM
ServiceKind/String	Complete Main
Default	Yes
Default/String	Yes
Forced	No
Forced/String	No
bsid	16
dialnorm	-24
dialnorm/String	-24 dB
compr	-0.28
compr/String	-0.28 dB
acmod	7
lfeon	1
dialnorm_Average	-24
dialnorm_Average/String	-24 dB
dialnorm_Minimum	-24
dialnorm_Minimum/String	-24 dB
dialnorm_Maximum	-24
dialnorm_Maximum/String	-24 dB
compr_Average	1.73
compr_Average/String	1.73 dB
compr_Minimum	-3.25
compr_Minimum/String	-3.25 dB
compr_Maximum	4.54
compr_Maximum/String	4.54 dB
Am I missing something?
I only work in black and sometimes very, very dark grey. (Batman)

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

Re: Channels information doesn't seem available

Post by rednoah » 18 Mar 2018, 03:52

1.
Based on this, it should work:

Code: Select all

Channel positions                        : 3/2/0.1
I recommend checking MediaInfo with FileBot, not the mediainfo command-line tool, otherwise we're comparing Apples with Pears if somehow there's a difference:
viewtopic.php?f=5&t=4285

ChannelPositions/String2 doesn't appear as key in what FileBot sees in the last post, so that explains why it doesn't work there. A different file / different version of mediainfo might be the source of the issue here. Please run filebot -script fn:sysinfo and post the output and compare version of MediaInfo.


2.
What is the value of the {channels} binding for your files?

Code: Select all

filebot -mediainfo *.mp4 --format "{fn} ➔ {channels}"
:idea: Please read the FAQ and How to Request Help.

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

Re: Channels information doesn't seem available

Post by devster » 18 Mar 2018, 13:41

1. The output in the second box is the one I see from the FileBot GUI which should be what FileBot sees, the reason I posted is because it seems Mediainfo from CLI can read the line you quoted but Mediainfo in FileBot cannot.
Output of sysinfo:

Code: Select all

FileBot 4.7.14 (r5241)
JNA Native: 5.2.0
MediaInfo: 0.7.73
Apache Commons VFS: [zip, rar]
Chromaprint: 1.4.2
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2018-03-03 (r514)
Groovy: 2.4.12
JRE: Java(TM) SE Runtime Environment 1.8.0_65
JVM: 32-bit Java HotSpot(TM) Client VM
CPU/MEM: 4 Core / 224 MB Max Memory / 10 MB Used Memory
OS: Linux (arm)
Package: PORTABLE
uname: Linux rpi3 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l GNU/Linux

------------------- UPDATE AVAILABLE: FileBot 4.7.19 (r5271) -------------------

Done ヾ(@⌒ー⌒@)ノ
2. Here the outputs:

Code: Select all

$ filebot -mediainfo --format "{fn} ➔  {allOf{audio['ChannelPositions/String2']}{audio['Channel(s)']}{channels}.join(', ')}" <file>
silicon.valley.s01e01.720p.hdtv.x264-killers ➔  [3/2/0.1], [6], 5.1
Silicon.Valley.S03E01.Founder.Friendly.720p.PROPER.AMZN.WEBRip.DD5.1.x264-NTb ➔  [6], 6.0

$ filebot -mediainfo --format "{fn} ➔  {allOf{audio['ChannelPositions']}{audio['ChannelPositions/String2']}{audio['Channel(s)']}{channels}.join(', ')}"
silicon.valley.s01e01.720p.hdtv.x264-killers ➔  [Front: L C R, Side: L R, LFE], [3/2/0.1], [6], 5.1
Silicon.Valley.S03E01.Founder.Friendly.720p.PROPER.AMZN.WEBRip.DD5.1.x264-NTb ➔  [Front: L C R, Side: L R, LFE], [6], 6.0
I only work in black and sometimes very, very dark grey. (Batman)

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

Re: Channels information doesn't seem available

Post by rednoah » 18 Mar 2018, 14:06

I see. Looks like the last one ends up with 6 channels because FileBot doesn't have any other information. Presumably, the next release of FileBot which bundles the next release of MediaInfo will resolve the issue.
:idea: Please read the FAQ and How to Request Help.

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

Re: Channels information doesn't seem available

Post by devster » 18 Mar 2018, 17:22

Apparently there won't be a new release for me. I'm using FileBot mostly on a Raspberry Pi which doesn't have Oracle Java 9 yet, so even after building the jar file I'd be unable to run it.
I only work in black and sometimes very, very dark grey. (Batman)

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

Re: Channels information doesn't seem available

Post by devster » 18 Mar 2018, 17:53

I can confirm that with 17.12 this has been fixed.

Code: Select all

$ filebot -script fn:sysinfo
FileBot 4.7.28 (r5285)
JNA Native: 5.2.0
MediaInfo: 17.12
Apache Commons VFS: [zip, rar]
Chromaprint: 1.4.2
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2018-03-16 (r516)
Groovy: 2.4.13
JRE: Java(TM) SE Runtime Environment 1.8.0_65
JVM: 32-bit Java HotSpot(TM) Client VM
CPU/MEM: 4 Core / 224 MB Max Memory / 9 MB Used Memory
OS: Linux (arm)
Package: PORTABLE
uname: Linux rpi3 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l GNU/Linux
Done ヾ(@⌒ー⌒@)ノ
and the output:

Code: Select all

$ filebot -mediainfo --format "{fn} ➔  {allOf{audio['ChannelPositions']}{audio['ChannelPositions/String2']}{audio['Channel(s)']}{channels}.join(', ')}"
silicon.valley.s01e01.720p.hdtv.x264-killers ➔  [Front: L C R, Side: L R, LFE], [3/2/0.1], [6], 5.1
Silicon.Valley.S03E01.Founder.Friendly.720p.PROPER.AMZN.WEBRip.DD5.1.x264-NTb ➔  [Front: L C R, Side: L R, LFE], [3/2/0.1], [6], 5.1
I'm assuming it's not possible to have FileBot use the version of mediainfo available to the system?
I only work in black and sometimes very, very dark grey. (Batman)

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

Re: Channels information doesn't seem available

Post by rednoah » 19 Mar 2018, 03:13

SNAP and DEB packages will be using Java 9. However, there'll also be a Java 8 compatible release for embedded Linux devices (e.g. Synology NAS) with mostly the latest features.


Please support FileBot for Linux here:
https://www.patreon.com/filebot


You can always replace the library yourself, or you can set -Djna.nosys=false if the library is in the $LD_LIBRARY_PATH by default. It's not officially supported, and it might not work, but I reckon it'll work just fine, since MediaInfo has a very stable API and hasn't changed in years. I just can't be bothered if you end up in DLL hell, or SO hell, or CLASSPATH hell, etc. :lol:
:idea: Please read the FAQ and How to Request Help.

Post Reply