Kodi Community Forum

Full Version: v2.How to Setup Dolby Atmos, DTS-X, TrueHD, DTS-HD MA, Passthrough On Kodi (Linux)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Updated Guide.. v2
---------------------------------------------

Hopefully this guide should help those users of Linux who are new or unsure on how to enable Dolby Atmos, DTS-X, TrueHD, DTS-HD Master Audio, Passthrough on Linux, this should hopefully work on Debian/Ubuntu and Arch based distributions, this guide will bypass PulseAudio Sound server and temporarily disable the sound server and use ALSA instead without having to make any permanent changes to your system and allow Kodi to Passthrough Dolby Atmos, DTS-X, TrueHD, DTS-HD Master Audio,  to your AV Receiver to decode.

Background story..

So i upgraded my system to the new 20.04 package stack of Ubuntu and straight away i lost my ability to pass-through High definition audio and object based audio, weirdly enough it took me hours to (a. figure out what the actual problem was) and (b. how to resolve it) so let me save you the time and the headache, just follow my guide below and you should hopefully be up and running in no time on the latest Linux distro's, this should hopefully work for the newer 20.04 and above and Ubuntu/Debian and Arch based distro's.
 
Quote:Please make sure before following this guide all your hardware in the chain is capable of passing high definition and object based audio i.e Dolby Atmos, DTS-X, TrueHD, DTS-HD Master Audio.

---------------------------------------------------------------------------
This should work for the following AV Receiver's:
---------------------------------------------------------------------------
  • Denon
  • Marantz
  • Yamaha
  • Onkyo
  • Nad
  • Arcam
  • Anthem
  • Sony
  • Pioneer
  • Trinnov

------------------------------------------------------------------------------
Creating a Simple Bash Script & .Desktop File.. (Updated)
------------------------------------------------------------------------------

Creating the #bash script..

First we will add the command below to a bash script to allow us to use ALSA within Linux as PulseAudio at the moment cannot passthrough Dolby Atmos, DTS-X, TrueHD, DTS-HD Master Audio etc,  so now open gedit or your text editor of choice and paste the following below corresponding to your version of Kodi into a new document;

(1) - Kodi - Main Repository package - #bash script code (Older Builds)
  • Krypton v17

Code:
#!/bin/bash
AE_SINK=ALSA kodi
 

(2) - Kodi - Main Repository package - #bash script code (Newer Builds)
 
  • Leia v18 > Matrix v19 > Nexus v20

Code:
#!/bin/bash
systemctl --user stop pulseaudio.socket

systemctl --user stop pulseaudio.service
KODI_AE_SINK=ALSA kodi
systemctl --user start pulseaudio.socket

systemctl --user start pulseaudio.service

(3) - Kodi - Flatpak package - #bash script code (Latest Stable)

- This new bash script code should work on any of the latest stable versions
  Of the Kodi Flatpak packages Installed in the default directory on any distro. 

- Quick Tip: If your using a Kodi Flatpak package on Fedora change all instances of pulseaudio in the script to pipewire


Code:
#!/bin/bash
systemctl --user stop pulseaudio.socket

systemctl --user stop pulseaudio.service
KODI_AE_SINK=ALSA /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=kodi tv.kodi.Kodi
systemctl --user start pulseaudio.socket

systemctl --user start pulseaudio.service
 
Quote:Note: For Kodi 18 (Leia) and above PulseAudio sound server will now temporarily be suspended and block access to other audio devices while ALSA is being used for kodi in the new updated bash script. But Pulseaudio sound server will be re-established once you exit kodi, Be warned as this may interfere with your Desktop sounds while using Kodi.
 

Now save this to your /home folder as kodi.sh

Now right click on this file and go to properties then permissions and check  the box allow executing file as a program


Creating the .desktop file..
 
Quote:You must change *USER* in the EXEC= line to your username and remember to change the *FOLDER/FILE PATH* to the location of your folder or file where the script is located and also do the same if you want to save it to a different location for example, or it wont work.

Example = Exec=/home/myusername/kodi-custom/kodi.sh

Now make another new text file using your text editor and paste this in to the file

Code:
[Desktop Entry]
Type=Application
Exec=/home/*USER*/*FOLDER/FILE PATH*/kodi.sh
Terminal=False
Name=Custom Kodi launcher
Comment=Any comment you want here
Icon=/path/to/icon/you/want

