v18 PCM 3.0 Output from HDMI
#1
Has anyone successfully managed to output PCM 3.0 (FL / FR / C) from Kodi?

My Arcam receiver plays it as stereo (So no speech) whilst my Marantz receiver does not detect the audio at all. Both receivers work correctly when using a Bluray player and the original disc but I'm not sure where the bug is (Could be the file, the Intel driver or Kodi) so would appreciate if some other people with a 5.1+ setup could try this sample:
https://drive.google.com/file/d/1FBuIA0e...sp=sharing
Reply
#2
(2021-04-24, 11:04)Krobar Wrote: Has anyone successfully managed to output PCM 3.0 (FL / FR / C) from Kodi?

My Arcam receiver plays it as stereo (So no speech) whilst my Marantz receiver does not detect the audio at all. Both receivers work correctly when using a Bluray player and the original disc but I'm not sure where the bug is (Could be the file, the Intel driver or Kodi) so would appreciate if some other people with a 5.1+ setup could try this sample:
https://drive.google.com/file/d/1FBuIA0e...sp=sharing
It doesn't play the Centre channel for me using S/PDIF, just plays FL & FR. Maybe if you post a Debug Log it might give the experts here more info.
Reply
#3
I tried playing that file and my amp showed 2.1 so it was getting three channels, just the centre channel was in the LFE.  Looking at the created log, Kodi appears to not be able to get the channel map details, despite FFmpeg reporting 3 channels to Kodi. Ultimately I ended up with a 4 channel output being opened. FFProbe and mediainfo both reported the three channel layout correctly.  To me, that looks like it might be a bug but I don't know anything about audio so I could well be wrong.  Our only audio dev is really busy with RL at the moment so even if it is, it could be a while before it gets fixed.

Relevant audio part of log.
xml:
2021-04-24 15:33:18.166 T:1513146    INFO <general>: CDVDAudioCodecFFmpeg::GetChannelMap - FFmpeg reported 3 channels, but the layout contains 0 ignoring
2021-04-24 15:33:18.167 T:1513146    INFO <general>: Creating audio stream (codec id: 65536, channels: 3, sample rate: 48000, no pass-through)
2021-04-24 15:33:18.543 T:466713   DEBUG <general>: CActiveAESink::OpenSink - trying to open device ALSA:hdmi:CARD=NVidia,DEV=1
2021-04-24 15:33:18.543 T:466713    INFO <general>: CAESinkALSA::Initialize - Attempting to open device "hdmi:CARD=NVidia,DEV=1"
2021-04-24 15:33:18.555 T:466713    INFO <general>: CAESinkALSA::Initialize - Opened device "hdmi:CARD=NVidia,DEV=1,AES0=0x04,AES1=0x82,AES2=0x00,AES3=0x02"
2021-04-24 15:33:18.555 T:466713    INFO <general>: CAESinkALSA::InitializeHW - Your hardware does not support AE_FMT_FLOAT, trying other formats
2021-04-24 15:33:18.555 T:466713    INFO <general>: CAESinkALSA::InitializeHW - Using data format AE_FMT_S32NE
2021-04-24 15:33:18.555 T:466713   DEBUG <general>: CAESinkALSA::InitializeHW - Request: periodSize 1024, bufferSize 4096
2021-04-24 15:33:18.674 T:466713   DEBUG <general>: CAESinkALSA::InitializeHW - Got: periodSize 1024, bufferSize 4096
2021-04-24 15:33:18.674 T:466713   DEBUG <general>: CAESinkALSA::InitializeHW - Setting timeout to 86 ms
2021-04-24 15:33:18.914 T:466713   DEBUG <general>: CAESinkALSA::GetChannelLayout - Input Channel Count: 3 Output Channel Count: 4
2021-04-24 15:33:18.914 T:466713   DEBUG <general>: CAESinkALSA::GetChannelLayout - Requested Layout: FL, FR, LFE
2021-04-24 15:33:18.914 T:466713   DEBUG <general>: CAESinkALSA::GetChannelLayout - Got Layout: FL, FR, LFE, UNKNOWN1 (ALSA: FL FR LFE UNKNOWN)
2021-04-24 15:33:18.914 T:466713   DEBUG <general>: CActiveAESink::OpenSink - ALSA Initialized:
2021-04-24 15:33:18.914 T:466713   DEBUG <general>:   Output Device : HDA NVidia
2021-04-24 15:33:18.914 T:466713   DEBUG <general>:   Sample Rate   : 48000
2021-04-24 15:33:18.914 T:466713   DEBUG <general>:   Sample Format : AE_FMT_S32NE
2021-04-24 15:33:18.914 T:466713   DEBUG <general>:   Channel Count : 4
2021-04-24 15:33:18.914 T:466713   DEBUG <general>:   Channel Layout: FL, FR, LFE, UNKNOWN1
2021-04-24 15:33:18.914 T:466713   DEBUG <general>:   Frames        : 1024
2021-04-24 15:33:18.914 T:466713   DEBUG <general>:   Frame Size    : 16

 @fritsch If you have time, can you shed any light on this?
