How to set up your own private RTMP server using nginx

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

ubflhd

New Member
Hello all,
Before I start I like say many thanks for this topic its really easy to setup my own stream again thanks.
But me and friend are stuck at this moment because all the html5 players for mobiel phone dont support flv.
So that is part we are stuck on at this moment we have look all over the internet but havent found nothing .
We both wanne know if there is anway to change the flv to mp4 for live streaming we only found this for on demand streams .
So any help will be great and I think more users will find this usefull , thanks and hope to hear from some here .
 

Cook13s

New Member
Anyone have a guide to making nginx work with RTMP and HLS? I'm trying to figure this out but its a pain in the butt to get both of them to work at the same time, especially for mobile users. Here's what I have so far. I already had RTMP working just fine, but now I want to be able to have 3 different quality streams (low, mid, source) and have them available both on RTMP and HLS. I have not done the 3 different streams yet, except for maybe a less useful method of having a low quality stream that is forwarded to a different url and stream key. I would prefer so that something like video.js or jwplayer can use HTML 5 streaming and fallback to flash for others.

http://pastebin.com/LixDgiTG

In short, I ask:
  • How do I get dynamic streaming?
  • How do I get HLS and RTMP on nginx to work in the most efficient way?
  • Method of setting up Video.js to work with the setup above.
Its possible, just every guide has been so vague into getting this to work and pointing me in the right direction at least would help a lot. Thanks In advance.
 

norico

New Member
It's possible to stream with 2 lives, but just a question :
It's possible to stream in 1080p on hitbox and recode in 720p to twitch.

Thanks a lot for responses.
 

segafreaks

New Member
I have problem on this one:
Open your config file, located by default at /usr/local/nginx/conf/nginx.conf and add the following at the very end of the file:

Getting "Permission Denied" !

Please help me! :D
 

bradders591

New Member
I have problem on this one:
Open your config file, located by default at /usr/local/nginx/conf/nginx.conf and add the following at the very end of the file:

Getting "Permission Denied" !

Please help me! :D

You're getting permission denied when opening the file? Try the sudo before you open (i.e. sudo vi /usr/local/nginx/conf/nginx.conf)
 

Fenrir

Forum Admin
For some reason, when listening in VLC media player, i can hear the audio loop over, any idea why this is?

Are you listening on the same PC that you're streaming from? Because then you would just be broadcasting back the stream sound to the stream, causing the loop.
 

bradders591

New Member
Are you listening on the same PC that you're streaming from? Because then you would just be broadcasting back the stream sound to the stream, causing the loop.

I thought the same but I got another guy on the network to try and connect and he had the same outcome. Very strange as it picks up the audio everytime something goes into the mic, but it just seems to add it to the same 5 second loop
 

bradders591

New Member
It turns out it was an issue with viewing my own stream. The client i was using was sending everything from the soundcard. Thanks for you reply anyway
 

sneaky4oe

Member
Guys, is anyone able to stream to dailymotion via nginx? I can stream directly, but rtmp to dailymotion doesn't work (tried both servers - main and secondary)
 

Bamse

Member
Heya!
I've been posting a bit in the older thread regarding using this solution for getting a dual PC non-capture card-setup up and running. I've been using it regularly since basically the beginning of the year and it has served me very well.

Like a week ago however my recent VODs has lost its seek bar along with the time counter, and I started troubleshooting that a few days ago. I can't for the life of me figure out what can be causing this since I haven't changed a thing on my streaming pc. I can stream directly to twitch using the exact same OBS settings (apart from bitrate) so I've narrowed it down to the transcode.
Has anyone else using this method noticed anything like this? It's quite annoying for my viewers and it seems like it is causing my youtube exports to fail as well.

I have some (very long :P) troubleshooting info here if someone would have the time to have a look at it; https://obsproject.com/forum/thread...n-without-capturecard.6757/page-7#post-128647
 

sneaky4oe

Member
Heya!
I've been posting a bit in the older thread regarding using this solution for getting a dual PC non-capture card-setup up and running. I've been using it regularly since basically the beginning of the year and it has served me very well.

Like a week ago however my recent VODs has lost its seek bar along with the time counter, and I started troubleshooting that a few days ago. I can't for the life of me figure out what can be causing this since I haven't changed a thing on my streaming pc. I can stream directly to twitch using the exact same OBS settings (apart from bitrate) so I've narrowed it down to the transcode.
Has anyone else using this method noticed anything like this? It's quite annoying for my viewers and it seems like it is causing my youtube exports to fail as well.

I have some (very long :P) troubleshooting info here if someone would have the time to have a look at it; https://obsproject.com/forum/thread...n-without-capturecard.6757/page-7#post-128647
Speaking about twitch? Just remember one rule - if your viewers experience some problems with your streams at twitch, this is twitch's fault.
Also, just make local recordings to export.
 

Bamse

Member
I know many things can be blamed on twitch, but this is not one of them. Its 100% the transcode/nginx/rtmp that is causing the issues ;)
I do local recordings from time to time since it has stopped working, but if I could grasp why the transcode fugdes things I wouldn't have to ;P
 

sneaky4oe

Member
I know many things can be blamed on twitch, but this is not one of them. Its 100% the transcode/nginx/rtmp that is causing the issues ;)
I do local recordings from time to time since it has stopped working, but if I could grasp why the transcode fugdes things I wouldn't have to ;P
Whatever, just stream a mirror to hitbox.tv or gmlv.tv (these guys freely transcode to 480 and save VODs at 480p only...) - they'll save it there and you'll be able to see it yourself at VODs there. Seekbar is twitch problem. Started about a year ago, many banned dudes at their reddit...
 

Bamse

Member
I've gotten a dialog up and running with Twitch Support that has been good so far. No solution or anything so far and getting a reply takes days so it's not going fast by any way of measure.
But still, I was very happy they didn't reply "nopenopenope, not a supported solution". I'll keep you posted if I get anything productive or such :)
 

XkickboardX

New Member
Hey there community!

First off, thanks for the guide! As a massive nerd that looks for any excuse to set something else up on my server machine, this is a great thing.

On to my problem: I can't seem to get any video when I try to access the stream.

Here's my nginx.conf

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


http {
    #Firewall settings, only allow Local IP's
    allow 192.168.1.0/24;
    allow 127.0.0.1;
    deny all;

    access_log         logs/http_access.log;
    include           mime.types;
    default_type      application/octet-stream;
    sendfile            on;
    keepalive_timeout      65;
     
    server {
        #HTTP Server port and name
        listen        80;
        server_name    localhost;

        # rtmp statistics
        location /stat {
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
            allow 127.0.0.1;
        }
     
        location /stat.xsl {
            # you can move stat.xsl to a different location
            root html;         
        }

        # rtmp control
        location /control {
            rtmp_control all;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}


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

The server runs without a problem
server%20running_zpsyvmsmqsf.jpg

My gaming rig is able to stream to the server without a problem as well.
OBS%20settings_zpsp2imrxcb.jpg

STobsstreaming_zpscgwns5nw.jpg

but when i try to open the stram on my server, it's just a black screen, no audio
video20plugin20settings_zpstx9exueo.jpg

blank%20screen_zps8bupngxn.jpg

Am I pointing my server obs at the wrong place to pull the video? Do I have something in my conf messed up?
 
Last edited:

XkickboardX

New Member
ah thanks so much! I can pull the stream up on VLC player but it's super laggy playing on there and still just a black screen on the OBS video scene. I'll SS later :D
 
Top