Play Audio to Remote PC over Network on Linux May 5th 2020 Words: 169

Goal

Stream all sound from host A to host B over network. Both hosts are running Ubuntu.

Configuration

Install avahi and enable service on both hosts:

1
2
sudo apt install avahi-daemon
sudo systemctl enable avahi-daemon

Install zeroconf module on both hosts:

1
sudo apt install pulseaudio-module-zeroconf

Edit /etc/pulse/default.pa:

Server:

1
2
load-module module-native-protocol-tcp auth-anonymous=1 #auth-ip-acl=127.0.0.1;192.168.0.0/24
load-module module-zeroconf-publish

Client:

1
load-module module-zeroconf-discover

Don’t forget to check the firewall:

  • avahi: 5353(UDP)
  • pulseaudio: 4713(TCP)

Restart service:

1
pulseaudio -k

Should be able to see remote audio devices with the format <device name> on <user>@<hostname>:

The playback uses around 1.4 Mbps bandwidth.

Note

If the server listens on both IPv4 and IPv6, you may see a duplicated entry of the remote playback device.
In my case, I set the server listen to IPv4 to solve the problem.

PulseAudio over network - ArchWiki

EOF