Page 1 of 2

Re: E-AC-3 & PS4 audio issue - always force transcode to AAC?

Posted: Mon Jan 06, 2020 6:54 am
by Nadahar
This seems like a bug in UMS to me, it parses the EAC-3 track as AC3 and thus thinks that the PS4 can play it. My prediction is that if you had a file with only EAC-3 track(s), it would fail to play completely unless you used the TRANSCODE folder.

Log excerpt showing the bug (compare the media info information with the "parsing results": Id: 0, Language Code: eng, Audio Codec: AC3):

Code: Select all

  Format: "Matroska"            Duration: 1:40:03.497         Overall Bitrate: 17648538     Cover: No
  FPS: 23.976
  - Video track ID: 1
    Format: "AVC"                 Profile: "[email protected]"          CodecID: "V_MPEG4/ISO/AVC"    Duration: 1:40:03.456
    Bitrate: 16000000             Width: 1920                   Height: 804                   Colorimetry: 4:2:0
    Chroma: 4:2:0                 Matrix Co: BT.709             PAR: 1.000                    DAR: 2.40:1
    Scan Type: Progressive        FPS: 23.976                   Framerate Mode: CFR           RefFrames: 5
    Bit Depth: 8                  Delay: 0                      Delay Source: Container
  - Audio track ID: 2
    Format: "AC-3"                Profile: "E-AC-3+Dep / AC-3"  CodecID: "A_EAC3"             Duration: 1:40:03.488
    BitRate Mode: CBR             Bitrate: 1536000              Language: "en"                Channel(s): 8 / 6
    Samplerate: 48000             Delay: 0                      Delay Source: Container
  - Audio track ID: 3, Title: "Commentary with director Josh Cooley and co-producer Mark Nielsen"
    Format: "AAC"                 Profile: "LC"                 CodecID: "A_AAC-2"            Duration: 1:40:03.488
    Bitrate: 102157               Language: "en"                Channel(s): 2                 Samplerate: 48000
    Delay: 20                     Delay Source: Container
  - Subtitle ID: 4
    Format: "UTF-8"               Language: "en"
  - Subtitle ID: 5, Title: "SDH"
    Format: "UTF-8"               Language: "en"
  - Subtitle ID: 6, Title: "Chinese Simplified and English"
    Format: "ASS"                 Language: "zh"
  - Subtitle ID: 7, Title: "Chinese Simplified"
    Format: "UTF-8"               Language: "zh"
  - Subtitle ID: 8, Title: "Chinese Traditional and English"
    Format: "ASS"                 Language: "zh"
  - Subtitle ID: 9, Title: "Chinese Traditional"
    Format: "UTF-8"               Language: "zh"
  - Subtitle ID: 10
    Format: "UTF-8"               Language: "fr"
  - Subtitle ID: 11
    Format: "UTF-8"               Language: "el"
  - Subtitle ID: 12
    Format: "UTF-8"               Language: "ro"
  - Subtitle ID: 13, Title: "Latin American"
    Format: "UTF-8"               Language: "es"
  - Subtitle ID: 14, Title: "Commentary with director Josh Cooley and co-producer Mark Nielsen"
    Format: "UTF-8"               Language: "en"
  - Subtitle ID: 15, Title: "Commentary with director Josh Cooley and co-producer Mark Nielsen (SDH)"
    Format: "UTF-8"               Language: "en"
  - Subtitle ID: 16, Title: "Commentary with director Josh Cooley and co-producer Mark Nielsen"
    Format: "UTF-8"               Language: "fr"
  - Subtitle ID: 17, Title: "Commentary with director Josh Cooley and co-producer Mark Nielsen"
    Format: "UTF-8"               Language: "es"