Learning Linux the hard way !!
Reply
#4
SPDIF can only serve 2 PCM channels. So no matter what you open with ffmpeg, the result will be downmixed to FL, FR. The only way you can transfer more than 2 channels via SPDIF is using a virtual format like AC3.

Are you sure you mean the SPDIF interface that you are using?
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#5
(2021-05-01, 22:57)fritsch Wrote: SPDIF can only serve 2 PCM channels. So no matter what you open with ffmpeg, the result will be downmixed to FL, FR. The only way you can transfer more than 2 channels via SPDIF is using a virtual format like AC3.

Are you sure you mean the SPDIF interface that you are using?
I'm using HDMI and as explained above both receivers I have play this PCM 3.0 (FL/FR/C) bluray disc over HDMI but Kodi does not work to play this file with either receiver.

I tried to look into this today, I get the same layout contains 0 message as @black_eagle 

It seems that the channel layout is not being read/handled by Kodi/FFMPEG. I think the channel layout is supported by FFMPEG although the naming seems odd to me as it suggests both FL-FR-C and the old cinema FL-FR-MonoSurround format:
https://github.com/FFmpeg/FFmpeg/blob/55...yout.h#L94

However for whatever reason the map is not read and the default 3 channel layout is used which seems to be the first 3 channel layout in the list below which is 2.1 - Stereo Plus LFE:
https://github.com/FFmpeg/FFmpeg/blob/87...yout.c#L83

The file was made from the original media by MakeMKV. MakeMKV is using the "A_MS/ACM" codec ID instead of the more standard "A_PCM/INT/LIT" ID specifically because it wants to add the channel layout info with the WAVE_FORMAT_EXTENSIBLE header.  @fritsch does Kodi support this audio format and the WAVE_FORMAT_EXTENSIBLE header?

I will give FLAC a try for this audio track as it is lossless and supports the same channel mapping header.
Reply
#6
@Krobar Can you test this build and see if it works for you? Best to install it in portable mode I should think.
Learning Linux the hard way !!
Reply
#7
(2021-05-02, 19:29)black_eagle Wrote: @Krobar Can you test this build and see if it works for you? Best to install it in portable mode I should think.

Thanks for the build. I had been running Kodi 18.9 MVC build, am on a VM with easy restore so did a full install. 

The behaviour with this build was different. Summary of how the different builds behaved for me below:
18.9 - Receiver display says stereo - Centre and hence speech completely missing
Fallback To Hints Build - Receiver display says 4.0 (FL-FR-SL-SR) - Actually 5.0 (Could be FL-FR-C-Mono Surround) - Surrounds seem to play a copy of centre
Bluray player with original disc - Correctly detected and plays as PCM 3.0 (FL-FR-C)

It seems a 4.0 output was intended (Although as FL-FR-SBL-SBR):
2021-05-02 21:14:33.979 T:5748    DEBUG <general>: CActiveAESink::OpenSink - WASAPI Initialized:
2021-05-02 21:14:33.979 T:5748    DEBUG <general>:   Output Device : default
2021-05-02 21:14:33.979 T:5748    DEBUG <general>:   Sample Rate   : 48000
2021-05-02 21:14:33.979 T:5748    DEBUG <general>:   Sample Format : AE_FMT_S24NE4MSB
2021-05-02 21:14:33.979 T:5748    DEBUG <general>:   Channel Count : 4
2021-05-02 21:14:33.979 T:5748    DEBUG <general>:   Channel Layout: FL, FR, BL, BR
2021-05-02 21:14:33.979 T:5748    DEBUG <general>:   Frames        : 2400
2021-05-02 21:14:33.979 T:5748    DEBUG <general>:   Frame Size    : 16