Now Save it and name it as whatever and where ever you like but end the file name with .desktop

Now right click this file and go to properties then permissions and check allow executing file as a program

-------------------------------------------------------------------
Setup: Kodi.. Part B
-------------------------------------------------------------------

Now to finish off the rest of the setup we need to change the following settings in Kodi;
 
Quote:Make sure you toggle off Sync Playback to Display otherwise you wont be able to Allow Passthrough.
 
  1. Audio Output Device = Change this to your AV Receiver .. i.e Denon, Yamaha, Marantz, etc.
  2. Output Configuration = Best or Optimized your choice
  3. Allow Passthrough = Toggle this to On
  4. Passthrough Output Device = Same as your Receiver

-------------------------------------------------------------------------
Please see below how to change these settings: (Click Image to Enlarge)
-------------------------------------------------------------------------

Image
-------------------------------------------------------------------------
Conclusion..
-------------------------------------------------------------------------

Hopefully If everything went well you should now be able to Passthrough  Dolby Atmos, DTS-X, TrueHD, DTS-HD Master Audio, on Linux.
Cracking guide [emoji106]

From what you've written this is for GUI Linux installs right?

I run Linux as the host OS but without any gui/desktop (headless) and removed pulse from the system...then all else use set up as per your vid

In my instance it looks like I don't need to do anything else specifically for 20.04...does that sound about right?
Shouldn't the number of channels be set to 5.1 or 7.1 etc specially if your receiver does not support a passthrough format. As otherwise kodi would downmix to 2.0 instead of playing at 5.1 or 7.1 when not passing through
No I don't think that's true..the official Kodi wiki guidance states 2.0

Code:
Passthrough Mode Used if you want to passthrough (bitstream) AC3, DTS, and EAC3 to an AVR or other device. In order to allow passthrough to work with PulseAudio then it MUST be set to use a 2.0 channel configuration, despite the 2.0 setting this will still allow 5.1 audio from AC3, DTS, and EAC3.

PulseAudio (wiki)

...sorry just noted you said if you are not enabling passthru, seems to me the guide posted is worded to be specifically about passthru
(2020-08-11, 20:42)littlejeem Wrote: [ -> ]No I don't think that's true..the official Kodi wiki guidance states 2.0
Code:
Passthrough Mode Used if you want to passthrough (bitstream) AC3, DTS, and EAC3 to an AVR or other device. In order to allow passthrough to work with PulseAudio then it MUST be set to use a 2.0 channel configuration, despite the 2.0 setting this will still allow 5.1 audio from AC3, DTS, and EAC3.

PulseAudio (wiki)

...sorry just noted you said if you are not enabling passthru, seems to me the guide posted is worded to be specifically about passthru

Some older receivers and soundbars don't support all passthrough formats but the receiver still supports 5.1 audio so down converting them to 2.0 feels wrong but I am not an expert so asked what would be the best option then
Not an expert...you and me both! Does the guide I linked not help?

I'm lucky enough to have an amp that will work with the passthru options, so I've not had to mess much other than discovering I would be best removing pulseaudio and leaving at 2.0.

There is a table in the guide that lays out the configurations availiable for different scenarios...worth a read?
Guys, don't confuse all the things or this howto won't be usable anymore.

This howto here suspends / removes pulseaudio, so that ALSA can be used. The wiki linked talks about using pulseaudio and its limited PT capabilities, it especially talks about "pulseaudio settings" out side of kodi.

If you use ALSA with an HDMI output to an AVR that can do multi-channel pcm, set the PCM speakers to 5.1 or 7.1 whatever you need. If you set these to 2.0 with disabled Dolby Transcoding, kodi will actually output only stereo if it would play TrueHD with your AVR not supporting it - for DTS-HD-MA, the DTS core would be used. Choose all the sound codecs you can passthrough (DTS, AC3, etc.).

If you AVR does not support multi channel pcm and no dts-hd, truehd, etc. - set the speakers to 2.0 and enable the Dolby Transcoding option.

For pulseaudio that's different:
In order for pulseaudio itself (outside of kodi, not related to kodi), pulseaudio needs to be configured to 2.0 channels, else its AC3, DTS, EAC3 won't work - this is a pulseaudio limitation. They worked on dts-hd, truehd - but never finished it.

