Issues with DTS ES XXCH 6.1 track: v1.16.5 only shows and muxes core 5.1 track?

Everything related to MakeMKV
Post Reply
YourMJK
Posts: 9
Joined: Fri Feb 23, 2018 2:38 pm

Issues with DTS ES XXCH 6.1 track: v1.16.5 only shows and muxes core 5.1 track?

Post by YourMJK »

I'm having issues with a DTS ES XXCH 6.1 track, specifically the first English audio track on a German 2011 Star Wars TPM BD.

If I create a decrypted backup of the disc and open the main .m2ts with mediainfo v21.09 and ffprobe v4.4, this is what they say about the track (note "7 channels" and "6.1"):

Code: Select all

$ mediainfo backup/THE_PHANTOM_MENACE/BDMV/STREAM/00800.m2ts
...
Audio #1
ID                                       : 4352 (0x1100)
Menu ID                                  : 1 (0x1)
Format                                   : DTS ES XXCH
Format/Info                              : Digital Theater Systems
Commercial name                          : DTS-ES Discrete
Codec ID                                 : 130
Duration                                 : 2 h 14 min
Bit rate mode                            : Constant
Bit rate                                 : 768 kb/s
Channel(s)                               : 7 channels
Channel layout                           : C L R Ls Rs Cb LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 93.750 FPS (512 SPF)
Bit depth                                : 24 bits
Compression mode                         : Lossy
Stream size                              : 737 MiB (2%)
...

Code: Select all

$ ffprobe backup/THE_PHANTOM_MENACE/BDMV/STREAM/00800.m2ts
...
  Stream #0:1[0x1100]: Audio: dts (DTS-ES) ([130][0][0][0] / 0x0082), 48000 Hz, 6.1, fltp, 768 kb/s
...

However, in MakeMKV v1.16.5 (and older versions) the main title's first audio track only shows as a single DTS 5.1 track:
MakeMKV screenshot 1
MakeMKV screenshot 1
screenshot1.png (64.62 KiB) Viewed 2286 times
MakeMKV screenshot 2
MakeMKV screenshot 2
screenshot2.png (41.86 KiB) Viewed 2286 times

And after letting MakeMKV mux the MKV from the backup files, mediainfo also only reports "6 channels":

Code: Select all

$ mediainfo Die\ dunkle\ Bedrohung_t02.mkv
...
Audio #1
ID                                       : 2
ID in the original source medium         : 4352 (0x1100)
Format                                   : DTS ES XXCH
Format/Info                              : Digital Theater Systems
Commercial name                          : DTS-ES Discrete
Codec ID                                 : A_DTS
Duration                                 : 2 h 16 min
Bit rate mode                            : Constant
Bit rate                                 : 768 kb/s
Channel(s)                               : 6 channels
Channel(s)_Original                      : 7 channels
ChannelLayout_Original                   : C L R Ls Rs Cs LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 93.750 FPS (512 SPF)
Bit depth                                : 24 bits
Compression mode                         : Lossy
Stream size                              : 748 MiB (2%)
Title                                    : Surround 5.1
Language                                 : English
Default                                  : Yes
Forced                                   : No
Original source medium                   : Blu-ray
...
While ffprobe still says "6.1":

Code: Select all

$ ffprobe Die\ dunkle\ Bedrohung_t02.mkv
...
  Stream #0:1(eng): Audio: dts (DTS-ES), 48000 Hz, 6.1, fltp, 768 kb/s (default)
    Metadata:
      title           : Surround 5.1
      BPS-eng         : 768000
      DURATION-eng    : 02:16:10.922666666
      NUMBER_OF_FRAMES-eng: 766024
      NUMBER_OF_BYTES-eng: 784408576
      SOURCE_ID-eng   : 001100
...

What is going on here?
Is MakeMKV only showing and muxing the 5.1 core of the DTS ES XXCH 6.1 track and ffmpeg/ffprobe is just wrongly detecting "6.1" in the MKV?

Curiously, MKVToolNix v53.0.0 also can't decide how many channels it got.
mkvmerge says "7 channels" for both the MKV and M2TS, while mkvinfo and mkvpropedit say "6 channels".

