How to set up your own private RTMP server using nginx

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

Fireplayer

New Member
Hello, RTMP Server is ready for this year, but i have a problem:
my stream is lagging. for 10sec the is video runing, than it stops and 5sec later is running again and lagging again...
how can i fix it?

The sound is normal and dont lagging
 
I have some experience with vmware rtmp nginx through windows on a second pc, but I'm planning on setting up a homeserver(backups, mediastreaming, etc, but what's the best (free) OS(user friendly) to choose that has an rtmp nginx app? For dual pc streaming without a capture card of course.
 

GillyMoMo

Member
I have some experience with vmware rtmp nginx through windows on a second pc, but I'm planning on setting up a homeserver(backups, mediastreaming, etc, but what's the best (free) OS(user friendly) to choose that has an rtmp nginx app? For dual pc streaming without a capture card of course.

I am working on a Linux distro that does exactly that. The biggest issue though is that the nginx part just isn't user friendly just yet but I am working towards getting that there. It has OBS and you are able to transcode (which is what I do now with my own distro). Check my link in the tools part of the forum!
 
I am working on a Linux distro that does exactly that. The biggest issue though is that the nginx part just isn't user friendly just yet but I am working towards getting that there. It has OBS and you are able to transcode (which is what I do now with my own distro). Check my link in the tools part of the forum!

Awsome man!

Downloading v1.2.3.. at this very moment.


Really curious. Will report back :)
 

Konorr

New Member
Hello,

I have setup a nginx rtmp server using this guide and everything work except that I have a bug.

If I load the viewer's page after the stream has already begun. It will only show a black screen with the sound.

To make it work I either have to restart the stream or switch to another scene and then get back to the right scene.
But If the viewer reload his page or a new viewer connects I have to do it again. Kinda annoying.

I'm using :
- nginx rtmp server
- OBS
- UMedia Flash player

I don't know which one cause the problem but I have test with another player and the bug was still there.

Nginx config file :
I have remove the HTTP part as it was conflicting with my LAMP. I tried with it but that didn't solved anything.

-----------

#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;​
}

