Jibri Streaming To Custom RMTP Endpoint

Aug 3rd 2020


Jibri is the component of jitsi which handles both recording and streaming capabilities. Current Jibri supports Youtube streaming by providing streaming key to Jitsi meet. If we want to stream to a custom RTMP endpoint and record simultaneously, you can follow the below instructions. Here we have used Nginx as the RTMP server. The instructions are in the following order.

  1. Jibri
  2. nginx rtmp
  3. FFmpeg

How to do This

Set up jibri

Install Jibri on ubuntu 18.04. Follow Jibri installation instructions here

Set up nginx

Now let's setup a nginx RTMP server

apt install build-essential libpcre3 libpcre3-dev libssl-dev nginx libnginx-mod-rtmp ffmpeg -y

Insert the follwing to nginx configs.

rtmp {
        server {
                listen 1935;
                chunk_size 4096;

                application live {
                                live on;
                                #Set this to "record off" if you don't want to save a copy of your broadcasts
                                record all;
                                # The directory in which the recordings will be stored.
                                record_path /var/www/html/recordings;
                                record_unique on;
                                record_suffix -%d-%b-%y-%T.flv;

                                # Turn on HLS

                        exec /usr/bin/ffmpeg -i rtmp://$name -crf 30 -preset ultrafast -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 64k -vcodec libx264 -x264-params keyint=60:no-scenecut=1 -r 30 -b:v 500k -s 960x540 -f flv rtmp://$name;


                application show {
                        live on;
                        # Turn on HLS
                        hls on;
                        hls_path /mnt/hls/;
                        hls_fragment 3;
                        hls_playlist_length 60;
                        # disable consuming the stream from nginx as rtmp
                        deny play all;
mkdir -p /var/www/html/recordings
chown -R www-data:www-data /var/www/html/recordings/

Write custom ffmpeg script

Put below code to location /usr/local/bin/ffmpeg



if [[ -n "$(echo $ARGS | grep ' rtmp://')" ]]; then
    DST=$(echo $ARGS | rev | awk '{print $1}' | rev)
    STREAM=$(echo $DST | rev | cut -d '/' -f1 | rev)

    ARGS=$(echo $ARGS | sed "s~rtmp://.*~~")
    ARGS="$ARGS rtmp://$STREAM"

echo $ARGS >> /tmp/ffmpeg.log
exec /usr/bin/ffmpeg $ARGS

Record streaming

Add below application live block and you can run node app


Put below code for express application'/recorded', async (req, res) => {

This is the script to upload record stream video to s3 bucket

## upload script
/usr/local/bin/aws s3 cp --recursive ${RECORDINGS_DIR} s3://yourbucket
if [ -f /tmp/protect ]; then
    echo "file exist"
        rm /tmp/protect

    echo "file not exist"
sudo service jibri restart  
exit 0


I followed this community-post

Thank you support for the support given emrah