TRACE 2020-01-05 13:07:32.328 [HTTPv2 Request Worker 6] net.pms.formats.Format Parsing results for file "Toy.Story.4.2019.1080p.BluRay.DDP7.1.x264-BBQ.mkv": Container: MKV, Size: 13244118647, Video Bitrate: 17648538, Video Tracks: 1, Video Codec: h264, Duration: 1:40:03.497, Video Resolution: 1920 x 804, Display Aspect Ratio: 2.39:1, Scan Type: Progressive, Frame Rate: 23.976, Frame Rate Mode: CFR (CFR), Frame Rate Mode Raw: CFR, Matrix Coefficients: BT.709, AVC Level: 4.1, Audio Tracks: 2 [Id: 0, Language Code: eng, Audio Codec: AC3, Bitrate: 1536000, Channels: 8, Sample Frequency: 48000 Hz], [Id: 1, Language Code: eng, Audio Track Title From Metadata: Commentary with director Josh Cooley and co-producer Mark Nielsen, Audio Codec: AAC-LC, Bitrate: 102157, Channels: 2, Sample Frequency: 48000 Hz], Subtitle Tracks: 14 [Embedded, id: 0, type: SUBRIP, lang: eng], [Embedded, id: 1, type: SUBRIP, subtitles track title from metadata: SDH, lang: eng], [Embedded, id: 2, type: ASS, subtitles track title from metadata: Chinese Simplified and English, lang: chi], [Embedded, id: 3, type: SUBRIP, subtitles track title from metadata: Chinese Simplified, lang: chi], [Embedded, id: 4, type: ASS, subtitles track title from metadata: Chinese Traditional and English, lang: chi], [Embedded, id: 5, type: SUBRIP, subtitles track title from metadata: Chinese Traditional, lang: chi], [Embedded, id: 6, type: SUBRIP, lang: fre], [Embedded, id: 7, type: SUBRIP, lang: gre], [Embedded, id: 8, type: SUBRIP, lang: rum], [Embedded, id: 9, type: SUBRIP, subtitles track title from metadata: Latin American, lang: spa], [Embedded, id: 10, type: SUBRIP, subtitles track title from metadata: Commentary with director Josh Cooley and co-producer Mark Nielsen, lang: eng], [Embedded, id: 11, type: SUBRIP, subtitles track title from metadata: Commentary with director Josh Cooley and co-producer Mark Nielsen (SDH), lang: eng], [Embedded, id: 12, type: SUBRIP, subtitles track title from metadata: Commentary with director Josh Cooley and co-producer Mark Nielsen, lang: fre], [Embedded, id: 13, type: SUBRIP, subtitles track title from metadata: Commentary with director Josh Cooley and co-producer Mark Nielsen, lang: spa], Mime Type: video/x-matroska

Re: E-AC-3 & PS4 audio issue - always force transcode to AAC?

Posted: Mon Jan 06, 2020 10:57 am
by Nadahar
There's no way to transcode only selected tracks - either the whole file is transcoded or it isn't. But, if the parsing worked correctly, this file should have been transcoded for the PS4 exactly because it doesn't support EAC3.

You can modify your renderer configuration to always transcode video files, or a bit better remove AC-3 from "supported", which would mean that both EAC3 and AC3 would be transcoded. But, the proper remedy is for the bug to be fixed.

Re: E-AC-3 & PS4 audio issue - always force transcode to AAC?

Posted: Mon Jan 06, 2020 3:57 pm
by mik_s
I think it would be a good idea for you to be able to define unsupported formats in the config, so for edge cases like this when the parseing dosn't quite get the right result due to the combination of different audio tracks in different formats.
If say we had something like

Code: Select all

unsupported = a:eac3
then anything that had that format would be transcoded.

There is a "StreamExtensions" the config which is taken over by "supported" when mediainfo is set to true.
Makes sense to have an "unsupported" to take over from "TranscodeExtensions" :idea:

I'm guessing the it could be added fairly easily in future versions of UMS as it can use the exact same logic already in place, just adding one extra check.

Re: E-AC-3 & PS4 audio issue - always force transcode to AAC?

Posted: Mon Jan 06, 2020 4:11 pm
by Nadahar
It wouldn't be quite as easy as you seem to think, but it would absolutely be doable. I'm not sure there would be much benefit though, as it is now, everything that isn't "supported" is by definition "unsupported". It doesn't really matter if you define it "one way or the other".

The reason this can't be solved by configuration, is that it's a bug in UMS. This bug didn't use to be there, and I have a strong suspicion that it is caused by changes in MediaInfo (and the way it outputs "multi-layer codecs") and that whoever upgraded the MediaInfo version shipped with UMS didn't check the changes properly.

In fact, I'm pretty sure that if you replace the MediaInfo.DLL file with a MediaInfo version before 18 (I think these changes happened "early" in the 18's, like 18.04 or something like that, but I don't remember exactly), that it will work with the current code.

