How to set up your own private RTMP server using nginx

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

Zerchu

New Member
Hi there
thank you for this tutorial but I'm having a problem with getting OBS to connect. ive gone over the logs but i just cant find what is causing my problem. The error OBS gives me is this:
"Could not access the specified channel or stream key. This could be because use the key/channel is invalid, or because the server thinks you are logged in.
RTMPSockBuf_Fill, remote host closed connection"
i'm trying to run the server off a raspberry pi that is connected to my router and stream from my pc.

Sorry in advance if this is really simple to fix
thankyou
 

tomisme

New Member
Hi there
thank you for this tutorial but I'm having a problem with getting OBS to connect. ive gone over the logs but i just cant find what is causing my problem. The error OBS gives me is this:
"Could not access the specified channel or stream key. This could be because use the key/channel is invalid, or because the server thinks you are logged in.
RTMPSockBuf_Fill, remote host closed connection"
i'm trying to run the server off a raspberry pi that is connected to my router and stream from my pc.

Sorry in advance if this is really simple to fix
thankyou

I am having this exact issue since I upgraded to windows 10. Have you had any luck fixing the issue?

It was running flawlessly on windows 7 :/
 

bifuteki

Member
So I have been using this for a few months. Will say its great for events. Just wondering if this is possible. Basically looking to see if there is a possibility to play local video files from the server (maybe in random order) when not streaming until someone connects and again when he goes offline? If not, just a black screen or an image?
 
I am having this exact issue since I upgraded to windows 10. Have you had any luck fixing the issue?