rtmp {
server {
listen 1935;
chunk_size 4096;
buflen 1ms;
wait_video off;
out_queue 8;
play_restart on;
publish_notify on;​

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

-----------​

Thanks for your help and your time.
Konorr.
 

viktor6

New Member
when I run the stream OBS> Twitch the notice comes to email,
And when I run stream OBS> Nginx> Twitch no notifications to email,
 

Brot

New Member
Hello,
I have a problem with this rtmp. I use guide to stream to twitch and youtube at the same time without using server but my computer. I have two computers 1- to playing, 2- to streaming, have got avermedia too. I am using this code:
#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;
}


rtmp {
server {
listen 1935;
chunk_size 4096;

application live {
live on;
record off;
push rtmp://live-ams.twitch.tv/app/yourkeyhere;
push rtmp://live-ams.twitch.tv/app/yourkeyhere;
}
}
}

Of course i change one of them to youtube. But when i am streaming to twitch, stream is lagging, to youtube not. Twitch have some requirements about quality, i want to set up a framerate, bitrate and others. how the code should look like?
Thanks for helping me and sorry for my english.
 

zedd

New Member
Hi hoping to get some help on this. i'm looking to take a incoming a rtmp link and just rebroadcast it through a server i have in a datacenter. Would i need to set up the nginx server on the datacenter server and then what configuration would i use to acomplish the rebroadcast?

thanks
 

Roger Dods

New Member
This is a great guide! I have followed your instructions and used a digital ocean droplet as my server. I am using OBS .657b and windows 10. I can access my stream by putting the rtmp link into VLC. However, it seems to be a bit choppy and there is about a 20 second delay time between input and seeing it happen.

I read other people on here getting between 1 and 3 second delays. Any ideas on what is happening with my setup?

I will try again later at home where I have a much higher upload speed, but I'm doubting that is the issue. Here I have about 20 mbs upload.

EDIT: Ok for some reason it was just VLC. Other RTMP players had a lag of around 4 seconds which is better. Not sure why, but just updating in case this helps someone else.
 
Last edited:

mfogleman

New Member
I keep getting an error during the "build nginx" section. When I run the "make"command I get this output:

make error ** No rule to make target 'build', needed by 'default'. Stop.
I'm pretty sure I have done everything right up to that point. This is running on Ubuntu server 14.04.

Any ideas what could be causing this?
 

Fenrir

Forum Admin
Not sure how often this thread is watched anymore, but having a bit of an issue with a more advanced configuration and not really sure where else to turn for support.

I have a custom stream site set up that was working fine, using on_publish directive for stream authentication against a database of users and assigned stream keys. Today, I enabled SSL and everything else about the site is working correctly, outside the on_publish directive. Issue #1 is that it doesn't allow me to enter an https:// link (nginx -t fails), but it sort of works if I leave it as http. However, the returned stream key sent back to the rtmp-module is the entire GET url, and not just the stream key as expected.

Here is my server block to redirect to HTTPS:

Code:
server {
        listen       80;
        server_name    my.domain.name;
        return         301 https://$server_name$request_uri;
}

With on_publish directive turned of, my.stream.key is returned correctly. With on_publish turned on, it returns:

Code:
https://my.domain.name/authcode.php?app=live&flashver=FMLE/3.0%20(compatible%3B%20obs-studi&swfurl=rtmp://my.domain.name/live&tcurl=rtmp://my.domain.name/live&pageurl=&addr=xx.xx.xx.xx&clientid=15813&call=publish&name=my.stream.key&type=live

Any ideas how I can correct this? I'm a bit puzzled why it's returning the whole URL string instead of just the my.stream.key part. Is there some way I should edit the non-SSL server block to allow for this specific file?
 
Last edited:

iborb001

New Member
I am trying to set up v 1.9.12 on a Raspberry Pi 2. The steps work until I get to the step running the confiure. I get permission denied. The same occurs for 1.9.5.

root@rasp03:/media/pi/RASPDATA/nginx-1.9.12# ./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-master
bash: ./configure: Permission denied

I have tried forcing the execute bit on configure, but it still remains rw only.

chmod +x configure

root@rasp03:/media/pi/RASPDATA/nginx-1.9.12# ls -al
total 673
drwx------ 1 pi pi 4096 Feb 24 08:53 .
drwx------ 1 pi pi 4096 Mar 3 17:34 ..
drwx------ 1 pi pi 4096 Mar 3 17:34 auto
-rw------- 1 pi pi 259440 Feb 24 08:53 CHANGES
-rw------- 1 pi pi 395257 Feb 24 08:53 CHANGES.ru
drwx------ 1 pi pi 4096 Mar 3 17:34 conf
-rw------- 1 pi pi 2481 Feb 24 08:53 configure
drwx------ 1 pi pi 0 Mar 3 17:34 contrib
drwx------ 1 pi pi 0 Mar 3 17:34 html
-rw------- 1 pi pi 1397 Feb 24 08:53 LICENSE
drwx------ 1 pi pi 0 Mar 3 17:34 man
-rw------- 1 pi pi 49 Feb 24 08:53 README
drwx------ 1 pi pi 4096 Mar 3 17:34 src
 

firefist235

New Member
I also have a problem with stuttering.
I am streaming with a bitrate of 25000kbits and 7000k buffer to my RTMP Server. The RTMP Server uses a i5-2300 @ 2,8GHz with 4 Cores, 4 GB RAM, GBit LAN and system runs on a SSD. With my current setting file, the CPU never goes above 50% utilization. But when i watch the stream with VLC, i get the Video for about 5 secs, then it hangs for another 5 secs aprox. and so on.

My current nginx.conf
Code:
#user nobody;
worker_processes 4;

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

events {
worker_connections 8096;
multi_accept on;
use epoll;
}

worker_rlimit_nofile 40000;

rtmp {
server {
listen 1935;
chunk_size 8192;

application transcode {
live on;
record off;
exec ffmpeg -re -i rtmp://localhost:1935/transcode/$name -vcodec libx264 -preset ultrafast -x264opts nal-hrd=cbr:force-cfr=1:keyint=60 -r 30 -b:v 3500k -maxrate 3500k -bufsize 3500k -threads 4 -s 1920x1200 -acodec copy -f flv rtmp://localhost:1935/live/${name};
}
application live {
live on;
record off;
#    push rtmp://live-fra.twitch.tv/app/###################################;
}
}
}
 

Alvin Mantovani

New Member
Hello, is there possible to combine HLS and RTMP ? Currently i had RTMP Server, if possible how to combine the HLS for android streaming without remove or change RTMP one, because RTMP doesn't support on Android (as my review).
 

devguy

New Member
This worked like a charm, excellent instructions! I was able to get this working on kubuntu15.10 with VLC to view the stream on localhost for testing.

Thank you for sharing!
 
Top