Stream to any OR Multiple RTMP Destinations + Record Simultaneously

This is a guide that enables you simulcast to Youtube, Facebook, Periscope & any rtmp server
EDIT: Added support to Stream & Record Simultaneously. See NGINX-RTMP Section

You need to make sure your firewall doesnt block rtmp

Step 1: jitsi-jibri setup

I’m not going to detail it as @Woodworker_Life has written an excellent guide already

OR if you prefer to have both jitsi & jibri running on the same machine, use this jitsi-jibri installer script developed by @Ark74

Step 2: Setup rtmp NGINX Proxy

It can be setup in any linux machine (VM or hardware). It might work in RPi but i’ve not tested it

a. Spin up an Ubuntu VM.

I prefer to run as root

apt update && apt upgrade -y

b. Install nginx and the required packages:

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

c. Edit nginx.conf with vim, vi OR nano

nano /etc/nginx/nginx.conf

and Add the following lines in the end of the file. Make sure to adjust

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;

                        push rtmp://;

                        #Periscope -- Goto & create a stream. select the region of your choice and copy & paste it at the end of the next line
                        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://;

                        #Youtube Stream - YT doesnt assign a permanent stream key, BUT if you reuse an earlier stream, the key doesnt change. EDIT: apparently you can create one i am told. but i use the earlier method
                        push rtmp://;

Create the directory for recordings and make it writeable to the web server software:

mkdir -p /var/www/html/recordings
chown -R www-data:www-data /var/www/html/recordings/

d. restart nginx service

systemctl restart nginx.service

Step 3. Facebook uses rtmps and hence you need stunnel to send rtmps to facebook as NGINX RTMP proxy does only rtmp

a. install stunnel

apt-get install stunnel4 -y

b. Enable stunnel auto start

nano /etc/default/stunnel4

& Change ENABLE from 0 to 1


c. edit stunnel config. (This file is new & doesnt exist so go ahead )

nano /etc/stunnel/stunnel.conf

add the following lines.

pid = /var/run/stunnel4/
output = /var/log/stunnel4/stunnel.log

setuid = stunnel4
setgid = stunnel4

socket = r:TCP_NODELAY=1
socket = l:TCP_NODELAY=1

debug = 4

client = yes
accept = 1936
connect =
verifyChain = no

d. enable stunnel after boot

systemctl enable stunnel4.service

e. restart stunnel

systemctl restart stunnel4.service

Double check Ports. ngnix an stunnel need to be on different ports when used on the same machine.
Facebook can be a bit finicky. If you dont see the preview in your producer page, just restart the stunnel4 service

Step 4: ffmpeg rtmp Script

@lodopidolo as create a brilliant yet a simple script to proxy the video from jitsi/jibri to the rtmp server/sink


a. Add a directory

mkdir -p /opt/util

cd /opt/util

b. create a file

nano ffmpeg

I’ve changed the language to english, but it really doesnt matter. you can use his script code. paste the script below into the file & save



while test $# -gt 0
    if [ "${1:0:32}" == "rtmp://" ]; then
        # T  will contain the rtmp key from jitsi meet page. Make sure you use the correct IP Address OF the rtmp server you setup earlier
        COMMAND="$COMMAND rtmp://${T:32}"             



echo "Esperando finalización del proceso: ${PROCESO_FFMPEG}."

MAKE SURE of the location of /bin/bash & /usr/bin/ffmepg (which bash & which ffmpeg)

c. convert the file to be executable

chmod +x ffmpeg

d. now we have to make jibri run this script instead of the main ffmpeg

systemctl edit --full jibri

No add this line in [Service] section. please ensure your java_path is correct. else it will fail


Save and you are all set to go

I recommend that you test it with burner accounts on all platforms. I prefer having a manual control in going live. You can enable auto-start but i prefer to CLICK on the GO LIVE button on all the platforms

Now start a meeting. Click on “Start Live Stream”. You can put any thing in the box. it really doesnt matter. I put the YT streamkey.

Once you go live, you should see the preview show up on all platforms

Feedback welcome


Thanks to @xranby . He has show how you can modify the code to address the ONE-TO-MANY use case.

Head over here. once you make changes, you have to “make” your own build.


Really nice!.. Well done, iLike! :+1:

This command is not working on my server.
OS: Ubuntu 16.04, Niginx is installed.

Error: E: Unable to locate package libnginx-mod-rtmp

What should i do to fix this?

Use Ubuntu 18.04 LTS - why are you using 16.04 LTS ?

The package you need is not available in Ubuntu 16.04 LTS.

1 Like

doesnt work on 16.04

Super @masteryoda,

This is valuable guide. May I suggest you to write this too on Jibri’s Wiki or Jits-Meet Wiki (if you have been a Jitsi contributor, i hope)?. Love to see it could help a lot of people for the same quest.

