Installing Jitsi and Jibri on Same Machine

This post is heavily inspired from this community post by https://community.jitsi.org/u/Woodworker_Life. However, the original installation document is based on typical split Jitsi on one VM and Jibri on seperate VM. 

A little reworked version is deployed and tested for several client based with no performance issue- this post covers a single VM with Jitsi Videobridge and Jibri Reocording system.

Prerequisites:

  • Works only on Ubuntu 16 Distribution
  • Only following DNS entries are needed to be available:
    • meet.ensii.net -> 123.45.67.89
    • recording.ensii.net-> 123.45.67.89
    • recorder.ensii.net-> 123.45.67.89
  • update /etc/hosts file as following:
    • 127.0.0.1    meet.ensii.net
      123.45.67.89    recording.ensii.net
      123.45.67.89    recorder.ensii.net

Part-1: Setup Jitsi Meet on the server

You will need to login to the server you created in step 1. For this, on my Windows laptop, I use PuTTy. Login with initial password and change it to your own.

Update server:

apt update && apt upgrade -y

Update hostname:

hostnamectl set-hostname meet.ensii.net

Install NGINX

If Jitsi Meet gets installed on a fresh server, it will install it’s own webserver (Jetty) in the process. From what I find in the forums, I prefer to go with NGINX, so let’s install that first. In the terminal:

apt install nginx -y

Hint: We do NOT have to configure anything for NGINX: the jitsi-installer will take care of that!

apt install -y apt-transport-https

Install Jitsi Meet

First we need to add the repositories where our server should retrieve the Jitsi Meet packages, in the terminal:

echo 'deb https://download.jitsi.org stable/' >> /etc/apt/sources.list.d/jitsi-stable.list
wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | sudo apt-key add -
apt update && apt install jitsi-meet -y

During installation we can expect 2 questions:

Domain – Here I enter the full domain: 

meet.ensii.net

Certificate – Leave this option at the default to install Let’s Encrypt certificates afterwards. Generate Let’s Encrypt certificates for our domain 

-UPDATE-
Currently, the build is broken and at the end of the process it shows error message:
Unable to find deploy-hook command /etc/letsencrypt/renewal-hooks/deploy/0000-coturn-certbot-deploy.sh in the PATH.
(PATH is /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)

As a workaround we can do following:

mkdir -p /etc/letsencrypt/renewal-hooks/deploy/
touch /etc/letsencrypt/renewal-hooks/deploy/0000-coturn-certbot-deploy.sh
chmod +x /etc/letsencrypt/renewal-hooks/deploy/0000-coturn-certbot-deploy.sh

Execute the Let’s Encrypt script:

/usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh

The script will ask for your email address where Let’s Encrypt will send information in case of expiration -date or such.

At this point you should have a working Jitsi Meet server!

Open a browser and enter the domain of your Jitsi Meet, I open https://meet.ensii.net and get greeted by the welcome screen. Here I create a new meeting ‘test’ and open a conference (make sure to ALLOW the browser to use microphone and camera). I always open an incognito window and open the same meeting I initiated already: https://meet.ensii.net/ 7test so there should now be 2 participants in the call. Opening a 3rd browser to that same meeting ensures that we know if Jitsi switches from peer2peer mode to videobridge mode. When 3 participants are showing in the call, we know all is well so far.

Tweaking and tuning

Tuning A) Prosody portmanager error

service prosody status

(type ‘q’ to quit the output console)

Output:
● prosody.service - Prosody XMPP Server
Loaded: loaded (/lib/systemd/system/prosody.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-04-15 19:39:18 CEST; 32min ago
Docs: https://prosody.im/doc 5
Main PID: 16994 (lua5.2)
Tasks: 1 (limit: 2296)
Memory: 18.5M
CGroup: /system.slice/prosody.service
└─16994 lua5.2 /usr/bin/prosody

Apr 15 19:39:18 meet.ensii.net 34 systemd[1]: Started Prosody XMPP Server.
Apr 15 19:39:19 meet.ensii.net 34 prosody[16994]: portmanager: Error binding encrypted port for https: No certificate
Apr 15 19:39:19 meet.ensii.net 34 prosody[16994]: portmanager: Error binding encrypted port for https: No certificate

The portmanager error basically is harmles and can be ignored. But we can also fix this.

nano /etc/prosody/conf.avail/meet.ensii.net.cfg.lua

Before the first Virtualhost entry, insert following:

-- we are going to be proxying the BOSH connection anyway, so there is no need to be listening for BOSH over HTTPS
https_ports = { }

Save the changes and restart prosody, all should be happy now: 

service prosody restart
service prosody status

Tuning B) Improving over-all performance by sacrificing audio-indicator animation