Re: E-AC-3 & PS4 audio issue - always force transcode to AAC?

Posted: Mon Jan 06, 2020 5:00 pm
by mik_s
I think there would be some benefit having an unsupported tag, especially if setting up a new renderer config and you don't know what is supported, but you do know the odd thing that isn't then you could add it there. or even combine both supported and unsupported into more powerful and simpler config.

maybe you could have something like

Code: Select all

  Supported = f:mkv                                                                          m:video/x-matroska
Unsupported = f:mkv           v:h265                       a:eac3
instead of

Code: Select all

Supported = f:mkv             v:h264|mp4|mpeg2|vp8|vp9     a:mp3|ac3|aac-lc|he-aac|adpcm|dts  m:video/x-matroska
When i was doing one for Movian on my PS3 I could have used somthing like this as it will play just about anything but h265 had to be transcoded as the cpu in the PS3 wasn't fast enough to be watchable. It was a pain trying to write every format in as supported when one line saying h265 was unsupported would have done it.


Anyway back to @knifeyspooney's problem
Just wondering what would happen if track 1 was main audio in E-AC-3, track 2 was the same but in AC3 and track 3 for commentry in AAC-LC. Should the file be transcoded? I would assume the player would automatically pick the next supported track if it didn't recognise the first, which is probably what is happening here. It just happens that there is no fallback track in this case.

I remember DVD's that were similar having one track for surround in some format, one for stereo and another for the commentry, and if the DVD player didn't have support for that type of surround, track 2 would play instead of track 1.

It does look like a bug in the mediainfo allowing it to match though :shock:

Re: E-AC-3 & PS4 audio issue - always force transcode to AAC?

Posted: Mon Jan 06, 2020 6:31 pm
by Nadahar
The bug isn't in MediaInfo, the bug is in UMS in that UMS' code hasn't been updated to match the changes made in MediaInfo.

That said, you can already do "everything except" in the current system, since it uses regex. But, that would mean you'd have to learn some regex to use it ;)

A simple "not containing" is like this: https://www.regextester.com/15
This means that

Code: Select all

v:^(?:(?!h265).)*$
would probably achieve what you want.

edit: The above is probably overly complicated in this case, since it will ensure that the string "h265" is nowhere within the code. But, we know that, in the case of h265, the code IS "h265", so we can get away with just that it's not there in the first position. In addition, I THINK UMS automatically adds the anchors (^ and $), so those can be omitted. Completely untested, I something like this would do it:

Code: Select all

v:(?!h265).

Re: E-AC-3 & PS4 audio issue - always force transcode to AAC?

Posted: Tue Jan 07, 2020 1:05 am
by mik_s
didn't realise that regex was used matching supported formats, I really should have given it a try :D
I have tried a bit of regex to write a rename script for standardising and sorting my videos and found that it is very powerful but it is a bit of a dark art, unless it's something you use on a regular basis it is hard to get your head round it. :?

Re: E-AC-3 & PS4 audio issue - always force transcode to AAC?

Posted: Tue Jan 07, 2020 2:27 am
by Nadahar
Hehe, it isn't really that "black", but it's a lot to remember. I'd say that I use it "semi-frequently", so the things I use often I know without thinking. But, as soon as I move beyond my "comfort zone", I have to look up syntax/codes and test the expressions.

I wrote a small regex tester back in... 2005 I think, that I use to test my expressions. It's a simple program where you can write or paste a regex and a text, and the results are shown below (total match, groups etc). I think it's been helpful over the years, as it has lowered my threshold to use it since I can easily check that they do what I want. These days, there are dozens of online regex testers that anyone can use that does what my program does and more, but that wasn't the case back when I made it.

The thing that usually trick me, is all the different "flavors". Hardly any implementations are exactly equal, when I started using regex'es I was writing Pascal/Delphi using a library that used the "Perl regex rules". Regex'es that work fine there, don't always work with Java's regex engine, so I've had to get used to some of the "Java quirks". Then there are Javascript, PHP, C# and others that have their own quirks/differences, which can make it more painful that simply "knowing regex". So, when choosing an online tester to use, one should make sure that it use the same regex "flavor" that one intends to use the regex for. Most online testers are written in JavaScript, so they often output the results as evaluated by JavaScript.