Also, my question: How and does this change has been secured and saved outside jibri folder from future Jibri’s overwrite update (you, know, I am not too smart :slight_smile: actually) attempt in future?

Thank you.

thanks, good idea. I’m not a contributor though.

since the script is standalone one, not a part of jibri, any updates wouldnt affect it.

Not sure if this is a very basic question as I am not well versed with how streams works , but what if FaceBook and Youtube having different Live Stream Key ?. Stream Key passed as parameter to jibri from meet and same used in script here. Pardon me if I missed anything here

jibri is “made to believe” that its streaming to youtube. jibri, internally, hands off the job to ffmpeg. what the script is doing is kind of proxying that ffmpeg stream to a ngnix/rtmp proxy which in turn can stream to multiple platforms simultaneously


Thanks a lot for explaining so clearly. If I understood correctly, here jitsi-meet will pass stream key for youtube only. and internally same key passed to nginx rtmp server. Youtube streamed using jitsi-meet passed stream key and FB live will use static hard coded key mentioned in script.

you have to use respective streamkeys from each provider

the streamkey passed from jitsi to jibri will anyway be dropped by the nginx/rtmp proxy. you can actually put any character in the streamkey dialog box on jitsi-meet. it will still work… its just safer to use a streamkey. you can pretty much us eany key.

Use the CORRECT Stream-key in the nginx.conf file of the rtmp/nginx server though. else it wont work


Bow shall you take @masteryoda :pray:t2:

This works very well! I made slight modifications to make it configurable and added it to my Terraform configuration for AWS here:

I have tested it with simulcast streaming to Facebook, YouTube, Periscope/Twitter, and Twitch at the same time. Also made all recordings available under /recordings with basic auth enabled. Wooohoo!


there is a redundant step i guess. if you enable recording folder in jibri & also in the nginx proxy, it will be recorded in 2 places. you can disable in 1 place.

@masteryoda I’m moving Jibri’s recorded files from /tmp/recordings to the webroot in my script that runs after a recording is stopped. So ultimately they all stay under one location on the filesystem.


1 Like

Continuing the discussion from Stream to any OR Multiple RTMP Destinations + Record Simultaneously:

This is regarding facebook live script, first of all thanks for posting such a useful script.

I have upgraded ffmpeg in system which support rtmps: protocol , I made a few changes in script to directly send to FB via rtmps://, and my script is as below,



while test $# -gt 0
T="1" if [ "{1:0:32}" == “rtmp://” ]; then
# T will contain the rtmp key from jitsi meet page.
COMANDO="COMANDO rtmps://{T:32}"
echo “$COMANDO”>/tmp/logs
and can in logs that below command getting executed ,
/usr/local/bin/ ffm peg -y -v info -f x11grab -draw_mouse 0 -r 30 -s 1280x720 -thread_queue_size 4096 -i :0.0+0,0 -f alsa -thread_queue_size 4096 -i plug:cloop -acodec aac -strict -2 -ar 44100 -c:v libx264 -preset veryfast -maxrate 2976k -bufsize 5952k -pix_fmt yuv420p -r 30 -crf 25 -g 60 -tune zerolatency -f flv rtmps://

But on FaceBook live, no audio video is coming just a simple screenshot with log in event that “Live service received the video”

is it frame rate or codec issue ?


just remember that jibri on its own can only stream OR record not both. thats why i’ve removed the record button in my setup and do all recording (if required) using the nginx/rtmp server .

one more thing. you must install prosody 0.11.x for secure domain + room password to work. else if you set a room password or meeting password, jibri will not work

i dont think it will work. the streamkey for FB is not the same as YT. so if you dont use the nginx/rtmp proxy you can only stream to FB OR Youtube.

Yes right, its not a final script I was just testing with FaceBook without apache and stunnel as my ffmpeg support rtmps:// . This script is serving purpose by changing url for FaceBook , and I can notice same in ps -ef and log
/usr/local/bin/ ffm peg -y -v info -f x11grab -draw_mouse 0 -r 30 -s 1280x720 -thread_queue_size 4096 -i :0.0+0,0 -f alsa -thread_queue_size 4096 -i plug:cloop -acodec aac -strict -2 -ar 44100 -c:v libx264 -preset veryfast -maxrate 2976k -bufsize 5952k -pix_fmt yuv420p -r 30 -crf 25 -g 60 -tune zerolatency -f flv rtmps://

But audio/video not coming on facebook live , despite events log of Facebook says video received

Does YouTube and FaceBook not support same ffmpeg options like bitrate/codec. Facebook receiving my command on live url using stream key , but video and audio not coming

i guess not… FB requirements are quite finicky, so not sure…