Tip: Pulseaudio support for Jibri

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.

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



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


autospawn = yes


daemonize = yes
high-priority = no
realtime-scheduling = yes
realtime-priority = 5
exit-idle-time = -1
flat-volumes = no

customizing ffmpeg



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

Thank you very much for your guide @emrah !!!

PS: on Docker // Kubernetes, you don’t need mapping /dev/snd. AFAIK, this can work without any sound device :slight_smile:


Testing on LXC without mapping, same result…
I’m editing the post

Great tutorial.
The same approach of ffmpeg can be applied to add --no-sanbox mode for chrome. This remove the need of CAP_SYS_ADMIN, so now we can go full swarm in docker!

Do we have a procedure for building it in docker? @kpeiruza

I’ve a quick & dirt docker under my personal github: https://github.com/kpeiruza/jitsi-images/tree/master/jibri



1 Like

It seems to be little old, I have managed to build new jar with latest repo and built. All looks ok.

For the current jibri this line should be like

ARGS=$(echo $ARGS | sed 's/-i plug:\S*/-i default/')

I face the issue of no audio recorded with new jibri. Already use ARGS=$(echo $ARGS | sed ‘s/-i plug:\S*/-i default/’). Does anyone has any idea?

Do you use alsa or pulse?

I use pulse and docker. The only difference is new jibri is used instead of old jibri, so the sed command should replace bsloop instead of cloop. I thought new jibri update cause the error, but if it still works for others, there must be some wrong config in my setup…

Could you add a log command to your fake ffmpeg and paste the $ARGS result?
A line just before the exec line

echo $ARGS >>/tmp/ffmpeg.log

The ARGS is:

-y -v info -f x11grab -draw_mouse 0 -r 30 -s 1280x720 -thread_queue_size 4096 -i :0.0+0,0 -f pulse -thread_queue_size 4096 -i default -acodec aac -strict -2 -ar 44100 -b:a 128k -af aresample=async=1 -c:v libx264 -preset veryfast -profile:v main -level 3.1 -pix_fmt yuv420p -r 30 -crf 25 -g 60 -tune zerolatency -f mp4 /config/recordings/lofycizgclxmhlpr/meet1_2020-08-24-07-43-36.mp4

I also remvoe the part b:a 128k -af aresample=async=1 but still no audio

You can add a more log command to be sure pulseaudio is running at the record time

echo $ARGS >>/tmp/ffmpeg.log
ps auxww | grep pulse | grep -v grep >>/tmp/ffmpeg.log
1 Like

You’ve just built it, right? Looks like you’re using a very recent version of Chromedriver. Not sure if that could be the problem.

Besides that, are you passing /dev/shm into the container?
Was Jibri working before trying to use this Jibri+Pulse Docker?



1 Like

Oh sorry for not confirm. its was a chrome configuration mistake. I wrapped chrome like this:

exec /usr/bin/google-chrome-bin --no-sandbox $@

But it does not work correctly. It should be somewhat like this:

ARGS=$(echo $ARGS | sed 's/--kiosk/--kiosk --no-sandbox/')
exec /usr/bin/google-chrome-bin $ARGS
1 Like

Good to know, thanks!