What is Jibri

Jibri is the component that is used for recording, streaming and SIP video gateway.It works by launching a Chrome instance rendered in a virtual framebuffer and capturing and encoding the output with ffmpeg. It is intended to be run on a separate machine (or a VM), with no other applications using the display or audio devices. Only one recording at a time is supported on a single jibri.

Configuring Jitsi Meet to allow Jibri to connect and 'participate' in any video conference.

Prosody (Prosody is an xmpp server all components connect to it so they can communicate using xmpp protocol, this includes web, jicofo, jvb and the rest of the components.)

Jicofo (This is another background service that cares about switching/relaying the processes between all participants and the video bridge)

Jitsi Meet (Consider this to be the master service responsible for displaying all functionality in your web browser.)

Configure Prosody

nano /etc/prosody/prosody.cfg.lua

Uncomment the items in the "conference" section:

---Set up a MUC (multi-user chat) room server on conference.example.com:
Component "conference.jitsi.example.com" "muc"
--- Store MUC messages in an archive and allow users to access it
modules_enabled = { "muc_mam" }

Create internal MUC component entry. This is required so that Jicofo can find jibri clients on a MUC that jitsi meet users cannot access externally. And create the recorder virtual host entry, to hold the user account for the jibri chrome session. Add the following by logging into the "jitsi" server using


nano /etc/prosody/conf.avail/meet.meetrix.io.cfg.lua

At the end of this file,

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

VirtualHost "recorder.meet.meetrix.io"
    modules_enabled = {
        "ping";
    }
    authentication = "internal_plain"

Reload prosody:

systemctl reload prosody

Create two new accounts for Jibri to use (one for control purposes, one for recording purposes):

prosodyctl register jibri auth.meet.meetrix.io JibrisPass
prosodyctl register recorder recorder.meet.meetrix.io RecordersPass

Configure Jicofo

set the appropriate MUC to look for the Jibri Controllers.


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

Add these two lines for the Jibri control room and timeout:

org.jitsi.jicofo.jibri.BREWERY=JibriBrewery@internal.auth.meet.meetrix.io
org.jitsi.jicofo.jibri.PENDING_TIMEOUT=90

Reload Jicofo:


systemctl reload Jicofo

Configure Jitsi Meet:

Make sure there is a button for recording and / or streaming in our config:


nano /etc/jitsi/meet/meet.meetrix.io-config.js

Bosh connection that uses IP instead of Domain name

Default Configuration for Domain Name


bosh: '//meet.meetrix.io/http-bind'

Changing the Domain to IP


bosh: '//192.168.10.10/http-bind'

Add/Set the following properties:


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

Installing Jibri:

Pre-Requisites

ALSA and Loopback Device

  • First make sure the ALSA loopback module is available. The extra modules (including ALSA loopback) can be installed on Ubuntu 20.04 using package name linux-image-extra-virtual.

  • Perform the following tasks as the root user

    • 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
  • If the output shows the snd-aloop module loaded, then the ALSA loopback configuration step is complete.

Enable the ALSA loopback module to loaded on boot, as well as load into the current boot:

echo "snd_aloop" >> /etc/modules
modprobe snd_aloop'

FFmpeg with X11 capture support

  • Jibri requires a relatively modern ffmpeg install with x11 capture compiled in. This comes by default in Ubuntu 16.04/18.04/20.04, by installing the ffmpeg package.
  • If building Jibri for Ubuntu 14.04 (trusty), the mc3man repo provides packages. They can be used by the following in Ubuntu 14.04:

Add the FFmpeg PPA

sudo add-apt-repository ppa:jonathonf/ffmpeg-4

Installing FFmpeg on Ubuntu

To install it, enter the following command as root or user with sudo privileges :This will also install many packages for the dependencies.


sudo apt-get update
sudo apt-get install ffmpeg

Check FFmpeg Version

To verify the installation, use the ffmpeg -version command, which prints the FFmpeg version:


ffmpeg -version

Miscellaneous Packages