nano /etc/jitsi/meet/meet.ensii.net-config.js

Find the audio-section and set:

disableAudioLevels: true,

With this setting, you loose the visually appealing sound level indicators/animations in the call, but this also removes a lot of overhead and screen-rewriting. On this rather poor-dimensioned server, this brings a noticable performance gain.

Found here: [Customizing jitsi — viewer only — bandwidth — usecase 56]

Tuning C) Video resolution and bitrate

Jitsi Meet sends 720p resolutions with 30 fps (at least afaik).
Google’s recommendations are:
Resolution: 1280×720 @ 30 fps
Video Bitrate Range: 1,500-4,000 Kbps

I have tested several scenarios with setting the ‘startBitrate’ to a low level and found good results with following:

nano /etc/jitsi/meet/meet.ensii.net-config.js

Find the video-section and insert:

startBitrate: 500,
resolution: 720,
constraints: {
video: {
aspectRatio: 16 / 9,
height: {
ideal: 720,
max: 720,
min: 240
}
}
},

Part-2: Installation of Jibri: JAVA 8 (Jibri requires JAVA 8)

Check your java version-

java -version

The output should return with OpenJDK 8 installed. Now set the Java Home-

The returned console output shows us the path to JAVA 8 and we will copy this to set the Java Home Environment Variable variable:

nano ~/.bashrc 

Paste the following line (make sure to use the path that was returned in previous step):

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java

Save this and then source the file:

source ~/.bash_profile

And check the Java Home:

echo $JAVA_HOME

This should return:

/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java

Miscellaneous packages

We will install all miscellaneous packages EXCEPT default-jre-headless:

apt update && install unzip ffmpeg curl alsa-utils icewm xdotool xserver-xorg-input-void xserver-xorg-video-dummy -y

ALSA and Loopback Device. Set up the module to be loaded on boot:

echo "snd-aloop" >> /etc/modules

Load the module into the running kernel:

modprobe snd-aloop

Check to see that the module is already loaded:

lsmod | grep snd_aloop

This should return (something like):

snd_aloop 24576 0
snd_pcm 106496 1 snd_aloop
snd 86016 3 snd_aloop,snd_timer,snd_pcm

Google Chrome stable & Chromedriver. Install the latest Google Chrome stable build:

curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
apt update && apt install google-chrome-stable -y

Add chrome managed policies file and set CommandLineFlagSecurityWarningsEnabled to false. It will hide warnings in Chrome. You can set it like so:

mkdir -p /etc/opt/chrome/policies/managed
echo '{ "CommandLineFlagSecurityWarningsEnabled": false }' >>/etc/opt/chrome/policies/managed/managed_policies.json

Chromedriver is also required and can be installed like so:

CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
wget -N http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip -P ~/
unzip ~/chromedriver_linux64.zip -d ~/
rm ~/chromedriver_linux64.zip
mv -f ~/chromedriver /usr/local/bin/chromedriver
chown root:root /usr/local/bin/chromedriver
chmod 0755 /usr/local/bin/chromedriver

Jitsi/Jibri Debian Repository

The Jibri packages can be found in the stable repository:

wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | sudo apt-key add -
sh -c "echo 'deb https://download.jitsi.org stable/' > /etc/apt/sources.list.d/jitsi-stable.list"
apt update && apt install jibri -y

We want to make sure that user ‘jibri’ is part of the necessary groups:

usermod -aG adm,audio,video,plugdev jibri

With these steps, we have now the basic setup of Jibri done, but the service is not active (yet).

Part-3: Configuring Jitsi and Jibri

Prosody configuration

Create the internal Multi User Component (MUC) and the the recorder virtual host entry, login to server “jitsi” and:

nano /etc/prosody/conf.avail/meet.ensii.net.cfg.lua

At the end of this file, add a dedicated section:

-- internal muc component, meant to enable pools of jibri and jigasi clients
Component "internal.auth.meet.ensii.net" "muc"
modules_enabled = {
"ping";
}
storage = "memory"
muc_room_cache_size = 1000

VirtualHost "recorder.meet.ensii.net"
modules_enabled = {
"ping";
}
authentication = "internal_plain"

Reload prosody:

