How to set up your own private RTMP server using nginx

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

klpville

New Member
Theoretically, ffmpg can convert RTSP to RTMP. Now has anybody ever tried this? The setup is like that: Linux VPS (Debian) - Ngnix with RTMP module - OBS - and RTSP / ONVIF IP camera on a static public IP address. Any comments / tips / pointers? Many thanks in advance!
 

Mark Weiss

Member
I'm still stuck at a repeating 30 second loop for the live video transmission through OBS streaming to nginx on the web server. It's not truly live. OBS is sending a list of short video clips, but the player is only playing one of them over and over.
I tell ya, the person who figures out how to multicast from a residential IP will make millions. There's got to be a way. The government can listen in on all traffic, so there must be a way to flag a stream as public and not private point to point.
 

Mark Weiss

Member
I want to be able to stream to a large number of viewers, without relying upon censored corporate media. That means that I must do it from a residential connection and make it all happen with software servers and encoders.
 

Tomasz Góral

Active Member
And what do you see the problem in?
To provide multi-user transmission, I run multiple servers. The system counts each user starting playback, and returns the server address in return form.
 

L0rdG1gabyt3

New Member
I wrote a little program that will help ease the creation of the config file for Windows. You will need to provide your own copy of Nginx with RTMP for it to work properly.
Main Window
9QYKJpQ.png


Config Window (Example)
0LsNKQH.png


nginx.conf with settings from previous window.
ELwmlm8.png

The ingest will allow for up to 5 applications for other people to stream TO so they can be mixed with OBS on the RTMP server and then rebroadcast out from the Stream application. You can use this with another person to produce multicam streams.

I think its operation is fairly straight forward.
Any feedback is appreciated.

https://1drv.ms/u/s!Ar4s89ZajRLcocVjj_y0D_NZVYLmew?e=pM1yRB
 
Last edited:

unlockdtdd

New Member
@L0rdG1gabyt3: Thanks for your sw. Can you help me?
OBS record -> Server (creat m3u8) -> livestream m3u8.
I use OBS record screen, I want to have a server like use NGINX then I get m3u8 link from there and livestream. Which server I can choose to rent or if I build a server, will it take much money?
Thank you so much.
 

L0rdG1gabyt3

New Member
@L0rdG1gabyt3: Thanks for your sw. Can you help me?
OBS record -> Server (creat m3u8) -> livestream m3u8.
I use OBS record screen, I want to have a server like use NGINX then I get m3u8 link from there and livestream. Which server I can choose to rent or if I build a server, will it take much money?
Thank you so much.
So you record your video (OBS does this locally), and then want to broadcast it later?
Ive not added the functionality to edit saving video yet. I could add that feature when I get some time. Right now, its just for configuring a multi-stream live environment.
 

DarkXoa

New Member
I made it to

Now we build nginx:

Code:
$ ./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-dev
$ make
$ sudo make install

but when I try to run the
Code:
$ make
command, I get this:
Code:
make -f objs/Makefile
make[1]: Entering directory '/home/darkxoa/Downloads/nginx-1.16.1'
cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I../nginx-rtmp-module-dev -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
    -o objs/src/event/ngx_event_openssl.o \
    src/event/ngx_event_openssl.c