The receiver I have does not seems to support that channel config so that might explain the weird output and detection as 4.0 (FL-FR-SL-SR). List of supported input channel configs (Some will likely be bitstream only):
0x00 – Dual Mono
0x01 – Centre only
0x02 – Stereo only
0x03 – Stereo + mono surround
0x04 – Stereo + Surround L & R
0x05 – Stereo + Surround L & R + mono Surround Back
0x06 – Stereo + Surround L & R + Surround Back L & R
0x07 – Stereo + Surround L & R containing matrix information for surround back L&R
0x08 – Stereo + Centre
0x09 – Stereo + Centre + mono surround
0x0A – Stereo + Centre + Surround L & R
0x0B – Stereo + Centre + Surround L & R + mono Surround Back
0x0C – Stereo + Centre + Surround L & R + Surround Back L & R
0x0D – Stereo + Centre + Surround L & R containing matrix information for surround back L&R
0x0E – Stereo Downmix Lt Rt
0x0F – Stereo Only (Lo Ro)
0x10 – Dual Mono + LFE
0x11 – Centre + LFE
0x12 – Stereo + LFE
0x13 – Stereo + single surround + LFE
0x14 – Stereo + Surround L & R + LFE
0x15 – Stereo + Surround L & R + mono Surround Back + LFE
0x16 – Stereo + Surround L & R + Surround Back L & R + LFE
0x17 – Stereo + Surround L & R + LFE
0x18 – Stereo + Centre + LFE containing matrix information for surround back L&R
0x19 – Stereo + Centre + single surround + LFE
0x1A – Stereo + Centre + Surround L & R + LFE (Standard 5.1)
0x1B – Stereo + Centre + Surround L & R + mono Surround Back + LFE
(6.1, e.g. DTS ES Discrete)
0x1C – Stereo + Centre + Surround L & R + Surround Back L & R + LFE (7.1)
0x1D – Stereo + Centre + Surround L & R + LFE, containing matrix information for surround back L&R (6.1 e.g. Dolby Digital EX)
0x1E – Stereo Downmix (Lt Rt) + LFE
0x1F – Stereo Only (Lo Ro) + LFE
Reply
#8
Hmmm, bit missing from that logging showing what Kodi requested to open.

From my log.
xml:
021-05-02 22:17:21.881 T:882938 INFO <general>: CDVDAudioCodecFFmpeg::GetChannelMap - FFmpeg reported 3 channels, but the layout contains 0 trying hints
2021-05-02 22:17:21.881 T:882938 INFO <general>: Creating audio stream (codec id: 65536, channels: 3, sample rate: 48000, no pass-through)
2021-05-02 22:17:21.881 T:882938 DEBUG <general>: CVideoPlayerAudio:: synctype set to 0: clock feedback
2021-05-02 22:17:22.628 T:881837 DEBUG <general>: CAESinkALSA::GetChannelLayout - Input Channel Count: 3 Output Channel Count: 4
2021-05-02 22:17:22.628 T:881837 DEBUG <general>: CAESinkALSA::GetChannelLayout - Requested Layout: FL, FR, FC
2021-05-02 22:17:22.628 T:881837 DEBUG <general>: CAESinkALSA::GetChannelLayout - Got Layout: FL, FR, FC, UNKNOWN1 (ALSA: FL FR FC UNKNOWN)
2021-05-02 22:17:22.628 T:881837 DEBUG <general>: CActiveAESink::OpenSink - ALSA Initialized:
2021-05-02 22:17:22.628 T:881837 DEBUG <general>: Output Device : HDA NVidia
2021-05-02 22:17:22.628 T:881837 DEBUG <general>: Sample Rate : 48000
2021-05-02 22:17:22.628 T:881837 DEBUG <general>: Sample Format : AE_FMT_S32NE
2021-05-02 22:17:22.628 T:881837 DEBUG <general>: Channel Count : 4
2021-05-02 22:17:22.629 T:881837 DEBUG <general>: Channel Layout: FL, FR, FC, UNKNOWN1
2021-05-02 22:17:22.629 T:881837 DEBUG <general>: Frames : 1024
2021-05-02 22:17:22.629 T:881837 DEBUG <general>: Frame Size : 16