/etc/init.d/prosody reload

Create two users for Jibri (user: jibri and user: recorder):

prosodyctl register jibri auth.meet.ensii.net JibrisPass
prosodyctl register recorder recorder.meet.ensii.net RecordersPass

(Important: take note of these passwords, we will need them later also on server “jibri”!)

Jicofo configuration

Set the Multi User Component (MUC) to look out for Jibri:

nano /etc/jitsi/jicofo/sip-communicator.properties

In this file, add two lines:

org.jitsi.jicofo.jibri.BREWERY=JibriBrewery@internal.auth.meet.ensii.net
org.jitsi.jicofo.jibri.PENDING_TIMEOUT=90

Reload jicofo:

/etc/init.d/jicofo reload

Jitsi Meet configuration

Make sure we have the button for recording and/or streaming in our config:

nano /etc/jitsi/meet/meet.ensii.net-config.js

Look for following lines, uncomment the line and set value to ‘true’ or add if the line does not exist:

fileRecordingsEnabled: true, // If you want to enable file recording
liveStreamingEnabled: true, // If you want to enable live streaming
hiddenDomain: 'recorder.meet.ensii.net',

Make sure we have the menu-option for recording and streaming available:

nano /usr/share/jitsi-meet/interface_config.js

Look for the section TOOLBAR_BUTTONS and make sure that the array contains ‘recordings’ and ‘livestreaming’. We need to configure the xmpp environments and the directory where we want to store our recordings:

nano /etc/jitsi/jibri/config.json

Change settings according to:

{
"recording_directory":"/srv/recordings",
"finalize_recording_script_path": "/path/to/finalize_recording.sh",
"xmpp_environments": [
{
"name": "prod environment",
"xmpp_server_hosts": [
"meet.ensii.net"
],
"xmpp_domain": "meet.ensii.net",
"control_login": {
// The domain to use for logging in
"domain": "auth.meet.ensii.net",
// The credentials for logging in
"username": "jibri",
"password": "JibrisPass"
},
"control_muc": {
"domain": "internal.auth.meet.ensii.net",
"room_name": "JibriBrewery",
"nickname": "jibri-nickname"
},
"call_login": {
"domain": "recorder.meet.ensii.net",
"username": "recorder",
"password": "RecordersPass"
},
"room_jid_domain_string_to_strip_from_start": "conference.",
"usage_timeout": "0"
}
]
}

Now we create the directory for the recordings and make sure user ‘jibri’ can write here:

mkdir /srv/recordings
chown jibri:jitsi /srv/recordings

Restart jibri service:

service jibri restart

This is all we need to do on server “jibri”.

Everything above this section needs to be changed on server “jibri”: “recording.ensii.net 20”

Testing recording

Once all these changes were in place, I even rebooted both servers. On the server “jibri”, the jibri service does not automatically start, so keep in mind to do so manually if needed.

Now I open my https://meet.ensii.net/ 12 and start a meeting ‘test’. Once I Am presented with my videostream, I open the menu and choose ‘Start recording’. After some time to load, the recording was started. So after some seconds, I open the menu again and choose ‘Stop recording’.

On the server, I found the mp4 file of the recording in a sub-folder with a random generated folder-name:

Mission accomplished!

Last but not the least, if you reboot the server, you have to start jibri service-

systemctl restart jibri

Src: 
https://community.jitsi.org/t/how-to-to-setup-integrated-jitsi-and-jibri-for-dummies-my-comprehensive-tutorial-for-the-beginner/35718/3

Share

