How to setup jitsi live streaming with Nginx RTMP

Hi , I have installed Nginx rtmp module and for broadcasting the meeting , I tried entering the rtmp url in jitsi but it doesn’t happen , and after 2 seconds it says streaming stopped , I had installed jibri and recording is also working , so issue shouldn’t be from jitsi side , can anyone help please…???

Check jibri logs for errors to have a better idea of what is going on.

rtmp://152.67.7.76/live/stream

Here is the url of rtmp I had stepped , btw its also not working in the official public jitsi , can you guide , what’s wrong with my rtmp , also checked the jibri logs , its just also says connection failed , here are the logs

2022-09-08 19:20:48.416 INFO: [5393] [session_id=xgxkcixxcvveokdc] EmptyCallStatusCheck.#26: Starting empty call check with a timeout of PT30S
2022-09-08 19:20:48.432 INFO: [5393] [session_id=xgxkcixxcvveokdc] JibriSelenium.onSeleniumStateChange#215: Transitioning from state Starting up to Running
2022-09-08 19:20:48.432 INFO: [5393] [session_id=xgxkcixxcvveokdc] StreamingJibriService$start$2.invoke#118: Selenium joined the call, starting capturer
2022-09-08 19:20:48.452 INFO: [5393] [session_id=xgxkcixxcvveokdc] JibriSubprocess.launch#42: Starting ffmpeg with command ffmpeg -y -v info -f x11grab -draw_mouse 0 -r 30 -s 1920x1080 -thread_queue_size 4096 -i :0.0+0,0 -f alsa -thread_queue_size 4096 -i plug:bsnoop -acodec aac -strict -2 -ar 44100 -b:a 128k -af aresample=async=1 -c:v libx264 -preset veryfast -maxrate 2976k -bufsize 5952k -pix_fmt yuv420p -r 30 -crf 25 -g 60 -tune zerolatency -f flv rtmp://152.67.7.76/live/stream ([ffmpeg, -y, -v, info, -f, x11grab, -draw_mouse, 0, -r, 30, -s, 1920x1080, -thread_queue_size, 4096, -i, :0.0+0,0, -f, alsa, -thread_queue_size, 4096, -i, plug:bsnoop, -acodec, aac, -strict, -2, -ar, 44100, -b:a, 128k, -af, aresample=async=1, -c:v, libx264, -preset, veryfast, -maxrate, 2976k, -bufsize, 5952k, -pix_fmt, yuv420p, -r, 30, -crf, 25, -g, 60, -tune, zerolatency, -f, flv, rtmp://152.67.7.76/live/stream])
2022-09-08 19:20:49.963 INFO: [5397] [session_id=xgxkcixxcvveokdc] FfmpegCapturer.onFfmpegStateMachineStateChange#130: Ffmpeg capturer transitioning from state Starting up to Running
2022-09-08 19:20:49.963 INFO: [5397] [session_id=xgxkcixxcvveokdc] StatefulJibriService.onServiceStateChange#39: Streaming service transitioning from state Starting up to Running
2022-09-08 19:20:49.964 INFO: [5397] XmppApi$createServiceStatusHandler$1.invoke#328: Current service started up successfully, sending on iq
2022-09-08 19:20:53.455 FINE: [19] [session_id=xgxkcixxcvveokdc] ProcessStatePublisher$startProcessAliveChecks$1.invoke#86: Process ffmpeg hasn’t written in 2 seconds, publishing periodic update
2022-09-08 19:20:53.455 INFO: [5397] [session_id=xgxkcixxcvveokdc] FfmpegCapturer.onFfmpegProcessUpdate#121: Ffmpeg quit abruptly. Last output line: Conversion failed!
2022-09-08 19:20:53.455 INFO: [5397] [session_id=xgxkcixxcvveokdc] FfmpegCapturer.onFfmpegStateMachineStateChange#130: Ffmpeg capturer transitioning from state Running to Error: QuitUnexpectedly SESSION Conversion failed!
2022-09-08 19:20:53.455 INFO: [5397] [session_id=xgxkcixxcvveokdc] StatefulJibriService.onServiceStateChange#39: Streaming service transitioning from state Running to Error: QuitUnexpectedly SESSION Conversion failed!
2022-09-08 19:20:53.456 INFO: [5397] XmppApi$createServiceStatusHandler$1.invoke#311: Current service had an error Error: QuitUnexpectedly SESSION Conversion failed!, sending error iq
2022-09-08 19:20:53.456 FINE: [5397] JibriStatsDClient.incrementCounter#38: Incrementing statsd counter: stop:live_stream

There is ffmpeg log written, I think anything there?

???
Can you elaborate??

Share your ffmpeg log.

Hi everyone found the obstacle , it’s in rtmp module (in nginx) , that’s why it disconnects after some time ,
In the logs Nginx is saying

[error] 4945#4945: *5320 access forbidden by rule, client: 122.161.73.138, server: 0.0.0.0:1935

Anyone here can help with this , thanks in advance for any kind of possible help by anyone

Here is the configuration of Nginx


user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
	worker_connections 768;
	# multi_accept on;
}

http {

	##
	# Basic Settings
	##

	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	keepalive_timeout 65;
	types_hash_max_size 2048;
	# server_tokens off;

	# server_names_hash_bucket_size 64;
	# server_name_in_redirect off;

	include /etc/nginx/mime.types;
	default_type application/octet-stream;

	##
	# SSL Settings
	##

	ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
	ssl_prefer_server_ciphers on;

	##
	# Logging Settings
	##

	access_log /var/log/nginx/access.log;
	error_log /var/log/nginx/error.log;

	##
	# Gzip Settings
	##

	gzip on;

	# gzip_vary on;
	# gzip_proxied any;
	# gzip_comp_level 6;
	# gzip_buffers 16 8k;
	# gzip_http_version 1.1;
	# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

	##
	# Virtual Host Configs
	##

	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;
}


#mail {
#	# See sample authentication script at:
#	# http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
# 
#	# auth_http localhost/auth.php;
#	# pop3_capabilities "TOP" "USER";
#	# imap_capabilities "IMAP4rev1" "UIDPLUS";
# 
#	server {
#		listen     localhost:110;
#		protocol   pop3;
#		proxy      on;
#	}
# 
#	server {
#		listen     localhost:143;
#		protocol   imap;
#		proxy      on;
#	}
#}
rtmp {
        server {
                listen 1935;
                chunk_size 4096;
                allow publish 127.0.0.1;
                deny publish all;

                application live {
                        live on;
                        record off;
hls on;
hls_path /var/www/html/stream/hls;
hls_fragment 3;
hls_playlist_length 60;

dash on;
 dash_path /var/www/html/stream/dash;
                }
        }
}

You allow only the local publishers. Add Jibri IP too using a new “allow publish...” line

Thanks , this solved it , now how can i implement the firewall or dns rule in my jitsi server to point youtube rtmp to my rtmp server , so it can work directly , much appreciated and thanks in advance

You may use your RTMP link as stream key while starting the stream