OBS RTMPS Settings for NGINX

C3ns1o

New Member
Hello Guys...

i try to stream to an RTMPS Live with OBS over NGINX.

When i use OBS directlky it works.
With NGINX it will didnt run.

Can me anybody say what settings OBS use for RTMPS?
Ports , VerifyChain etc. what we need in Stunnel to get the Stream run on Kick.

Thanks for Help!
 

Tomasz Góral

Active Member
Soo you need restream ?
like send rtmp -> nginx -> to rtmps serwice ?

Use ffmpeg -i stream_from_nginx -c copy -f flv rtmps://my_target_service
 

C3ns1o

New Member
Thanks for your Time!

I stream with OBS to NGINX and from ther to Twitch Youtoub and Facebook.
Facebook is RTMPS to but i didnt get it to work with Kick. Config is following....

I will try it in next stream. But my VPS is a smal 1 Euro Server... i only use it to get his upload.
Next stream i try this: ffmpeg -i stream_from_nginx -c copy -f flv rtmps://my_target_service

When it works... i give a sign from me! ;)
I think Copy should the 1 Core VPS do :D

My NGINX Config is as follow:
rtmp {
server {
listen xyz;
chunk_size 8192;

application xyz3234 {
live on;
record off;
allow xyz;
#Twitch
push rtmp://live-cdg.twitch.tv/app/live_ xyz;
#Steam
push rtmp://ingest-rtmp.broadcast.steamcontent.com/app/steam_ xyz;>
#Boosty
push rtmp://vsu.mycdn.me/input/ xyzi;
#Facebook
push rtmp://127.0.0.1:xyz/rtmp/FB- xyz;
#Kick
push rtmp://127.0.0.1:1935/sk_us-west-2_ xyz;
}

}
}

Stunnel push the RTMPS to the Port 443 and works well with FB but not with Kick.
Any Tips? :D
pid = /var/run/stunnel4/stunnel.pid
output = /var/log/stunnel4/stunnel.log

setuid = stunnel4
setgid = stunnel4

# https://www.stunnel.org/faq.html
socket = r:TCP_NODELAY=1
socket = l:TCP_NODELAY=1

debug = 4
[kick-live]
client = yes
accept = 1935
connect =xyz.global-contribute.live-video.net:443
[fb-live]
client = yes
accept = xyz
connect = live-api-s.facebook.com:443
verifyChain = no

in 12 Houer i will see if your ffmpeg command works ;)
 

C3ns1o

New Member
Soo you need restream ?
like send rtmp -> nginx -> to rtmps serwice ?

Use ffmpeg -i stream_from_nginx -c copy -f flv rtmps://my_target_service
Good Day....

I have use this line and its didnt work:
exec ffmpeg -i rtmp://localhost/$app/$name -c copy -f flv rtmps://xyz.global-contribute.live-video.net/sk_us-w_xyz;

I think my changes are not right :D

Can you pls find my error? Thanks for Help!
 

Tomasz Góral

Active Member
Good Day....

I have use this line and its didnt work:
exec ffmpeg -i rtmp://localhost/$app/$name -c copy -f flv rtmps://xyz.global-contribute.live-video.net/sk_us-w_xyz;

I think my changes are not right :D

Can you pls find my error? Thanks for Help!
What say nginx logs ?
second use command: ffmpeg -i rtmp://localhost/$app/$name -c copy -f flv rtmps://xyz.global-contribute.live-video.net/sk_us-w_xyz
to run manualy, for $app/$name rewrite to correct value.
 

C3ns1o

New Member
What say nginx logs ?
second use command: ffmpeg -i rtmp://localhost/$app/$name -c copy -f flv rtmps://xyz.global-contribute.live-video.net/sk_us-w_xyz
to run manualy, for $app/$name rewrite to correct value.
If i insert without the command exec, it comes to following error by restart NGINX.

Did you mean i run ffmpeg from command line manual

I try.. i have only the application name. A Name of file didn´t exist. So only the above configs i have maked and exists from strat post.
So the App Name is this: application xyz3234
But where i get the Name?

When i use it in the Config without Exec it comes :
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2023-03-10 18:47:34 UTC; 19s ago
Docs: man:nginx(8)
Process: 34127 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Mar 10 18:47:33 localhost systemd[1]: Starting A high performance web server and a reverse proxy server...
Mar 10 18:47:34 localhost nginx[34127]: nginx: [emerg] unknown directive "ffmpeg" in /etc/nginx/nginx.conf:142
Mar 10 18:47:34 localhost nginx[34127]: nginx: configuration file /etc/nginx/nginx.conf test failed
Mar 10 18:47:34 localhost systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Mar 10 18:47:34 localhost systemd[1]: nginx.service: Failed with result 'exit-code'.
Mar 10 18:47:34 localhost systemd[1]: Failed to start A high performance web server and a reverse proxy server.