22 thoughts on “Installing Jitsi and Jibri on Same Machine”

    • The published configuration works on my many installations. Do not mix with other configuration reference- which might not work. Can you share the kernel version that your droplet has?

      Reply
  1. Hi,
    We have followed your steps, but our Nginx is not able to start and showing following error:
    Job for nginx.service failed because the control process exited with error code. See “systemctl status nginx.service” and “journalctl -xe” for details.

    Can you help?

    Reply
    • Try to check if the nginx is properly installed and if port 80+443 are taken by some other application (such as Apache). Port conflict is an error probably. As the error itself is self-explaantory- try to run this command- “journalctl -xe” and see the prints. You can also apply “netstat -plntu” to see what other application or service might have occupied your port 80+443. Thnaks.

      Reply
  2. Hello,

    Thanks for the same. Everything is installed properly and even the recording starts and stops and creates the mp4 file. However when i open the file its just blank with the logo of jitsi . I suspect something is not right with the ffmpeg but i am stuck now .

    Reply
  3. Hallo,

    I hereby share with you the following, I was able to do with great success
    Jetsi Meet in ubuntu 18.04 and Debian 10 is set up and works perfectly

    I also wanted to set up Jibri Recording and Streaming in ubuntu 18.04 and Debian
    99% all commands and configuration went perfectly. Only got the last configuration
    I peroblem “nano /etc/jitsi/jibri/jibri.conf” and I get a blank page
    no recording_directory xmpp_server_host control_muc call_login and stuff fort.
    if i look at ubuntu file dirctory etc -jitsi-jbri in this diectory is no
    jibri.json file in return i get a file empty jibri.conf. and if i go to host via google
    and I type recordig I get error message recordig in not available. or recording failed.
    jibri configuration in forum is not clear and maybe not complete.
    Help me
    Thanks

    Reply
    • Only got the last configuration
      I peroblem “nano /etc/jitsi/jibri/jibri.conf” and I get a blank page

      Where are u getting this error- on ubuntu 18 or Debian 10?

      Reply
  4. I have similar issue on Debian 10.

    there is NO file /etc/jitsi/jibri/config.json
    so jibri doesn’t start.

    could you provide the full config.json, rather then options that must be changed?

    Reply
  5. Rumi, you did a great work.
    Do you have plans to update your guide, since it’s not working with the current version if Jibri (at least /etc/jitsi/jibri/config.json is not using now and was replaced with the /etc/jitsi/jibri/jibri.config that uses another syntax.

    another question is regarding your guide
    You define several hosts at /etc/hosts
    127.0.0.1 meet.ensii.net
    123.45.67.89 recording.ensii.net
    123.45.67.89 recorder.ensii.net

    but non of them (recording.ensii.net or recorder.ensii.net) are using at your configs!!!
    Where is the mistake?
    Their are not necessary or there is a mistake somewhere?

    Reply
  6. Hi. I would like to do the same configuration that you have so that it works for you, but it happens that it prevents me from doing it in Ubuntu 16.04. I should only use ubuntu version 20.04.
    Is there any way that you can do the same for this version of ubuntu?

    Reply
  7. I have followed your instructions except that i have installed it separate azure VM ,i am getting the below error after installing.

    Log from jicafo :

    Jicofo 2021-02-04 13:20:32.092 SEVERE: [38] org.jitsi.jicofo.recording.jibri.JibriSession.log() Unable to find an available Jibri, can’t start
    Jicofo 2021-02-04 13:20:32.093 INFO: [38] org.jitsi.jicofo.recording.jibri.JibriRecorder.log() Failed to start a Jibri session, no Jibris available.

    Log from jibri is as below:
    [ 13.236] (II) config/udev: Adding input device Power Button (/dev/input/event0)
    [ 13.236] (II) AutoAddDevices is off – not adding device.
    [ 13.236] (II) config/udev: Adding input device AT Translated Set 2 keyboard (/dev/input/event4)
    [ 13.236] (II) AutoAddDevices is off – not adding device.
    [ 13.236] (II) config/udev: Adding input device AT Translated Set 2 keyboard (/dev/input/event1)
    [ 13.236] (II) AutoAddDevices is off – not adding device.
    [ 13.236] (II) config/udev: Adding input device TPPS/2 IBM TrackPoint (/dev/input/event3)
    [ 13.236] (II) AutoAddDevices is off – not adding device.
    [ 13.237] (II) config/udev: Adding input device TPPS/2 IBM TrackPoint (/dev/input/mouse1)
    [ 13.237] (II) AutoAddDevices is off – not adding device.

    When i check the status of jibri i see jibri is active and running with below error:

    recorder.meet.learningtree.ai launch.sh[3604]: SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.

    Reply
    • The internal configuration structure is designed on domain structure, hence the domain is mapped with the correspnding server (its self server in this case) using hosts file.

      Reply
  8. Hi!
    Thanks for great instruction.
    On this step I’m getting this

    prosodyctl register jibri auth.meet.ensii.net JibrisPass

    Prosody was unable to find lua-unbound
    This package can be obtained in the following ways:

    Debian/Ubuntu | sudo apt install lua-unbound
    luarocks | luarocks install luaunbound
    Source | https://www.zash.se/luaunbound.html

    Old DNS resolver library will be used
    More help can be found on our website, at https://prosody.im/doc/depends

    **************************
    Can you please help to solve it?

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.