Jump to content

[Guide] Stream on multiple platforms with Nginx and OBS


Fmohican

Recommended Posts

Want to stream to YouTube / Twitch / Caffeine / etc. in same time?
Congratulations! You've come to the right place!

 

Pre requirement:

  • Patience (most important)
  • +200 mpbs (depends on how many platforms you want to stream)
  • Mulithreaded CPU
  • ~20GB Free Diskspace (the hardcore way)

 

To do this we need the following:

 

Well, WAIT! Do not download anything. There are two ways to achieve "multi-streaming":

  • The easy way (Start from 11.5)
    • Download precomplied nginx (Link | Link | Link | Link)
    • Extract somewhere on the disk
    • Just edit config && config OBS.
    • RUN!
  • The hardcore way (Start from 1)
    • Compile nginx with RTMP module
      • Download nginx source
      • Install VS 2010 cmd
      • Compile nginx with VS 2010
      • Test compiled nginx, to see if it's working
    • Editing config and done

 

1. Let’s go ahead and download nginx mainline version (current is 1.15.8) source code:

http://hg.nginx.org/nginx/rev/ee551e3f6dba

On the left you will see a button called „ZIP”.  Press it and an arhive with source code will be downloaded.

Let’s make a folder called „nginx” on the desktop and extract the arhive content in this folder.

Your folder should look like:

x2rSSh1.png%20

2. Inside the „nginx” folder, let’s make another folder called „objs”. In „objs”, we need to make another two folders called „addon” and „lib”.

Your folder should look like :


kYDaCEG.png

3. Download nginx libs (check links on the frist paragraph). Extract openssl, zlib and pcre in the lib folder and rename it from „openssl-1.0.2q” to „openssl”, from „pcre-8.43” to „pcre” and „zlib-1.2.11” to „zlib”. Your lib folder should look like:

xU1085c.png

4. Install VS 2010

5. Install Git

6. Download RTMP Module and extract it to „nginx/objs/addon/rtmp/”. Your folder should look like:

oChKhhP.png%20

and inside rtmp
EVhurnP.png%20

 

7. Inside nginx folder, right click and select „Git Bash Here”. Copy & paste this command inside the „console” (ps: You have to right click on the console and select „paste” ).

 

auto/configure \
    --with-cc=cl \
    --with-debug \
    --prefix= \
    --conf-path=conf/nginx.conf \
    --pid-path=logs/nginx.pid \
    --http-log-path=logs/access.log \
    --error-log-path=logs/error.log \
    --sbin-path=nginx.exe \
    --http-client-body-temp-path=temp/client_body_temp \
    --http-proxy-temp-path=temp/proxy_temp \
    --http-fastcgi-temp-path=temp/fastcgi_temp \
    --http-scgi-temp-path=temp/scgi_temp \
    --http-uwsgi-temp-path=temp/uwsgi_temp \
    --with-cc-opt=-DFD_SETSIZE=1024 \
    --with-pcre=objs/lib/pcre \
    --with-zlib=objs/lib/zlib \
    --with-openssl=objs/lib/openssl \
    --with-openssl-opt=no-asm \
    --with-select_module \
    --add-module=objs/addon/rtmp \
    --with-http_addition_module \
    --with-http_dav_module \
    --with-http_mp4_module \
    --with-stream \
    --with-stream_ssl_module \
    --with-stream_realip_module \
    --with-stream_ssl_preread_module \
    --with-http_v2_module \
    --with-http_realip_module \
    --with-ipv6 \
    --with-http_gunzip_module \
    --with-http_ssl_module

If anything it’s ok, inside console you will see like :

GYU8QQR.png

 

8. Press the start button and type „visual studio command prompt”, it should look like this:

HXiKyzN.pngand open it.

 

9. On the window opened type: „cd /D C:” and „cd %HOMEPATH%/Desktop/nginx”. The console should look like this:

l3OmJtL.png

Now type „nmake”, then sit back & relax till the console does its job (now you are compling nginx).

If everything it’s ok, your console should look like:  

4kAGVjf.png

 

10. Well done, nginx is complied! Now let’s see how we make the configs:

Make a folder on Desktop called „nginx_compiled”, copy „conf” folder from „nginx” and copy executable from „objs” to „nginx_complied”. Inside „nginx_compiled” make another two folders „logs” and „temp”, and now, open „git bash here” and type „./nginx -t”. Your folder & console should look like:

GsCAgRv.png

11. Install notepad++, go to „nginx_compiled/conf” and open with notepad++ the file called „nginx.conf”. Your file should look like :

dKJMS2l.png

Now remove everything, and copy & paste this

worker_processes  auto;
worker_rlimit_nofile 200000;

error_log  logs/error.log;
error_log  logs/notice.log  notice;
error_log  logs/info.log  info;
pid        logs/nginx.pid;


events {
    worker_connections 32768;
	multi_accept on;
	accept_mutex on;
}

rtmp {
	server {
		listen 1935;
		chunk_size 8128;

		application live {
			live on;
			record off;
			push rtmp://a.rtmp.youtube.com/live2/YourKeyThere;
			push rtmp://live-vie.twitch.tv/app/YourKeyThere;
		}
	}
}

 

Your file should look like:

bmGVgDr.png

11.5. For the guys who chose „faster” way, extact the downloaded archive to the desktop in the folder called „nginx_compiled”.

12. Replace „YourKeyThere” with the real key from twitch/youtube/etc, if you need, add more lines with push rtmp://blabla

BE CAREFULL! DO NOT FORGOT THE „ ; ” (semicolon)

Also check config with „nginx -t”. If it’s ok, then you’re on the right way.

13. Download, Install OBS & Start OBS, one the right, click on „Settings”. The menu will be launch, and select „Stream” (from the left). On the first option choose „Custom Streaming Server”, for the URL write

„rtmp://127.0.0.1/live” and „Stream key” leave it empty and uncheck „Use authentication”. Click Apply and Ok.

LYHjryG.png

14. Go to „nginx_complied” and run nginx.exe

15. Enjoy, you’re straming on two or more services

 

F.A.Q.:
Q: Its legal to use this method?
A: Yes.
Q: How nginx work?
A: this way https://i.imgur.com/0rzIBri.png
Q: Can i trust precompiled files?
A: VirusTotal Test: https://www.virustotal.com/#/file/ca4c4b7d6f03582d59c8270238352586fc556805ad4ea2dd6c36398f267f7022/detection
Also for "paranoic" guy, VirusTotal Test of the "exe" file: https://www.virustotal.com/#/file-analysis/ODc3YzRkMDNhMmEyZTA3OGNjYjExM2ZjYjQwMGEyYTA6MTU1MTAxODQyNw==

 

If you have any question please ask.

PS: Don't bother to ask me questions about compilation because I won't help you, google its al most "free" so use it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...