Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save BarkBarklington/998a34263100688dcba1932090aba08f to your computer and use it in GitHub Desktop.

Select an option

Save BarkBarklington/998a34263100688dcba1932090aba08f to your computer and use it in GitHub Desktop.
Bazzite How to force transcode Dolby Digital AC3 over HDMI ARC
I have managed to get the alsa-plugins-a52 to output over HDMI on bazzite.
Problem 1: TV's like Samsung does not support LPCM 5.1 over HDMI EARC.
Problem 2: Many recievers in use today only support HDMI ARC, which means only PCM 2.0 / Dolby Digital or DTS.
How to fix on Bazzite so you can enjoy surround sound in your games in your home theater setup :
1. Install alsa-plugins-a52
sudo rpm-ostree install alsa-plugins-a52
Reboot to get the changes.
2. Install Pulse Audio Volume Control flatpak
Use the included flatpak store in Bazzite.
3. Open up Pulseaudio Volume Control and navigate to outputs and turn off the TV HDMI output to release it for our usage.
4. Use aplay -l to list your audio devices, we are interested in the one that is connected to TV.
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: A50 [A50], device 0: USB Audio [USB Audio]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: A50 [A50], device 1: USB Audio [USB Audio #1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 10: HDMI 4 [SAMSUNG]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 11: HDMI 5 [HDMI 5]
Subdevices: 1/1
Subdevice #0: subdevice #0
5. As we can see, my hardware device for my Samsung TV is
card 1: HDMI [HDA ATI HDMI], device 10: HDMI 4 [SAMSUNG]
Subdevices: 1/1
Subdevice #0: subdevice #0
Which means CARD 1, DEVICE 10.
6. Create custom .asoundrc file to take control over HDMI and push ac3 audio out of it.
nano ~/.asoundrc
# 1. The Raw Encoder (Strict)
# This does the heavy lifting but is picky about input
pcm.a52_raw {
type a52
rate 48000
bitrate 448
channels 6
format S16_LE
# Direct hardware addressing for Card 1, Device 10, YOUR CARD AND DEVICE CAN BE DIFFERENT, CHECK APLAY OUTPUT
slavepcm "hw:1,10"
}
# 2. The Safe Wrapper (Use this one!)
# This converts app audio to what the encoder needs
pcm.a52_safe {
type plug
slave.pcm "a52_raw"
hint {
show on
description "TV (AC3 Surround)"
}
}
7. Test
speaker-test -D a52_encoder -c 6 -r 48000
if it works proceed.
8. create systemd unit to make the new device automaticly
nano ~/.config/systemd/user/force-ac3.service
[Unit]
Description=Force AC3 Surround Sink for HDMI
After=pipewire-pulse.service
Wants=pipewire-pulse.service
[Service]
Type=oneshot
# 1. Wait for audio system
ExecStartPre=/usr/bin/sleep 5
# 2. Only load if 'TV_AC3' is NOT found in the list
ExecStart=/bin/bash -c "pactl list short sinks | grep -q TV_AC3 || pactl load-module module-alsa-sink device=a52_safe sink_name=TV_AC3 sink_properties=device.description='TV_Surround_5.1'"
# 3. Retry logic for boot-up race conditions
Restart=on-failure
RestartSec=10
RemainAfterExit=yes
[Install]
WantedBy=default.target
systemctl --user daemon-reload
systemctl --user start force-ac3.service
9. You will now get a new output device called TV_Surround_5.1, it will automaticly be created on startup,
and recreated if TV was turned off.
Please enjoy your Dolby Digital 5.1 over HDMI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment