Jibri Streaming and Recording To Custom RMTP Endpoint
August 03, 2020
1 min

This post discusses of how to stream to Custom RTMP endpoints with jitsi apart from the supported youtube streaming. We use the component Jibri with configuration changes and some scripts to achieve this functionality(Jibri is the infrascture used to broadcast which includes both recording and streaming) You can use this to stream the video from jitsi meet to custom RTMP endpoints like Wowza, OBS, Vimeo, Ant Media, Nginx etc. In this article we would be using nginx as the RTMP endpoint.

Main components involved

  • Jibri - Broadcasting component of jitsi which is used for both streaming and recording
  • FFmpeg - Component responsible for capturing and encoding the output of virtual framebuffer in jibri
  • Nginx RTMP - Using nginx opensource for video streaming

High Level Architecture

jibri rtmp

The Setup

  • Install Jibri on a EC2 server
  • To setup the Nginx RTMP server follow the below steps,
  1. Execute the following commands to install the libraries
apt install build-essential libpcre3 libpcre3-dev libssl-dev nginx libnginx-mod-rtmp ffmpeg -y
  1. Insert the following code 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://yourdomai.com/show/$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;
  1. Execute the following command to create a folder for recordings
mkdir -p /var/www/html/recordings
chown -R www-data:www-data /var/www/html/recordings/
  • Let’s move on to creating a custom ffmpeg script in jibri to forward the captured video stream to Nginx RTMP server 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

  • Finally let’s record the video streams
  1. Add below application live block and you can run the node app
  1. Put below code for express application
app.post('/recorded', async (req, res) => {
  1. Use this script to upload record stream video to a 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

This gives us the ability to stream to a custom RTMP endpoint and record at the same time. Also I should remind the support given by emrah


If you want to setup a streaming system with jitsi please contact us through support@telzee.io. We provide WebRTC development services and solutions



Related Posts

Implementation of Chat Feature with Jitsi Meet API
August 29, 2020
1 min