I just want to correctly label the metadata and know what channel layout to choose when I'm encoding with ffmpeg as AAC.
Thanks.
YourMJK
Posts: 9
Joined: Fri Feb 23, 2018 2:38 pm

Re: Issues with DTS ES XXCH 6.1 track: v1.16.5 only shows and muxes core 5.1 track?

Post by YourMJK »

After countless of (wasted?) hours of research, trial&error with different AAC encoders and testing with AVR and surround speaker setup, here's what I found out, what's my solution and what I recommend for anyone who wants to rip BDs with DTS-ES 6.1 and encode them to AAC.
I know it's a bit off-topic but I don't have a better place to share this right now.


DTS ES XXCH 6.1:
  • The DTS ES XXCH 6.1 is usually the core of the DTS ES XXCH XLL 6.1 (DTS-HD Master Audio 6.1) track, which isn't present on the Star Wars BDs (but are on the LOTR ones!).
  • The track I was referring to really is a 7ch 6.1 track with two side surrounds and one back center.
  • Some software like MakeMKV, mediainfo, mkvinfo and mkvpropedit just either don't handle 6.1 that well, or — what I believe — MakeMKV incorrectly adds 6 as the number of channels in some metadata while muxing which is why these other programs report "6 channels" on the MKV.
AAC, ffmpeg and 6.1:
  • ffmpeg's native "aac" encoder will handle the 6.1 input without error but — and it also does this for "normal" 5.1(side) and 7.1 aka. 7.1(side) inputs! — it encodes the layout as PCE data (which some players/software don't understand/support) and quietly throws away two of the 7 audio channels in the output!
  • ffmpeg's AudioToolbox "aac_at" encoder will handle the 6.1 input as well but it changes the layout to 6.1(side) and also quietly throws away one audio channel in the output! (Ls or Rs I think)
  • ffmpeg's Fraunhofer "libfdk_aac" encoder won't handle 6.1 ("Specified channel layout '6.1' is not supported")
So since 6.1 doesn't seem to be supported very well, no one really has such a setup and there aren't any new media in this format anyway, I decided to either downmix it to 5.1(side) or upmix it to 7.1.
Downmix to 5.1(side) didn't seem too great, since I'd either have to throw away information (the Cb channel) or worry about the problems of adding the Cb signal to Ls and Rs (what proportion? Factor of 0.5 vs. sqrt(2)/2? Will/could Ls and Rs clip if I do this?), so I went with a 7.1 upmix.

6.1->7.1 AAC with ffmpeg:
  • 7.1(front) seems to be (or has been) the standard for AAC instead of 7.1(side)/7.1(rear) so encoder support is also limited here
  • ffmpeg's native "aac" encoder will only encode the 7.1 layout as PCE and put the channels in the 7.1(wide) layout.
  • ffmpeg's AudioToolbox "aac_at" encoder won't handle 7.1 ("Specified channel layout '7.1' is not supported")
  • but ffmpeg's Fraunhofer "libfdk_aac" encoder does support 7.1 and will produce a correct 7.1(side)/7.1(rear) output!
  • I used this ffmpeg audio filter for mapping the Cb to both Lb and Rb:

    Code: Select all

    -af "pan=7.1|FL=FL|FR=FR|FC=FC|LFE=LFE|BL=BC|BR=BC|SL=SL|SR=SR"
Also note: while the center back channel of the English 6.1 audio track in LOTR is mixed "pure" i.e. it only has sound effects and occasionally music, the German one seems have some of the left and right surround channels mixed in with it, so there is also some dialogue reverb and some of their sound effects mixed in. I didn't check other languages or Star Wars.
This another reason I didn't want to mess with a 5.1 downmix.


Not sure if everything here is correct but I don't want to spent anymore time on this.
Hopefully, someone may find this information useful in the future.

Here are some links:
https://forum.videohelp.com/threads/367 ... 6-channels
https://gitlab.com/mbunkus/mkvtoolnix/-/issues/2715
https://ffmpeg.org/ffmpeg-utils.html#toc-Channel-Layout
https://mediaarea.net/AudioChannelLayout
https://forum.doom9.org/archive/index.php/t-172763.html
http://forum.doom9.org/showthread.php?p ... ost1714833
https://forum.videohelp.com/threads/377 ... C-encoding
Post Reply