When i start it manualy is there a input / output error.. Think its by missing App and Name...

The Error Log is this after a short start and stop from 3 seconds

2023/03/10 18:52:07 [alert] 34231#34231: unknown process 34235 exited on signal 9
2023/03/10 18:53:03 [error] 34231#34231: *11 open() "/usr/share/nginx/html/actuator/gateway/routes" failed (2: No such file or directory), client: xyz server: localhost, request: "GET /actuator/gateway/routes HTTP/1.1", host: "xyz"
2023/03/10 18:53:52 [alert] 34231#34231: unknown process 34252 exited on signal 9


Acces Log is :
[10/Mar/2023:18:52:07 +0000] PUBLISH "xyz" "" "" - 10190620 529 "" "FMLE/3.0 (compatible; FMSc/1.0)" (17s)
[10/Mar/2023:18:53:03 +0000] "GET /actuator/gateway/routes HTTP/1.1" 404 197 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"
[10/Mar/2023:18:53:52 +0000] PUBLISH "xyz" "" "" - 24135195 529 "" "FMLE/3.0 (compatible; FMSc/1.0)" (36s)

And again thanks for your help ;)
 

C3ns1o

New Member
I am confused...

When i do it manual with: ffmpeg -i rtmp://localhost/xyz3234/xyz3234 -c copy -f flv rtmps://xyz.global-contribute.live-video.net/sk_us-west-2_xyz
[rtmp @ 0x55f89eb1b200] Server error: not_found
rtmp://localhost/xyz3234/xyz3234: Operation not permitted

I have try some other line and this one works more....

ffmpeg -i rtmp://localhost:XYZ/xyz3234/xyz3234 -c copy -f flv rtmps://xyz.global-contribute.live-video.net/sk_us-west-2XYZ

Then it comes to this:
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, flv, from 'rtmp://localhost:1946/xyz3234/xyz3234':
Metadata:
Server : NGINX RTMP (github.com/arut/nginx-rtmp-module)
displayWidth : 1280
displayHeight : 720
fps : 60
profile :
level :
Duration: 00:00:00.00, start: 7.883000, bitrate: N/A
Stream #0:0: Data: none
Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp, 131 kb/s
Stream #0:2: Video: h264 (High), yuvj420p(pc, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 5632 kb/s, 60 fps, 60 tbr, 1k tbn, 120 tbc
[tls @ 0x5556f12e7ac0] Error in the pull function.
rtmps://xyz.global-contribute.live-video.net/sk_us-west-2_xyz: Input/output error

Its confusing me hard :D
 

Tomasz Góral

Active Member
maybe check signal and save to file?
ffmpeg -i rtmp://127.0.0.1/xyz3234/my_key -c copy output.mp4

You have ffmpeg compiled or from distro ?
 

C3ns1o

New Member
I have ffmpeg from the distro....

At time i install a new Ubuntu und try it with a docker. I think its some what with ssl that didnt work.

In the Log from NGInx i have see that ffmpeg push the stream over 3 mins and on the end comes nothing.
A nother thing it can be, that they didnt use the port 443. But wy can OBS Stream it directly.

At this point i think its again the SSL on the Server.

HAve you a Tutorial to install NGINX with RTMPS for UBUNTU 20.04 or any Software for a Server that can handle it?

And Thanks for your Time. Iám over 10 years out of my work and think how stupid i can be in this time :D
 

C3ns1o

New Member
So i have try all.. i think i must life with it, that kick.com not allow server ips.
If i find out how i get run it over nginx i will write it her down :D

Thanks for the help and time to try solved it....

cucu´s
 

Tomasz Góral

Active Member
I always compile my own ffmpeg with ssl.
port 443 is not nessesary, because port is 1935, rtmps add security layer.
You need only run normal nginx, add push for rtmp output, add exec for local ffmpeg source.
This ffmpeg receive rtmp and copy to rtmps stream. In that model i build own restream service.
I build own service with authorization and chat, live video server, restream, tally.
 

C3ns1o

New Member
I have found the error...

The Link in the Tutorial shows this Link:
rtmps://xyz.global-contribute.live-video.net/sk_us-west-2XYZ

But when we dont use OBS its this:
rtmps://xyz.global-contribute.live-video.net/app/sk_us-west-2XYZ

Dont know wy... but then it works well.

Thanks for Help... Problem solved!
 
Top