src/event/ngx_event_openssl.c: In function ‘ngx_ssl_client_certificate’:
src/event/ngx_event_openssl.c:883:5: error: ‘SSL_CTX_load_verify_locations’ is deprecated [-Werror=deprecated-declarations]
     if (SSL_CTX_load_verify_locations(ssl->ctx, (char *) cert->data, NULL)
     ^~
In file included from /usr/local/include/openssl/opensslv.h:109:0,
                 from /usr/local/include/openssl/macros.h:11,
                 from /usr/local/include/openssl/opensslconf.h:14,
                 from /usr/local/include/openssl/macros.h:10,
                 from /usr/local/include/openssl/ssl.h:16,
                 from src/event/ngx_event_openssl.h:15,
                 from src/core/ngx_core.h:83,
                 from src/event/ngx_event_openssl.c:9:
/usr/local/include/openssl/ssl.h:2023:1: note: declared here
 DEPRECATEDIN_3_0(__owur int SSL_CTX_load_verify_locations(SSL_CTX *ctx,
 ^
src/event/ngx_event_openssl.c: In function ‘ngx_ssl_trusted_certificate’:
src/event/ngx_event_openssl.c:934:5: error: ‘SSL_CTX_load_verify_locations’ is deprecated [-Werror=deprecated-declarations]
     if (SSL_CTX_load_verify_locations(ssl->ctx, (char *) cert->data, NULL)
     ^~
In file included from /usr/local/include/openssl/opensslv.h:109:0,
                 from /usr/local/include/openssl/macros.h:11,
                 from /usr/local/include/openssl/opensslconf.h:14,
                 from /usr/local/include/openssl/macros.h:10,
                 from /usr/local/include/openssl/ssl.h:16,
                 from src/event/ngx_event_openssl.h:15,
                 from src/core/ngx_core.h:83,
                 from src/event/ngx_event_openssl.c:9:
/usr/local/include/openssl/ssl.h:2023:1: note: declared here
 DEPRECATEDIN_3_0(__owur int SSL_CTX_load_verify_locations(SSL_CTX *ctx,
 ^
src/event/ngx_event_openssl.c: In function ‘ngx_ssl_error’:
src/event/ngx_event_openssl.c:3002:13: error: ‘ERR_peek_error_line_data’ is deprecated [-Werror=deprecated-declarations]
             n = ERR_peek_error_line_data(NULL, NULL, &data, &flags);
             ^
In file included from /usr/local/include/openssl/opensslv.h:109:0,
                 from /usr/local/include/openssl/macros.h:11,
                 from /usr/local/include/openssl/opensslconf.h:14,
                 from /usr/local/include/openssl/macros.h:10,
                 from /usr/local/include/openssl/ssl.h:16,
                 from src/event/ngx_event_openssl.h:15,
                 from src/core/ngx_core.h:83,
                 from src/event/ngx_event_openssl.c:9:
/usr/local/include/openssl/err.h:301:1: note: declared here
 DEPRECATEDIN_3_0(unsigned long ERR_peek_error_line_data(const char **file,
 ^
cc1: all warnings being treated as errors
objs/Makefile:917: recipe for target 'objs/src/event/ngx_event_openssl.o' failed
make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1
make[1]: Leaving directory '/home/darkxoa/Downloads/nginx-1.16.1'
Makefile:8: recipe for target 'build' failed
make: *** [build] Error 2

Can anybody help me figure out what's going on here?
 

furfix

New Member
Hi Guys,
I have a couple of basic questions, wondering if you can help me with:

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

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

1) I want 3 friends be streaming to my rtmp server, to include them on my OBS live streaming via brower. Is this config enough?
2) I want to secure the server, to avoid anyone having the IP using it. How can I do that?

Thanks in advance!!
ff
 

eanderson25

New Member
I experimented about a year ago with a random computer with xubuntu and I got it to work. I cleared the computer by now, and I am trying to get another server going using the tutorial again.

Finishing the tutorial, the nginx server runs (typing in the ip to browser returns the default splash page) but OBS is unable to stream to it. Ububtu 18.04 server
I have tried graphical again in a vm with xubuntu, with the same results, and I am able to ssh and view the webpage by setting port forwarding in virtualbox, but forwarding the listening port still results in no connection. I am only on a local network for the physical setup.

Any suggestions for a solution?
 

pronghorn

New Member
Just checking in in 2020 (7 years later!!!!) to say thanks for the guide. Just followed this and it works perfectly.

I set up the RTMP server on a fresh install of Ubuntu Server on an old Lenovo T61 and it was able to relay a stream from my friend's house to my OBS, crisp and clear with only about 3 seconds of delay. Amazing.

Your guide lives on. Much appreciated.

Also, for anyone reading from the future, we're currently under quarantine from Covid-19, during which there is an incredible and sudden interest in live-streaming, since physical social gatherings are prohibited. Musicians and preachers and yoga teachers are all going live and people like me are tinkering like mad.
 
Top