How to set up your own private RTMP server using nginx

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

Enemy

New Member
How much of a delay should I get getting from what I'm broadcasting to what I'm seeing on VLC if everything is being done on a local network / wifi?
 

wired420

New Member
I have this working on CentOS 6, Nginx 1.7.11 serving RTMP and static content while passing php to apache (doesn't save process time but does save memory by 25% with no further strain on cpu, not that a 8 core 32gb ram VM needs it, about 120 people are accessing it internally so I figured overkill then scale down rather than problems to start with.

I have previous experience with Red5. This is MUCH lighter on resources, and doesn't require me to open a Java IDE and build an application and new custom server every time someone wants a video service anymore. This is going to save me tons of time and headache. Bye bye Java. Woo hoo! Besides Jquery I no longer have much of a use for it.

I've also embedded it using the Video.js library into a sharepoint page. I highly recommend that as an embed option over the others. It was much easier to setup. Like 5 lines of code for a basic embed.
 

Hakker

New Member
Instead of JWplayer as your personal site player I would suggest Video.js It's free so no forced watermarks or limitations.

change the demo page and remove all the source and track kind lines (5 lines in the demo page which are lines 23 to 27) with <source src="rtmp://<server address>/live/<stream key>"> and save it as index.html and you're good to go. The rest is offcorse to what you personally want ;)
 

Rideti

New Member
hello, how can i see all my cam & windows in one monitor? is it possibly like at atem window or other tv-program? (sorry, i don't find smth about that at all forum) (stupid blondie)
 

JohannM

New Member
Hi. I installed, but when I run the command to start, it tries to start with an IP 0.0.0.0:8080 ... any idea why ?
 

mrgreaper

Member
first, thank you for the guide!

I have this running on my pi2 and i have a webpage using the jwplayer template on page 2 and its all working great but here is where i get a bit confused.

what i want to do is set it up to push to twitch (this wont be an issue) but i also want another setup that does not so i can stream i can stream to just my friend via the jwplayer sometimes and other times stream to my mate and twitch (my mate is my co-host for the live streams so he needs the jwplayer screen so he isnt 20 seconds behind the video...stupid twitch.

do i just add a second

Code:
rtmp {
        server {
                listen 1935;
                chunk_size 4096;

                application live {
                        live on;
                        record off;
                }
        }
}
to the bottom so its doubled up and set the second one to push to twitch? if so how do i tell it to use the first rtmp block instead of the second? do i give them different listen ports?

very confused
 

Streamline

New Member
Hello,

I have followed this guide and ended up with it working, but I have two issues:

There is a 15 seconds delay between OBS and the client (no delay specified in OBS), and also on the client-side, the video regularly stops after ~10 seconds for 10 seconds before starting again (buffering?). I've tried different bitrates ranging from 3500 to 1500 but the issue stays the same.

No dropped frames in OBS btw.
 
Last edited:

Fabbbio

New Member
I'm very newby, I'm trying to stream my video. In this 3d I saw many many answer but I'm real confused about solutions.
I have the last OBS, the OBS side is simply and it run perfect.

Nginx side is not easy (only rtmp stream is ok with flowplayer), I have nginx 1.9.
I want to stream for all kind of device (laptop,mac,android and ios) so I think about HLS and DASH or ? but how to setup correctly?
I read and read but without finding a final clear solution.
Someone can help me step by step?
Maybe with 2 stream quality like 700kbps and like 2000kbps (but this is a second step)

Thanks
 
Last edited:

fuzzyfractal42

New Member
Hi, I've followed the guide exactly and it works great. The only thing I would like to know is how I do set up a working Stream Key on the server so that it is secure? In other words to have the stream authenticated using the Stream Key like on Twitch? Can anybody help me? Running this on a Raspberry Pi B.
 

Hoerli

New Member
Hey
I have a nginx Server running on my vServer.
I can stream on Twitch, HitBox, GamingTV, GamingLiveTV and DailyMotion, but i can't stream to uStream and Livestream.com.
Does anyone know how to fix that?

I've read the Posts, but can't find any solution for my problem.


In the nginx.conf-file i added the Stream-URL and keys for both Websites
push rtmp://NUMBERS.fme.ustream.tv/ustreamVideo/NUMBERS/STREAMKEY;
push rtmp://publish.livestream.com/mogulus/CHANNELNAME/username=USERNAME/password=PASSWORD/isAutoLive=true;
but the streams doesn't go live.

I use the normal RTMP-Plugin with the basic config-file.
 

OriginDev

New Member
Need Help - How do I troubleshoot to track down a connection error?

I've set up a simple server on a Google VM running Ubuntu. Followed the instructions and didn't have any difficulty through the install process. When I try to start a stream I get the standard "Could not connect" error.

I can ping the server.
I can see the ngingx start page from a web browser.

The conf file and every other step were followed as described. Not sure where the error is here or how to track it down further. I don't seem to have any communication issues between my home PC (Windows 7) and the Google hosted Ubuntu server outside of OBS (which I am not very familiar with). Looking for troubleshooting tips or a set of steps to follow to diagnose the issue.

Don't see anything helpful in the syslog on the Ubuntu server, but not sure what to look for so I may be missing it.
Don't see anything about a blocked connection or request in my router log indicating the IP address of my server.
Followed some troubleshooters to see if windows was blocking it, but it looks good (again, not too sure what to test here).

Log File information:
Code:
09:14:23: librtmp error: The connection timed out. Try a different server, or check that the connection is not being blocked by a firewall or other security software (10060).
09:14:23: Connection to rtmp://[ipaddress]/live failed: Could not connect to server
09:14:23:
09:14:23: The connection timed out. Try a different server, or check that the connection is not being blocked by a firewall or other security software (10060).


Also - built and killed 3 machines now so verify there was nothing else on them that could be causing an error, and same issue each time.


Edited to Add: tried streaming to a local raspberry pi with a similar setup as well, and that failed with the same error. It's either an error in my OBS settings or the windows firewall, but need help troubleshooting those.
 
Last edited:

OriginDev

New Member
My guess is that there is a firewall somewhere preventing connections over TCP 1935.

Any idea how to track it down? I've streamed from this computer using Adobe Encoder and Wirecast in the past, though not to my own nginx/rtmp box. I'm assuming they use 1935, but I could be wrong. I've traced everything I know how to trace regarding IP connections from the computer to the server and I have no problems. I've verified the server has 1935 open and listening.

Looking for help troubleshooting the connection, a set of steps to eliminate possibilities.
What settings should I check in OBS that can cause this error?
Should casting from Flash Encoder or Wirecast to the nginx/rtmp box work (I haven't tried that yet, just thought of it)?
Know of any way to connect to port 1935 on the server from the computer command line just to test the path over that port outside the software?
Are there issues with OBS in 64bit vs 32bit?

If "there's a firewall" how do I find where it so I can disable it. Not asking you to tell me how to configure my computer or router, that's my problem, but how do I determine where the block is. I have full control over the broadcast box, the local network, and the receiving server. Only thing I don't have full control over is my ISP.
 

OriginDev

New Member
Also noted I cannot cast to either from FMLE either. Assuming it is something with the Linux box, but no idea how to trace down the issue.

For Brevity - I've removed everything that was commented out.

Code:
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;

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

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}
rtmp {
        server {
                listen 1935;
                chunk_size 4096;

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

henry_brown

New Member
I did this in a virtual machine (centos on virtualbox). I can't access the server from my host machine. OBS says the server is offline, and visiting the address in the browser doesn't give me the nginx default page; it gives me a blank page. Is it not at localhost/127.0.0.1 ?
How would I find out which address to use?
 

OriginDev

New Member
I did this in a virtual machine (centos on virtualbox). I can't access the server from my host machine. OBS says the server is offline, and visiting the address in the browser doesn't give me the nginx default page; it gives me a blank page. Is it not at localhost/127.0.0.1 ?
How would I find out which address to use?
Going to localhost or 127.0.0.1 from the host would point at your host machine, which may or may be routed to the virtual machine web server. Depends how your virtual box is configured. In the VirtualBox Manager, check your network settings for the virtual machine. If you want the virrtual machine to act like just another computer on the network, make sure the adapter is set to Bridged mode. Alternatively you can setup a host only adapter so that only the host machine can see the virtual machine.
In either case, start the virtual machine and open a terminal window.
Type ifconfig, and that shoudl return your ip address.
Visit that ip address from the host machine and you should see the nginx start page if it is configured correctly.
 

OriginDev

New Member
Anyone know of anywhere else to find information about how to troubleshoot this setup?

I'm not sure if the issue is with local network, OBS, the nginx/rtmp configuration, or a combination. All I know is that it isn't working following these instructions. I've tried making this work on a Google hosted VM, a local network raspberry pi, and a local machine virtulaBox. Each time I get the same issue - OBS can't connect to the server. I thought it maybe an iptables issue on the receiving machine, but the last one I built was wide open and same error.

Google searching the issue leads right back to here, so not very helpful. HELP PLEASE!!!
 
Top