How to set up your own private RTMP server using nginx

All Versions How to set up your own private RTMP server using nginx

I've done some experiments with this and I've some questions.
My streaming PC (the encoding one with rtmp) is set to encode incoming stream to 720@60fps.
I've ran some tests. If I sent a 1080p@60 fps to the streaming PC from the gaming PC, the output would lag badly. Kind of looks like 5 fps. CPU% of the streaming PC was at 60~ish percent, so I don't think that's a problem.

When downscaling from 1080p60 to 720p@60 on the gaming PC before sending it over to the streaming PC, the output from the streaming pc don't lag.

Not sure why this happens, so just wanted to know if you know why this might be happening? No dropped frames, no high encoding usage on the gaming PC either. Games run perfectly smooth as I am using nvenc to encode.

A side note, it's probably not relevant to this thread, but using gamecapture on GTAV in fullscreen is not smooth. Game is smooth but the capturing isint and the stream looks like 30fps. But when going out of fullscreen and using windowcapture, the stream is buttery smooth.

Thoughts?
 
dodgepong submitted a new resource:

How to set up your own private RTMP server using nginx - A somewhat advanced guide for Linux-based servers



Read more about this resource...
This works great and I am able to stream and view it with VLC just like the documentation says, but here's my issue. When I used ustream, they gave me an embed code that I could use for a player. I would simply put that into a text widget on my Wordpress site. How do I get an embed code to change the one on my site to point to my NGINX server?
 
What does this mean in regards to bandwidth using:

So when I have 2 streamers stream to my server, and I download both of them, I can chew up 10GB of bandwidth in 2 hours.

Say I have 2 people who want to broadcast and I have 1000 viewers for a 1-2 hour show how much bandwidth should I expect to eat up?
 
@Rockisdead, that error comes up if nginx runs without rtmp module. You probably have to remove nginx first and then install it with rtmp-module.
I'm confused on this part. When I download the files from the link in the guide (for Windows), I'm downloading nginx 1.11.0.1 WhiteKnight.zip. There isn't actually anything to install though. Am I using the wrong files? How do I actually install the rtmp module?
 
Thanks for the guide, I can live stream and connect to the rtmp server using rtmp://server/live/stream

I am having issues trying to configure ngix to accept the stream and publish it as http? Can someone point me in the right direction? I had tried to follow several instructions online and most base their examples on static files and HLS.

Thanks
 
After re-reading the article, found the following:

You can use the video source plugin to add an RTMP stream to OBS itself, or use something like JWPlayer to play back the RTMP stream on a web site you set up.

this is where i need assistance! The video source plugin link does not work....
 

Fenrir

Forum Admin
After re-reading the article, found the following:

You can use the video source plugin to add an RTMP stream to OBS itself, or use something like JWPlayer to play back the RTMP stream on a web site you set up.

this is where i need assistance! The video source plugin link does not work....
That plugin was for Classic, and Classic is no longer supported. Media Source is part of OBS Studio by default now and has the same functionality.
 
So how do I get it so that I can have it on my website? I am streaming to my RTMP server, but don't know how to get it from there to my website. Can you help me with that? Running WP and all of the plugins I have found I can't get to work. If someone has any advice or a step by step guide, it would be appreciated!
 

Fenrir

Forum Admin
So how do I get it so that I can have it on my website? I am streaming to my RTMP server, but don't know how to get it from there to my website. Can you help me with that? Running WP and all of the plugins I have found I can't get to work. If someone has any advice or a step by step guide, it would be appreciated!
Video source was for adding the stream to another OBS instance. You need to use a web player to add it to your website. Just search for "play RTMP stream with jwplayer" or something similar.
 
Ok Guys, here is a strange Issue with a Windows > Linux Config. I followed this Guide Step by Step. Two Times, with two different nginx Versions.

Windows = Gaming Machine > OBS > Nginx on Linux
Linux Mint = Streaming Machine. Nginx > OBS > Twitch

Two different PC´s in one Network.

Windows: 192.168.1.4
Linux: 192.168.1.6

Port 1935 is forwarding to 192.168.1.6

Installed nginx and the rtmp modul on Linux and its working (browser shows the nginx welcome page)
I can access this Welcome Page from Windows too
I can ping Linux from Windows

Setup in OBS on Windows
rtmp://192.168.1.6/live

Config in nginx on Linux:
#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root html;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}


# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}

rtmp {
server {
listen 1935;
chunk_size 4096;



application live {
live on;
record off;
}
}
}

I hit Stream on my Gaming OBS and it says "Failed to connect to server"

OBS Log says
22:38:11.724: [rtmp stream: 'adv_stream'] Connecting to RTMP URL rtmp://192.168.1.6/live...
22:38:11.724: [rtmp stream: 'adv_stream'] Interface: Killer e2200 Gigabit Ethernet Controller (ethernet, 1000 mbps)
22:38:12.725: 192.168.1.6/live is offline. Try a different server (ECONNREFUSED).

