1

I need my multi-channel (game) audio to be AC3 (or DTS) encoded and sent over HDMI (don't want to bore you with the details). I've tried following multiple howtos, like https://help.ubuntu.com/community/DigitalAC-3Pulseaudio, but always come up short.

I've added this to my /etc/asound.conf:

pcm.a52 {
  @args [CARD]
  @args.CARD {
    type string
  }
  type rate
  slave {
    pcm {
      type a52
      bitrate 448
      channels 6
      card $CARD
    }
  rate 48000 #required somehow, otherwise nothing happens in PulseAudio
  }
}

Which added AC3 virtual devices (?) to my system, like:

$ aplay -L
…
a52:CARD=NVidia
    HDA NVidia
    Plugin to convert multichannel stream to A52 (AC3) bitstream
…

Then I tried adding output profiles in a new pulseaudio config file at /usr/share/pulseaudio/alsa-mixer/profile-sets/ac3.conf to map the AC3 audio onto my HDMI ports, like:

[Mapping hdmi-ac3-surround]
description = Digital Surround 5.1 (HDMI/AC3)
device-strings = a52:%f
paths-output = hdmi-output-0
channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe
priority = 6
direction = output

But that profile doesn't even show up in pavucontrol and I don't know what else to do. So that's where I'm stuck. Packages I've installed for this: alsa-plugins-freeworld-a52, ffmpeg-libs which ought to be enough as far as I understand.

2
  • 1
    I don't know that this will help, but you might try editing /etc/pulse/daemon.conf and updating the frequency from 44100 to 48000 in the property default-sample-rate and update default-sample-channels from 2 to 6, and also update default-channel-map to front-left,front-right,rear-left,rear-right,front-center,lfe. I believe this is what fixed my issues over TOSLINK/SPDIF. Of course, HDMI may be a different beast altogether. Also, I don't know if it's relevant or not, but I added the pcm.a52 bit to a new file: /usr/share/alsa/alsa.conf.d/a52.conf.
    – jbowman
    Commented Oct 9, 2020 at 20:12
  • I personally never managed to get a52 encoding for alsa to work on ubuntu 21.10. I tried the DTS alternative that worked very rapidly for me, following more or less the readme instructions: github.com/darealshinji/dcaenc
    – seb007
    Commented Feb 8, 2022 at 21:40

1 Answer 1

-1

The short answer is you don't, AFAIK. It's a product of conflicting requirements.

HDMI only supports uncompressed PCM data and cannot do any form of passthrough, but it does support a ridiculous(like 16 or 32 or something) number of channels so it can carry 5.1 or 7.1 streams... Just not when using a TV's optical out, as the "low speed" toslink needs a compressed stream for more than 2 channels and no TV has a built-in encoder.

1
  • While I admit that it does not seem to make much sense to encode multichannel PCM stream to AC3/DTS when HDMI, unlike SPDIF, can carry the PCM stream, "bitstreaming" / passthrough is a thing in HDMI.
    – Tom Yan
    Commented Nov 4, 2023 at 4:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .