Noxalus / Multi-Streaming-Server

A NGINX server with RTMP module to send video streaming to multiple services simultaneously (Youtube, Twitch, Dailymotion, Hitbox, Beam, etc...).
173 stars 41 forks source link

nginx.conf #7

Closed dwbstreet closed 8 years ago

dwbstreet commented 8 years ago

The machine is now launching properly with the VT-x! Thank you. Now, I am not able to configure the nginx.conf properly. Could you specify which lines need to be altered to my inputs, please. I have grown extremely frustrated, although I have learned.

My apologies if I submitted this thread twice

Noxalus commented 8 years ago

You need to replace each {{ variable_name }} in the Nginx configuration file by your personal information. That's the case for:

If you don't want to stream for a specific service, let's say Dailymotion for instance, you can remove the application dailymotion { [...] } block entirely.

dwbstreet commented 8 years ago

Ok, so I replaced line 56 with my IP. Then I replaced line 79 with my youtube key. Next I replaced line 89 with my twitch key. Vagrant up Near the end of the process, it reads start nginx service nginx: [emer] directive "push" is not terminated by ";" in /usr/local/nginx/conf/nginx.conf:99 nginx is ready to use

From the little I've learned from the windows version nginx error logs, when there were errors like this nginx would not start. When I try to connect to the source you reference rtmp://192.168.42.42:1935/live it says failed to connect to server.

So finally, I went back and removed the blocks for hitbox and dailymotion where line 99 was (even though it was closed with a ";". I closed the VM and then removed it, choosing delete all files. I restarted pc. Vagrant up After it finishes, the same error on line 99 shows, even though there is no script on that line (the last "}" is on line 92. I am at a total loss.

Please advise. Thanks so much for your time in this matter. My end goal here is to send an untranscoded stream to youtube with my OBS settings; A transcoded version will go to twitch.

dwbstreet commented 8 years ago

I resolved the scripting error. One of the connecting lines was indented (user error). When I ran vagrant up now it started nginx with no errors.

When I start streaming in OBS, it says disconnected (reconnecting in 10s) (attempt 1) Reconnection successful. Disconnected. (reconnecting in 10s) (attempt 1)

This loop continues... I checked the http://192.168.42.42:8080/stat. RTMP: Accepted 40

clients 0 0 0

Again, I am trying to ultimately send an untranscoded stream to youtube with my OBS settings; A transcoded version will go to twitch.

Noxalus commented 8 years ago

If you removed the line allow publish {{ my_ip_address }}; from your conf, you also need to replace deny publish all; by allow publish all;. This should allow you to connect to your RTMP server :smile:

dwbstreet commented 8 years ago

that was the ticket! thanks so much.

I am doing something that requires changing the stream key for youtube daily or more. What is the most efficient way to restart the stream? Do I have to close the virtual box and re vagrant up? Or is there a way to reload it once I have changed the nginx.config ?

Again, thanks so much for your assistance!

Noxalus commented 8 years ago

Actually, if there is already a small Node.js server that is run specifically to restart Nginx when the config file change (here). This is the most efficient way for me :smiley:

Let me know if it doesn't work as expected, but updating the Nginx config file from your host machine should automatically restart Nginx.

dwbstreet commented 8 years ago

I see the two files, would love to try...do I just extract them to a specific folder (not sure which one if so); vagrant up?

Then in the future, I could edit the config file to change the stream key in notepad, hit save and this bootstrap will auto restart nginx?

Thanks for the clarification

Noxalus commented 8 years ago

The script is auto launched when you run vagrant up, you don't need to extract anything. So if your VM is up and that you change and save the config file, it will detect the change and Nginx will be restarted.

dwbstreet commented 8 years ago

Is the way it's configured now, is it sending out two feeds to YouTube? One transcoded and one not? I see two instances on the http://192.168.42.42:8080/stat

Noxalus commented 8 years ago

No, if you use the config file on this repository, it will broadcast the stream to Youtube, Twitch (transcoded), Dailymotion and Hitbox. Can you take a screenshot of the stat page? And can you show me the rtmp part of your config file (without your personal information!).

dwbstreet commented 8 years ago

rtmp8080


rtmp { server { listen 1935; chunk_size 8192;

    application live {
        live on;
        record off;

        allow publish all;
        deny publish all;

        push rtmp://localhost/youtube/${name};

        exec ffmpeg -i rtmp://localhost/$app/$name -c:v libx264 -preset veryfast -c:a copy 
            -b:v 3500k 
            -bufsize 3500k
            -maxrate 3500k 
            -s 1280x720 -r 30
            -f flv rtmp://localhost/twitch/$name;

        push rtmp://localhost/dailymotion/${name};
        push rtmp://localhost/hitbox/${name};
    }

    application youtube {
        live on;
        record off;

        allow publish 127.0.0.1;
        deny publish all;

        push rtmp://a.rtmp.youtube.com/live2/??????1gc;
    }

    application twitch {
        live on;
        record off;

        allow publish 127.0.0.1;
        deny publish all;

        push rtmp://live-cdg.twitch.tv/app/live_51900145_hIi4SRD0q1w???????????????v;
    }
}

}

dwbstreet commented 8 years ago

can you confirm for me the key interval scripting, wanted to add key=2 if it's not already there....

dwbstreet commented 8 years ago

from current twitch broadcast...."Max keyframe interval is currently at 14.0 seconds. Please set it to 2 seconds. The broadcast is not set to constant bitrate (CBR). [Current average: 1719 kbps, current max: 3890.096 kbps"