Advanced Port Scanner dont show me Port 1935 to be open. On my Linux Machine, there is a Windows 10 Partition. With Windows 10, and nginx for Windows, it works. The Port Scanner shows me Port 1935 to be open. So it has to be a Problem with my network or Linux/Nginx. Any sugestions?
 
Ok Guys, here is a strange Issue with a Windows > Linux Config. I followed this Guide Step by Step. Two Times, with two different nginx Versions.

Windows = Gaming Machine > OBS > Nginx on Linux
Linux Mint = Streaming Machine. Nginx > OBS > Twitch

Two different PC´s in one Network.

Windows: 192.168.1.4
Linux: 192.168.1.6

Port 1935 is forwarding to 192.168.1.6

Installed nginx and the rtmp modul on Linux and its working (browser shows the nginx welcome page)
I can access this Welcome Page from Windows too
I can ping Linux from Windows

Setup in OBS on Windows
rtmp://192.168.1.6/live

Config in nginx on Linux:
#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root html;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}


# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}

rtmp {
server {
listen 1935;
chunk_size 4096;



application live {
live on;
record off;
}
}
}

I hit Stream on my Gaming OBS and it says "Failed to connect to server"

OBS Log says
22:38:11.724: [rtmp stream: 'adv_stream'] Connecting to RTMP URL rtmp://192.168.1.6/live...
22:38:11.724: [rtmp stream: 'adv_stream'] Interface: Killer e2200 Gigabit Ethernet Controller (ethernet, 1000 mbps)
22:38:12.725: 192.168.1.6/live is offline. Try a different server (ECONNREFUSED).

Advanced Port Scanner dont show me Port 1935 to be open. On my Linux Machine, there is a Windows 10 Partition. With Windows 10, and nginx for Windows, it works. The Port Scanner shows me Port 1935 to be open. So it has to be a Problem with my network or Linux/Nginx. Any sugestions?
What about logs on the nginx server?
 
Try enabling logging, you currently have it disabled

Code:
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
Remove the comments.
 
So how do I get it so that I can have it on my website? I am streaming to my RTMP server, but don't know how to get it from there to my website. Can you help me with that? Running WP and all of the plugins I have found I can't get to work. If someone has any advice or a step by step guide, it would be appreciated!
Still no help from people in this forum - my site has been off line for a week. Thanks for nothing
 
Still no help from people in this forum - my site has been off line for a week. Thanks for nothing
You know that this is the OBS support forum, right? Not nginx or web development support? And that what you're asking someone to spend time from their day is something that normally gets charged hundreds, if not thousands of dollars an hour for the experience?

Have some respect, and be patient. There are tons of guides on how to set up a web player to receive an RTMP stream. Did you try searching on your own?

If your site was offline for a week, that means it was working at one point, no? So what did you change if you had it working before? If it wasn't ever working, how can it something that was never online be offline?

https://helping-squad.com/video-js-a-free-alternative/
 
Yes, I do realize that it is an OBS Support Forum. And that is how I found this post. Maybe I can explain it one more time to see if people can help me...

I have setup the RTMP server just like the post in the OBS Support Forum Said.

I can use OBS Studio to take the videos that I have on a USB Stick, do a Window Capture, Stream it to my RTMP server, and go on another PC on my LAN and watch it with VLC Media Player

What I am hoping to do is to find someone that can show me what I am missing to get it from the RTMP server to my website, which is a wordpress site.

I have tried for DAYS to get this working - I think it is a matter of something I need to add in my RTMP config file, but not sure.

If ANYONE is willing to help me, please email me at bcaza@fireuptv.com

Thanks, and I'll stop bothering you now. I figured since the original post was on here, people would be able to help.
 
Yes, I do realize that it is an OBS Support Forum. And that is how I found this post. Maybe I can explain it one more time to see if people can help me...

I have setup the RTMP server just like the post in the OBS Support Forum Said.

I can use OBS Studio to take the videos that I have on a USB Stick, do a Window Capture, Stream it to my RTMP server, and go on another PC on my LAN and watch it with VLC Media Player

What I am hoping to do is to find someone that can show me what I am missing to get it from the RTMP server to my website, which is a wordpress site.

I have tried for DAYS to get this working - I think it is a matter of something I need to add in my RTMP config file, but not sure.

If ANYONE is willing to help me, please email me at bcaza@fireuptv.com

Thanks, and I'll stop bothering you now. I figured since the original post was on here, people would be able to help.
I think you need either flowPlayer or jwPlayer plugin for wordpress. Your RTMP server would need to be publicly addressable, so that these players on your wordpress plugin would find it. You should ask on either the flowplayer or jwplayer web sites for how to configure this. I think you need the paid versions of these players to make things work the way you expect if I'm understanding you correctly.
 
Top