You can see from that that Kodi requests the correct layout, gets back 4 channels from the OS (nothing is output to the UNKNOWN1 anyway) and my amp correctly shows PCM 3.0 Windows appears from your log to be returning the wrong channel map (assuming Kodi requested FL,FR,FC). Did Kodi indeed request the right channel map?
Learning Linux the hard way !!
Reply
#9
(2021-05-04, 09:41)black_eagle Wrote: Hmmm, bit missing from that logging showing what Kodi requested to open.

From my log.
xml:
021-05-02 22:17:21.881 T:882938 INFO <general>: CDVDAudioCodecFFmpeg::GetChannelMap - FFmpeg reported 3 channels, but the layout contains 0 trying hints
2021-05-02 22:17:21.881 T:882938 INFO <general>: Creating audio stream (codec id: 65536, channels: 3, sample rate: 48000, no pass-through)
2021-05-02 22:17:21.881 T:882938 DEBUG <general>: CVideoPlayerAudio:: synctype set to 0: clock feedback
2021-05-02 22:17:22.628 T:881837 DEBUG <general>: CAESinkALSA::GetChannelLayout - Input Channel Count: 3 Output Channel Count: 4
2021-05-02 22:17:22.628 T:881837 DEBUG <general>: CAESinkALSA::GetChannelLayout - Requested Layout: FL, FR, FC
2021-05-02 22:17:22.628 T:881837 DEBUG <general>: CAESinkALSA::GetChannelLayout - Got Layout: FL, FR, FC, UNKNOWN1 (ALSA: FL FR FC UNKNOWN)
2021-05-02 22:17:22.628 T:881837 DEBUG <general>: CActiveAESink::OpenSink - ALSA Initialized:
2021-05-02 22:17:22.628 T:881837 DEBUG <general>: Output Device : HDA NVidia
2021-05-02 22:17:22.628 T:881837 DEBUG <general>: Sample Rate : 48000
2021-05-02 22:17:22.628 T:881837 DEBUG <general>: Sample Format : AE_FMT_S32NE
2021-05-02 22:17:22.628 T:881837 DEBUG <general>: Channel Count : 4
2021-05-02 22:17:22.629 T:881837 DEBUG <general>: Channel Layout: FL, FR, FC, UNKNOWN1
2021-05-02 22:17:22.629 T:881837 DEBUG <general>: Frames : 1024
2021-05-02 22:17:22.629 T:881837 DEBUG <general>: Frame Size : 16

