Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect PCM 5.1 channel mapping #310

Open
peterbarlow2000 opened this issue Dec 9, 2020 · 1 comment
Open

Incorrect PCM 5.1 channel mapping #310

peterbarlow2000 opened this issue Dec 9, 2020 · 1 comment

Comments

@peterbarlow2000
Copy link

peterbarlow2000 commented Dec 9, 2020

Playing a pcm_s16le 48000Hz 5.1 file through omxplayer with the -p flag results in a minor mapping error. The centre speaker audio is routed through the LFE. (the AVR reports a 5.1 PCM signal). (Removing the -p flag puts omxplayer in stereo down-mix mode.). I have written my own program using the OpenMAX IL client library and have the exact same problem. However, when playing the file through kodi all is well. I have to select 5.1 in the config, but the AVR again reports and good 5.1 PCM signal and all channels are correct this time. DTS and AC3(DDP) passthrough work fine under omxplayer.

I'm using test wave files from this site https://www2.iis.fraunhofer.de/AAC/multichannel.html

  1. Please can anyone verify that PCM HDMI passthrough on omxplayer using a PCM 5.1 audio file works for them ??
  2. Does anyone have any insights into why or how it works in kodi but not omxplayer?
  3. Does (should) the PCM data be sent directly to the OMX render component (that should work), or does kodi somehow route the data via the decode component first (even though it's redundant)?
    Thanks for reading :)
@peterbarlow2000
Copy link
Author

After days of trawling through the code I think I have the answer. It seems there are different flavours of Kodi, some use ALSA, some use OMX. The binary I was running was using OMX whilst the source code I was looking at was using ALSA. This lost me A LOT of time. I got the right source code (OMX) and have found that Kodi(OMX) does not use the standard channel mapping call OMX_SetParameter(handle, OMX_IndexParamAudioPcm, &sPCMMode);. Instead the channel mapping is achieved by a call to vcgencmnd. Specifically vcgencmd hdmi_channel_map 0x0b02c4c8. If I execute this command from the shell before launching omxplay then I get the correct result. PCM 5.1 surround sound with the correct channel mapping. I hope this is useful to someone else.

NB: This is in an issue in OMXPlayer that needs to be addressed. Kodi(OMX) handles it well. The relevant bits of code need carrying over to OMXPlayer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant