How to set up your own private RTMP server using nginx

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

Selim Atmaca

New Member
Hi,
I succesfully installed nginX with RTMP module and tested with VLC. Now I want to publish my stream on my web site.
Because JWPlayer and FlowPlayer are not free. I am looking for a free way of doing it.
 

GillyMoMo

Member
Hi,
I succesfully installed nginX with RTMP module and tested with VLC. Now I want to publish my stream on my web site.
Because JWPlayer and FlowPlayer are not free. I am looking for a free way of doing it.

Actually JWPlayer is free to a degree if you know where to look on their site. I have it and it requires a bit of know how of js. When I get a chance I can find some free web players that work just as well.
 

Rockisdead

New Member
I got some questions here,how many stream clients can connect to my rtmp url at the same time?How many streams that I can set up on my RTMP server(Raspberry Pi 2),I want to set up two URLS for top PCs to capture their screens and send to RMTP server,then two devices like iPhone or iPad to watch them at the same time like secuirty system.

I tried to use ffmepg to caputre the rtmp url and save it to m3u8 under nginx web folder /usr/local/nginx/html and put the m3u8 within video tag,type I used it "application/x-mpegURL",sometimes it works in safari on my iPhone sometime doesn't and it seemed delay a lot of seconds,by using VCL and RTMP url,delay withing 5-8 seconds I think.with m3u8 more than a minute,can anyone help here,I'm newbie for linux and I want to install nginx server on windows 10,need to do some research before I start.Any suggestions are welcome.
 

Dario

New Member
Hi,
this is a great set up, thanks for the post.
I have a similar problem of 'Rockisdead'.
The stream with RTMP has a ~20 seconds delay, with HTTP it is more than a minute. Is there a way to reduce/eliminate it?
Thanks
 

Dario

New Member
For anyone else with the same issue. I reduced the problem. I was using hls. I read in the guide that without it, the stream is much less delayed.
 
Hey guys, if someone has succeeded can you show your code how you embed your jw player to display live stream .. somehow i can't figure it out.. will be extremely thankful if you can do it :)
 

sumon

New Member
Hi,
I succesfully installed nginX with RTMP module on win10 and tested 127.0.0.1 , it will show welcome page. Now I want to set up obs and hit "Start Streaming" it show failed to connect to the server.and here the config and images of my problem. Thanks if you detect my error.
#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;
}
}
}
 

Attachments

  • 1.jpg
    1.jpg
    103.7 KB · Views: 133
  • 1.jpg
    1.jpg
    103.7 KB · Views: 128
  • 1.jpg
    1.jpg
    103.7 KB · Views: 116
  • 1.jpg
    1.jpg
    103.7 KB · Views: 117
  • 1.jpg
    1.jpg
    103.7 KB · Views: 116
  • 2.jpg
    2.jpg
    101 KB · Views: 119
  • 3.jpg
    3.jpg
    94 KB · Views: 121

simonno

New Member
Hello

My stream seems to work flawlessly, but i don't get any image.
I can ping it, telnet it and stream to it with no error, open http on the server, but not rtmp. Nor can i open the stream directly in smplayer.

Rtmp is just set up with live: on and record: off so i don't know what is oing on. Any tips? Can not get vlc to work on my ubuntu 16.04 either, so i can't test with that.
 

rembomy

New Member
I have everything working, running nginx-rtmp-module on linux (CentOS) and streaming from my Windows PC to the rtmp-module without issues when I use OBS Classic and set buffer <7000kbit.

When I use OBS studio I can not set any buffer for NVENC and this means after some time 1 min-30 min stream randomly disconnects and reconnects. Any ideas what could be causing such behavior?
 
Hi,
I succesfully installed nginX with RTMP module on win10 and tested 127.0.0.1 , it will show welcome page. Now I want to set up obs and hit "Start Streaming" it show failed to connect to the server.and here the config and images of my problem. Thanks if you detect my error.
#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;
}
}
}

Hi, i have the same problem, you have any idea about why is this?
 

Shep

New Member
Hi, thanks for the guide!
I have a problem. I can't connect to the rtmp server even inside a Lan.
Always shows this error:
NeZpjBn.jpg


All step were followed correctly.
No errors in the build stage, nginx is working fine in the standard http port and shows the sample webpage. The server doesn't have a firewall configured.
Tried on Ubuntu and Archlinux.
And I think this is correctly configured:
v0ta3m7.jpg



Some ideas?
So how do you fix this man!! I am getting this same problem and going crazy...says my nginx is running but nobody can connect to my server...not even myself when I try from another laptop
 

Shep

New Member
So followed everything......nginx splash page comes up but OBS won't connect.....is there any suggested trouble shooting for this. I am just tryin to take in two other rtmp streams and combine them in OBS
 

Amr0d

New Member
Hello guys,

I have a question about this before I start renting a server.

Do I need a desktop like Gnome or KDE to use OBS? If so, how can I use it with a remote server? Is it similar to Windows RDP? So far I have only used servers without desktop enviroment.
 

CuriosityCrave

New Member
Is it possible to use this server to take multiple video feeds from my friends' computers through a wifi signal, then transfer those video sources into one source that then cam be edited in OBS?
 

McMoo

New Member
I've set up a nginx server on a pi, just to test the concept, got it to work, but Iwould like to stream directly from the box.

I''d use a pc rather than the Pi to do this (no support for Pi, plus don't think it would handle it), so if I set up a new server on an old PC.

So if I had 3 or 4 video streams coming in to nginx, to then output them to twitch using OBS what sort of specs would I then need to stream?

Looking at what my CPU usage on my gaming rig, with just obs running, it seems to use very little.


Local record and other bits can always come later.

Any ideas?
 

thecrozwell

New Member
I have a dual pc setup Win 10 gaming pc, Kubuntu stream pc. I successfully have the stream outputting to VLC (haven't tried pushing to twitch etc yet) I am currently running 1440 on my gaming pc, i7 7700 gtx 1070, but am outputting the stream to 720 at 60fps.

Everything seems to be smooth except for one, possible, problem. I have a slight delay between my two pc's (connected over LAN) although the quality and everything is fine there is just a delay between gameplay and the stream. Is this normal or do I need to adjust my settings more?

I have tried all the encoders and between 35k and 50k bit rate to the streaming pc. None of it makes a difference there is always an approximately 5 sec delay. I can provide more details as requested!
 
Top