You can see from that that Kodi requests the correct layout, gets back 4 channels from the OS (nothing is output to the UNKNOWN1 anyway) and my amp correctly shows PCM 3.0 Windows appears from your log to be returning the wrong channel map (assuming Kodi requested FL,FR,FC). Did Kodi indeed request the right channel map?
I get this bit of the log but none of the GetChannelLayout messages, do I need to enable additional logging? (I'm using WASAPI output)

2021-05-02 21:14:33.645 T:5640    DEBUG <general>: CVideoPlayer::HandleMessages - player 1 reported state: 0
2021-05-02 21:14:33.645 T:2032     INFO <general>: CDVDAudioCodecFFmpeg::GetChannelMap - FFmpeg reported 3 channels, but the layout contains 0 trying hints
2021-05-02 21:14:33.645 T:2032     INFO <general>: Creating audio stream (codec id: 65536, channels: 3, sample rate: 48000, no pass-through)
2021-05-02 21:14:33.645 T:2032    DEBUG <general>: CVideoPlayerAudio:: synctype set to 0: clock feedback
Reply
#10
Most AVRs play 4 channel files as stereo. The workaround is to add one or two silent channels. Then Kodi/AVR see the files as 5.0 or 5.1 (5 and 6 channels respectively) and they play correctly. This will work for your 3.0 files.
Reply
#11
To fix you can run this batch file in Windows (download Sox.exe from a web search:

Code:

if not exist "Output" mkdir "Output"

for %%A IN (*.flac) do ( 
"C:\xxx\xxx\Sox.exe" "%%~nA.flac" "Output\%%A" remix 1 2 3 0 0 0

pause

this adds 3 empty channels to all your FLAC files so they appear as 5.1 and play correctly
Reply
#12
(2021-05-04, 09:49)Krobar Wrote: I get this bit of the log but none of the GetChannelLayout messages, do I need to enable additional logging? (I'm using WASAPI output)

Might get a little more if you enable logging for the audio component.  I would have though you should at least get something like WASAPI Exclusive Mode Sink Initialized using... without that though.

The WASAPI stuff seems to log less debug info but much more about errors if they occur.
Learning Linux the hard way !!
Reply
#13
(2021-05-04, 10:28)HomerJau Wrote: Most AVRs play 4 channel files as stereo. The workaround is to add one or two silent channels. Then Kodi/AVR see the files as 5.0 or 5.1 (5 and 6 channels respectively) and they play correctly. This will work for your 3.0 files.

Thanks for the tip but doing this will break up mixing pretty badly as adding silent channels is not ideal. My AVR does actually play Quad PCM fine from Kodi. I can play this PCM 3.0 from a Bluray player with the original disc too but not from Kodi. The build @black_eagle pointed me at seems to be making some progress in the right direction at least.
Reply
#14
(2021-05-04, 12:40)black_eagle Wrote:
(2021-05-04, 09:49)Krobar Wrote: I get this bit of the log but none of the GetChannelLayout messages, do I need to enable additional logging? (I'm using WASAPI output)

Might get a little more if you enable logging for the audio component.  I would have though you should at least get something like WASAPI Exclusive Mode Sink Initialized using... without that though.

The WASAPI stuff seems to log less debug info but much more about errors if they occur.

Here is the log (Have had to truncate it as most paste services wont take much bigger than 1MB it seems):
https://controlc.com/2689d391
Reply
#15
Thanks.  Two things there stood out to me.  Firstly, HDMI - ARC AV AMP.  Makes me wonder if you are connected PC-->TV-->AMP ?  ARC has caused me issues in the past so if you have it enabled, maybe try without it and see if that makes a difference.

Secondly, this bit is generic to all OS's and tells me that Kodi has seen the correct channel layout (we will have got it from the hint, which does contain the correct channel map).

xml:
2021-05-02 21:14:33.645 T:2032 INFO <general>: CDVDAudioCodecFFmpeg::GetChannelMap - FFmpeg reported 3 channels, but the layout contains 0 trying hints
2021-05-02 21:14:33.645 T:2032 INFO <general>: Creating audio stream (codec id: 65536, channels: 3, sample rate: 48000, no pass-through)

But, when WASAPI returns the channel layout we can use it gives us this.

xml:
2021-05-02 21:14:33.890 T:5748 DEBUG <general>: CActiveAESink::OpenSink - trying to open device WASAPI:default
2021-05-02 21:14:33.979 T:5748 INFO <general>: CAESinkWASAPI::InitializeExclusive: WASAPI Exclusive Mode Sink Initialized using: AE_FMT_S24NE4MSB, 48000, 4
2021-05-02 21:14:33.979 T:5748 DEBUG <general>: CActiveAESink::OpenSink - WASAPI Initialized:
2021-05-02 21:14:33.979 T:5748 DEBUG <general>: Output Device : default
2021-05-02 21:14:33.979 T:5748 DEBUG <general>: Sample Rate : 48000 2021-05-02 21:14:33.979 T:5748 DEBUG <general>: Sample Format : AE_FMT_S24NE4MSB
2021-05-02 21:14:33.979 T:5748 DEBUG <general>: Channel Count : 4 2021-05-02 21:14:33.979 T:5748 DEBUG <general>: Channel Layout: FL, FR, BL, BR
2021-05-02 21:14:33.979 T:5748 DEBUG <general>: Frames : 2400 2021-05-02 21:14:33.979 T:5748 DEBUG <general>: Frame Size : 16

Does directsound do the same thing?  I know that's not recommended for Win but might be worth a try.  I can try and add some more logging to the wasapi stuff and get another test build which might show more clearly if indeed kodi requests the right layout and it's the win driver giving us the incorrect one back but this is shooting in the dark a little as I can't test it!
Learning Linux the hard way !!
Reply

Logout Mark Read Team Forum Stats Members Help
PCM 3.0 Output from HDMI0