Kodi Community Forum

Full Version: Possible to convert audio bit depth?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've installed LibreElec 8.2.5 on a PC system with Kodi 17.6, and it's all working okay. The DAC I'm using has some limits that would require a 7.1 audio track to be 16 bit 44.1 kHz. It plays 5.1 in 24 bit 48 kHz, but will only do 7.1 in 16 bit 44.1 kHz.

I've set the audio output to fixed at 44.1 kHz. This works, but it ends up being mixed down to 5.1, as I assume the audio is still at 24 bit. Is it possible to force the bit depth to 16 bit?
Post your Debug Log please first. Showing the different playbacks.
I've posted a log at cuhumipuce (paste)
The audio device I'm using is the Gigabyte HD+ on device 7 connected via USB using it's analogue outputs.

The files I played were:
a 5.1 24 bit 48k flac file (it calls out each channel by number in it's channel)
a 7.1 24 bit 48k flac file (it calls out each channel by number in it's channel)
a 5.1 DTS-HD Master movie (Gravity)
a 7.1 Dolby TrueHD  movie (Gravity)

The dac has LEDs for each channel on the front, so I can see which ones are being used. Only 5.1 was used.
I don't know if I have a 16 bit 7.1 file to play.
From your log:
Quote:21:15:56.361 T:140653311919872    INFO: CActiveAE::ApplySettings - Forcing samplerate to 44100
21:15:56.362 T:140653303527168    INFO: CActiveAESink::OpenSink - initialize sink
21:15:56.362 T:140653303527168   DEBUG: CActiveAESink::OpenSink - trying to open device ALSA:@:CARD=HD,DEV=0
21:15:56.362 T:140653303527168    INFO: CAESinkALSA::Initialize - Attempting to open device "@:CARD=HD,DEV=0"
21:15:56.374 T:140653303527168    INFO: CAESinkALSA::Initialize - Opened device "surround71:CARD=HD,DEV=0"
21:15:56.375 T:140653303527168    INFO: CAESinkALSA::InitializeHW - Your hardware does not support AE_FMT_FLOAT, trying other formats
21:15:56.375 T:140653303527168    INFO: CAESinkALSA::InitializeHW - Using data format AE_FMT_S16NE
21:15:56.375 T:140653303527168   DEBUG: CAESinkALSA::InitializeHW - Request: periodSize 2205, bufferSize 8820
21:15:56.382 T:140653303527168   DEBUG: CAESinkALSA::InitializeHW - Got: periodSize 2205, bufferSize 8820
21:15:56.382 T:140653303527168   DEBUG: CAESinkALSA::InitializeHW - Setting timeout to 200 ms
21:15:56.382 T:140653303527168   DEBUG: CAESinkALSA::GetChannelLayout - Input Channel Count: 8 Output Channel Count: 8
21:15:56.382 T:140653303527168   DEBUG: CAESinkALSA::GetChannelLayout - Requested Layout: FL,FR,FC,LFE,BL,BR,SL,SR
21:15:56.382 T:140653303527168   DEBUG: CAESinkALSA::GetChannelLayout - Got Layout: FL,FR,SL,SR,FC,LFE,FLOC,FROC (ALSA: FL FR SL SR FC LFE FLC FRC)
21:15:56.382 T:140653303527168   DEBUG: CActiveAESink::OpenSink - ALSA Initialized:
21:15:56.382 T:140653303527168   DEBUG:   Output Device : GIGAPort HD+
21:15:56.382 T:140653303527168   DEBUG:   Sample Rate   : 44100
21:15:56.382 T:140653303527168   DEBUG:   Sample Format : AE_FMT_S16NE
21:15:56.382 T:140653303527168   DEBUG:   Channel Count : 8
21:15:56.382 T:140653303527168   DEBUG:   Channel Layout: FL,FR,SL,SR,FC,LFE,FLOC,FROC
21:15:56.382 T:140653303527168   DEBUG:   Frames        : 2205
21:15:56.382 T:140653303527168   DEBUG:   Frame Size    : 16

_always_ the 7.1 profile is opened. Looks like kodi is forced to 7.1 and 44.1 khz. Why?
I've set the audio output to fixed at 44.1 kHz. The DAC can only do 7.1 at 16 bit 44.1 kHz, but can do 5.1 at 24 bit 48 kHz. That's why I'm wondering if it's possible to convert the bit depth down to 16 bit so I can get 7.1.

Is it something that could be done in the ALSA config if Kodi can't?
Let me ask again.

What happens if you don't force kodi to 44.1 khz, but keep it on "Best Match" and set speakers to 7.1.

Can you post a log with that setting, please?
Here's another log with audio set to best match. The result was still only 5.1.

xiketajomo (paste)
Speakers were still at 7.1
I see:

Quote:21:35:33.843 T:140443649734400    INFO: CActiveAESink::OpenSink - initialize sink
21:35:34.060 T:140443649734400   DEBUG: CActiveAESink::OpenSink - trying to open device ALSA:@:CARD=HD,DEV=0
21:35:34.060 T:140443649734400    INFO: CAESinkALSA::Initialize - Attempting to open device "@:CARD=HD,DEV=0"
21:35:34.071 T:140443649734400    INFO: CAESinkALSA::Initialize - Opened device "surround51:CARD=HD,DEV=0"
21:35:34.072 T:140443649734400    INFO: CAESinkALSA::InitializeHW - Your hardware does not support AE_FMT_FLOAT, trying other formats
21:35:34.072 T:140443649734400   ERROR: CAESinkALSA::InitializeHW - Unable to find a suitable output format
21:35:34.072 T:140443649734400   DEBUG: CActiveAESink::OpenSink - trying to open device ALSA:@
21:35:34.072 T:140443649734400    INFO: CAESinkALSA::Initialize - Attempting to open device "@"
21:35:34.079 T:140443649734400    INFO: CAESinkALSA::Initialize - Opened device "surround51"
21:35:34.079 T:140443649734400    INFO: CAESinkALSA::InitializeHW - Unable to open the required number of channels
21:35:34.079 T:140443649734400    INFO: CAESinkALSA::InitializeHW - Your hardware does not support AE_FMT_FLOAT, trying other formats
21:35:34.079 T:140443649734400    INFO: CAESinkALSA::InitializeHW - Using data format AE_FMT_S32NE
21:35:34.080 T:140443649734400   DEBUG: CAESinkALSA::InitializeHW - Request: periodSize 2400, bufferSize 9600
21:35:34.080 T:140443649734400   DEBUG: CAESinkALSA::InitializeHW - Got: periodSize 2400, bufferSize 9600
21:35:34.080 T:140443649734400   DEBUG: CAESinkALSA::InitializeHW - Setting timeout to 200 ms
21:35:34.080 T:140443649734400   DEBUG: CAESinkALSA::GetChannelLayout - Input Channel Count: 6 Output Channel Count: 2
21:35:34.080 T:140443649734400   DEBUG: CAESinkALSA::GetChannelLayout - Requested Layout: FL,FR,FC,LFE,BL,BR
21:35:34.080 T:140443649734400   DEBUG: CAESinkALSA::GetChannelLayout - Got Layout: FL,FR (ALSA: FL FR)

This is a driver bug - and needs proper fixing!

You can manually patch kodi - to only allow 16 bit - but this is not I would suggest. Please contact your upstream to fix the driver.
There is no Linux driver for this device, it just uses the built-in drivers.
Exactly those! (You know, build-in or not - it's a driver). And in Linux World: Stuff can be fixed.