It was running flawlessly on windows 7 :/
I was having the exact same problem after I upgraded to Windows 10 :(

I figured I'd try some different software instead of nginx rtmp to see if that was the issue so tried the free version of DataVideo's DVS-100 software: http://www.datavideo.com/us/Encoders/DVS-100

datavideo.png


And LOL! It's using Nginx RTMP for its engine!!!!!!!

But SUPER weird, OBS connected to it PERFECTLY first try!!! Been streaming for 2 hours straight now, not one dropped packet, running flawless!

obs_stream_settings.png


I had a different port set up, but it wouldn't connect. So I put it back to the stock port (1935) and as long as I don't use :1935 in the FMS URL it works fine.

Hopefully this helps someone else!

-Jamie M.
(P.S. I'm using Datavideo DVS-100 free for a single stream over RTMP input and RTMP output and it does a flawless output HLS .m3u8 stream too (for mobile devices, etc.)
 

HeXBLiTz

New Member
Hi,

Can you possibly explain how the two PC's are connected. Do they have to go trough local home network/router on the same network port as broadband connection of can you LAN cable from one machine directly to the other via a 2nd network port?
 

Jack0r

The Helping Squad
You can do it pretty much however you want and use what works best for you.
I have my two pc's connected through a switch for example. For a direct connection you probably need a crossover cable, and both pc's need to have two NIC's I guess. Give them their own subnet and it will probably work.
Having both connected to a router will work just as good though, assuming the router is "good" and can handle network traffic well.
 

dodgepong

Administrator
Community Helper
nginx has to be compiled with the RTMP module. If you're using a pre-compiled nginx binary that does not have RTMP support already, it won't work -- you'll have to compile it yourself, as instructed in the OP.
 

Benman2785

Member
mainproblem is that iRedMail did its magic wrong -> so i had to reinstall everything without iRedMail and use Postfixadmin - did take some time - but now it works ;)
 

ettienne

New Member
Good day,

Thanks for supplying all this info and getting me this far with configuring my web server. I still have some issues so I am hoping someone will be able to shed some light on my problem.

I have installed Nginx (via your instructions) on my Cloud Server Running Centos 7.2 and Apache. Apache and Nginx was conflicting as far as i could see so I created a new ip address in WHM and released both Apache and WHM from using that specific ip.

I then changed the following line in "/usr/local/nginx/conf/nginx.conf" to accomodate the new ip address 196.41.123.87

Code:
server {
        listen      196.41.123.87:80;
        server_name  localhost;

I enter the following on OBS:
upload_2016-6-28_9-0-36.png


I then try to start streaming but it brings up a message saying "failed to connect to server"

If i go to http://196.41.123.87 I do get the message that Nginx is running.

I am not sure if I managed to install "sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev" correctly.

The apt-get function did not want to work so I replaced "apt-get" with "yum" for what it's worth. Nginx did install however.

Hope someone can help.

Thank you very much
 
Last edited:

ettienne

New Member
I am attempting to install Nginx on a Centos VPS. I need to replace "apt-get" with "yum" for some reason.

I also installed

Code:
sudo yum install epel-release

and

Code:
yum groupinstall "Development Tools"

Upon running the following:

Code:
sudo yum install build-essential libpcre3 libpcre3-dev libssl-dev

I get the following error:

Code:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.rackspace.com
* epel: mirror.math.princeton.edu
* extras: centos.mirror.constant.com
* updates: mirrors.lga7.us.voxel.net
No package build-essential available.
No package libpcre3 available.
No package libpcre3-dev available.
No package libssl-dev available.
Error: Nothing to do

Hope somebody can help.

Thanks
 

Sabuj Das

New Member
Hello to all,
I am setup my own nginx rtmp server. Now i am streaming from my home. My problem is player buffer when i view my site outside my network. I wanna know how much upload speed i need for 1000+ visitor.
 

Benman2785

Member
Code:
sudo yum install build-essential libpcre3 libpcre3-dev libssl-dev

find out how they are called for yum - these are for ubuntu/debian
 

Benman2785

Member
Hello to all,
I am setup my own nginx rtmp server. Now i am streaming from my home. My problem is player buffer when i view my site outside my network. I wanna know how much upload speed i need for 1000+ visitor.

1000+ what? 1080p or only 64kbit/s music? -> i checked that my upload to my server didnt change if only one or 3 person watch (maybe i should try with more people) - but i think i get a peak when a new user connects to the stream -> but it just doubles the bandwith then for 1/2s and then its normal again

do a speedtest with your Server to find out what upload capabilities it has and then calc what how many people can watch ur stream - maybe check you stream with vlc on input-rate and add 1% (but min 10kbps) to this and add up until you reach 90% of your servers upload and voila you know how many people can watch ur stream...
 

Sabuj Das

New Member
maybe check you stream with vlc on input-rate and add 1% (but min 10kbps) to this and add up until you reach 90% of your servers upload and voila you know how many people can watch ur stream...

thanks for your replay.

Can you please explain this. i do not found this option.

Now i am steaming 1280x720 and 3 or 4 user can watch buffer less. My upload speed is 6mbps.
 

Benman2785

Member
@Sabuj Das

do you stream to an WEBSERVER -> than u just need one time upload (as i noticed with 3 people active on my stream) OR do you stream to a server in your LOCAL NETWORK and people form the internet access there?

if you stream to a hosted webserver than you should only need the upload as for one user plus a peak when a new user connects
if you stream into your local network and people from the internet access you should need enough upload for EACH VIEWER

to test you upload you open your stream with VLC and press CTRL+J and go to statistic and check your Input-Bitrate and Data-Bitrate:

lets say you stream with 2000kbps video-bitrate + 96kbps aac audio-bitrate so you may have an input-bitrate of ~2150kbps

so if you stream to an hosted webserver (not in your local network) you will need min 2,5mbit upload (better 4mbit upload) and it will not buffer UNTIL your hosted webserver is near to its max bandwith -> lets say you get ~80mbit from 100mbit then ~33 people can watch your stream without buffering

but if you stream to a server in your LOCAL-Network and you have 6mbit upload only 2 people can watch your stream without buffering

ps there r cheap vServer for ~3-5eur per month that can "spread your stream" cheap for many people ;)

EDIT:

checked now with 5 viewers -> i get an addition "upload-fee" from 20-100kbps per user watching // and peaks when a new viewer connects can be up to 105% of stream-input-bitrate

EDIT2:

if a viewer disconnects there will also be a peak ;)
 
Last edited:

Lloyd

New Member
Hey Guys!

After doing some fiddling on my droplet I finally got to Step 3: - Everytime I enter '/usr/local/nginx/conf/nginx.conf' It returns with permission denied - I am using the Root host? Any Suggestions? (I am a complete noob at this :))

Thanks for all your help in advance,
 

dodgepong

Administrator
Community Helper
Prefix the command for opening the file with the word "sudo", such as "sudo vi /usr/local/nginx/conf/nginx.conf". That will let you open and edit the file as root.
 
Top