The howto posted here focusses on ALSA by removing / stopping the PA session.

So - please - I know it's complicated but don't throw everything in from different sources with different goals.

For pulseaudio I would plain suggest to not use PT at all. It's a sound server with the goal to mix all sounds from your system. If you never the less want to use it, in kodi choose 2.0 (as you configured pulseaudio for stereo only anywway outside of kodi) and enable the codes you can do, e.g. AC3, DTS, EAC3.

That's it.
(2020-08-11, 19:46)littlejeem Wrote: [ -> ]Cracking guide [emoji106]

From what you've written this is for GUI Linux installs right?

I run Linux as the host OS but without any gui/desktop (headless) and removed pulse from the system...then all else use set up as per your vid

In my instance it looks like I don't need to do anything else specifically for 20.04...does that sound about right?
That is correct this guide targets the GUI Install of Linux however you can still use the bash script on a header-less install as it only suspends/stops pulse-audio while using kodi, If you don't have pulse-audio installed and have ALSA installed then it should just default to ALSA in which case yes Part B will be fine for you to follow on the 20.04 package stack.

Hope this helps Smile
(2020-08-12, 19:56)streamlove55 Wrote: [ -> ]
(2020-08-11, 19:46)littlejeem Wrote: [ -> ]Cracking guide [emoji106]

From what you've written this is for GUI Linux installs right?

I run Linux as the host OS but without any gui/desktop (headless) and removed pulse from the system...then all else use set up as per your vid

In my instance it looks like I don't need to do anything else specifically for 20.04...does that sound about right?
That is correct this guide targets the GUI Install of Linux however you can still use the bash script on a header-less install as it only suspends/stops pulse-audio while using kodi, If you don't have pulse-audio installed and have ALSA installed then it should just default to ALSA in which case yes Part B will be fine for you to follow on the 20.04 package stack.

Hope this helps Smile
Mazin! Thanks
Newbie here trying to Atmos to my Sonos Arc.  Here is my setup 

[Kodi/ubuntu on a Intel Nuc] > 4 Port HDMI Switch> TV.  Will this work on my current system?
(2020-09-17, 23:10)park13 Wrote: [ -> ]Newbie here trying to Atmos to my Sonos Arc.  Here is my setup 

[Kodi/ubuntu on a Intel Nuc] > 4 Port HDMI Switch> TV.  Will this work on my current system?

Yes.. the guide will work as long as all your hardware in the chain supports Dolby Atmos.
(2020-09-22, 02:32)streamlove55 Wrote: [ -> ]
(2020-09-17, 23:10)park13 Wrote: [ -> ]Newbie here trying to Atmos to my Sonos Arc.  Here is my setup 

[Kodi/ubuntu on a Intel Nuc] > 4 Port HDMI Switch> TV.  Will this work on my current system?

Yes.. the guide will work as long as all your hardware in the chain supports Dolby Atmos.
THANK YOU
(2020-09-22, 02:32)streamlove55 Wrote: [ -> ] 

Thank you very much for this guide! This works well for me on a Mint distribution too. Also it solves the problem, when I use to have PulseAudio active, not enabling the passthrough mode when other applications had audio hooks left open.
(2020-09-22, 02:32)streamlove55 Wrote: [ -> ]
(2020-09-17, 23:10)park13 Wrote: [ -> ] 
Yes.. the guide will work as long as all your hardware in the chain supports Dolby Atmos.
Thanks for that...  Laptop - Philips (HDMI) - Pioneer (coax). But DTS does't show up on AVR. I have to covert DTS stream into DD via Kodi.  Nevertheless, DD works fine.
@streamlove55... Wow, just what the doctor ordered. I have run Windows for ages with Kodi, but switched to Linux today just because (I switched a few years ago, then went back. In IT for a long time, so like switching when I get bored... keeps the brain working).

Now, this computer is solely a mediapc.

I would prefer to remove pulseaudio altogether (never will use desktop sounds) and run ALSA from boot. I don't want to run a bash script starting Kodi.

Do you think it is possible to do that? I haven't really looked into yet other than read that is you stop PulseAudio, it will auto restart. Also, if you do remove PulseAudio, ALSA should automatically become default.

Something I will try, but thought if anyone had experience, it would be good to know before hand.

Thanks All.
Rob
Pages: 1 2 3 4