sudo apt-get install wget gnupg software-properties-common default-jre-headless  curl alsa-utils icewm xdotool xserver-xorg-input-void xserver-xorg-video-dummy

Install Google Chrome:


curl -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

Install ChromeDriver:

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
sudo mv -f ~/chromedriver /usr/local/bin/chromedriver
sudo chmod 0755 /usr/local/bin/chromedriver

Turn off warnings about scripted control in Chrome:


mkdir -p /etc/opt/chrome/policies/managed

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

Jitsi Debian Repository

The Jibri packages can be found in the stable repository on downloads.jitsi.org. First install the Jitsi repository key onto your system:


wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | sudo apt-key add -

Create a sources.list.d file with the repository:

sudo sh -c "echo 'deb https://download.jitsi.org stable/' > /etc/apt/sources.list.d/jitsi-stable.list"

Update your package list:


sudo apt-get update

Install the latest jibri

Install Jibri

If installing on the same server as Jitsi:


sudo apt-get install jibri

Add Jibri to the necessary user groups:


sudo usermod -aG adm,audio,video,plugdev jibri

Configure Jibri:

Step 1: Install the required packages that are available from Debian 10's default repositories:

We need to configure the xmpp environments and the directory where we want to store our recordings:

Open the config file


nano /etc/jitsi/jibri/config.json

Set the following options:


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

Jibri Code

https://github.com/jitsi/jibri


/src/main/kotlin/org/jitsi/jibri/selenium/JibriSelenium.kt

Changing the Code to accept the Self Signed /Insecure Certificate


chromeOptions.addArguments("--ignore-certificate-errors")

chromeOptions.setAcceptInsecureCerts(true)

Setting RTMP URL


src/main/kotlin/org/jitsi/jibri/service/impl/StreamingJibriService.kt

const val YOUTUBE_URL = "rtmp://zb01.lmt.glcx.cnpc:1935/myapp"

Then we compile the Jibri Code


mvn package -DskipTests

After it is compiled.Replace the New jar with the old one


sudo /opt/jibri/target/jibri-8.0-Snapshot-with-dependies.jar /opt/jitsi/jibri

Reload Jibri


systemctl reload jibri

Create directory to store recordings and assign jibri ownership of the directory


mkdir /recordings
chown jibri:jibri /recordings

Java 8 - Install and configure as default for Jibri

Install Java 8


wget -O - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
add-apt-repository https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
apt update
apt install adoptopenjdk-8-hotspot

Open "launch.sh"


nano /opt/jitsi/jibri/launch.sh

Set Java 8 as default for Jibri instead of the default Java version - replace the word "java" with the full path to Java 8


/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/bin/java

Restart all services, enable and start jibri


systemctl restart prosody
systemctl restart jicofo
systemctl restart jitsi-videobridge2
systemctl enable --now jibri

How to record to S3

configured finalizerecording.sh script as below,

#!/bin/bash
RECORDINGS_DIR=$1

aws s3 cp --recursive ${RECORDINGS_DIR} s3://

if [ -d "$RECORDINGS_DIR" ]; then
    rm -r ${RECORDINGS_DIR}
fi

exit 0

Creating the Dropbox app for Dropbox recording integration

  1. You need a Dropbox account (If you don't already have one, you can sign up for a free account here.)
  2. Create a new App as described in the Getting Started Guide in the App Console section.
  3. Choose
  • 'Dropbox API - For apps that need to access files in Dropbox.'
  • 'App folder - Access to a single folder created specifically for your app.'
  • Fill in the name of your app
  1. You need only, the newly created App key, goes in nano /etc/jitsi/meet/[yourdeployment.com]-config.js

         dropbox: {
             appKey: '__dropbox_app_key__',
             redirectURI: 'https://[yourdeployment.com]/static/oauth.html'
          }
    
    
  2. Add your Dropbox Redirect URIs in the Dropbox form https://[yourdeployment.com]/static/oauth.html
  3. Fill in Branding

Updated:

Leave a Comment