Pulseaudio support for Jibri
This is a simple guide explaining how to add pulseaudio
support to Jibri. While preparing the guide, I greatly benefited from @kpeiruza’s work. It’s tested on Debian Buster and LXC (Linux container).
“Pulseaudio support” means that you no longer need the snd_aloop
module.
Packages
Install the following packages on the Jibri host
apt-get install dbus-x11 pulseaudio rtkit
rtkit group
Add the Jibri user to the RealtimeKit group.
adduser jibri rtkit
Pulseaudio autostart
It’s not recommended running the Pulseaudio daemon as a system-wide instance. Run it per-user. I think the best way to do this is to add a ExecStartPost
line to the jibri-icewm
service. But make this modification with override.conf
file to keep the original service file untouched.
mkdir /etc/systemd/system/jibri-icewm.service.d
vim /etc/systemd/system/jibri-icewm.service.d/override.conf
/etc/systemd/system/jibri-icewm.service.d/override.conf
[Service]
ExecStartPost=
ExecStartPost=/usr/bin/start-pulseaudio-x11
Reload the systemd daemons
systemctl daemon-reload
Jibri’s pulseaudio config
To customize the pulseaudio config for the jibri
user
mkdir -p /home/jibri/.config/pulse
vim /home/jibri/.config/pulse/client.conf
vim /home/jibri/.config/pulse/daemon.conf
chown jibri:jibri /home/jibri/.config -R
/home/jibri/.config/pulse/client.conf
autospawn = yes
/home/jibri/.config/pulse/daemon.conf
daemonize = yes
high-priority = no
realtime-scheduling = yes
realtime-priority = 5
exit-idle-time = -1
flat-volumes = no
customizing ffmpeg
/usr/local/bin/ffmpeg
#!/bin/bash
ARGS=$@
ARGS=$(echo $ARGS | sed 's/-f alsa/-f pulse/')
ARGS=$(echo $ARGS | sed 's/-i plug:cloop/-i default/')
exec /usr/bin/ffmpeg $ARGS
Execute permission to the fake ffmpeg
chmod 755 /usr/local/bin/ffmpeg
restart the Jibri services
systemctl stop jibri-xorg
systemctl start jibri
Container devices
If Jibri is on the container, it’s needed to allow the container to access the sound devices. This is done by adding the following line to the container config:
lxc.cgroup.devices.allow = c 116:* rwm