Question / Help Broadcast to Youtube and Facebook pages for free ? How ?

Hello, all

For 2 days I am reading and testing things, but I still couldn´t figure out a good method that I could broadcast to youtube and facebook pages at the same time for free using OBS. There are paid services like restream.io It broadcasts to facebook pages only on the paid version, and only or the $45 month version it removes the restream logo ( wow ! ). I need something free. I tried the Nginx method ( server ), but I´m having problems with it, somehow push is too slow ( doesn´t even broadcast at all ), although my internet connection is 300 Mbps. I have 2 good machines here. I could use one for each stream, if needed ( 2 OBS installed ). The best solution, of course, would be that OBS could broadcast 2 streams at the same time, or kind of installing 2 OBS on the same machine and each one would stream to a platform, but in this case, one of them could rebroadcast from the other, is that possible ?

Thanks for any help
 
can you post your nginx config (censor your streamkeys)?

Hello, Tarumes, thank you for trying to help me. Here attached the Ngix config. Notice that I am using:

Win 7 64bits SP 1 ( Because I need it for some other softwares, no Win 10 here )
Machines tested ( Almost the same configuration ): Intel i7 2600k overclocked to 4.6 Ghz - 16Gb ram, + SSDs + Hard drives + GTX 780

Nginx tested: Versions 1.2.1 and another one newer gathered from some youtube channels, where people already prepared part of the configuration to use with OBS, needing only to change the PUSH url and password.
My OBS is 64 bits, version over 22.... something. Configured to output in H264. When I broadcast directly to youtube or facebook, I have no problems. But when I try to connect to the Nginx server throught localhost I get the message: "unable to connect to the server" or something like. When I change localhost for the machine IP, like 192.168.1.30 I can connect, but as I´ve shown on another post, Nginx is slowing down the transmission to mere Kbps.

Here it is my Nginx config attached.

========================== Content of the file nginx.conf

worker_processes 1;

#error_log logs/error.log debug;

events {
worker_connections 1024;
}

rtmp {
server {
listen 1935;

application live {
live on;
meta copy;

# Youtube Ao Vivo Abaixo
push rtmp://a.rtmp.youtube.com/live2/password hidden;

# Facebook Ao Vivo Abaixo


}

application hls {
live on;
hls on;
hls_path temp/hls;
hls_fragment 8s;
}
}
}

http {
server {
listen 8080;

location / {
root html;
}

location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}

location /stat.xsl {
root html;
}

location /hls {
#server hls fragments
types{
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
alias temp/hls;
expires -1;
}
}
}
 
Here´s the Nginx stat screen: Something is slowing down after the server:

Nginx.jpg
 

Tarumes

Member
Code:
events {
    worker_connections  1024;
}
rtmp_auto_push on;
rtmp_auto_push_reconnect 1s;

rtmp {
    server {
        listen 1935;

        application live {
            live on;
            deny play all;
            
            push rtmp://a.rtmp.youtube.com/live2/password hidden;
            
            
            push rtmp://127.0.0.1/view/stream;
        }
        
        application view {
            live on;
            allow publish 127.0.0.1;
            deny publish all;
            hls on;
            hls_path html/hls;
            hls_fragment 10s;
            hls_playlist_length 60s;
            hls_fragment_naming timestamp;
            hls_fragment_slicing aligned;
            hls_type live;
            hls_cleanup on;
            recorder all {
                record all;
                record_path html/record/stream;
                record_lock on;
                record_unique on;
            }
        }
    }
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        off;
    server_tokens off;
    
    server {
        listen      8080;
        
        location / {
            root html;
        }
        
        location /stat {
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }

        location /stat.xsl {
            root html;
        }
        location /control {
            rtmp_control all;
        }
    }
}
 
if this wont work well update your nginx to a new version
i use
  • Nginx: 1.14.1
  • Nginx-Rtmp-Module: 1.2.1

Did you see something wrong in my config code ? I didn´t see any comment of yours. The solution, the advice would be try to upgrade ? I will try it then. Download the same version of yours just to see what happens. May be something wrong with my windows...well, everything can happens. Thanks.
 
if this wont work well update your nginx to a new version
i use
  • Nginx: 1.14.1
  • Nginx-Rtmp-Module: 1.2.1

Hello, again, Tarumes, I downloaded Nginx Rtmp Module ( Not the server itself, but the rtmp from the page ):
https://github.com/illuspas/nginx-rtmp-win32
And installed.
I edited the config file, and inserted a line with my rtmp youtube settings and password
Run Nginx and saw that it is alive on the stats page, and run OBS. If I put the phrase: "rtmp://localhost:1935/live" on the custom rtmp service, OBS says unable to connect ( Apparently it doesn´t know where is my "localhost" ) , so, I put the IP 127.0.0.1 ( referring to the local machine ) and OBS indeed now connects to the Nginx server and I can see the stats in the page, but, unfortunatelly, the same problem happens: Nginx slows down broadcast. Youtube prepars to Broadcast, but stays on yellow, signaling that connection is slow. I don´t know why this happens.
See the new picture with the new rtmp server running.
There must be a problem with the use of "localhost". I tried from another machine on the LAN, and, in OBS I put the IP address of the server reffering to the internal IP:
rtmp://192.168.1.30:1935/live

Same problem again. OBS connects, but slowdown the "live" rtmp. I disabled firewall, anything you can imagine.
I can´t understand what´s going on.
I don´t know what to do.

Nginx2.jpg
 
This is the new Nginx config file:

worker_processes 1;

error_log logs/error.log info;

events {
worker_connections 1024;
}

rtmp {
server {
listen 1935;

application live {
live on;

push rtmp://a.rtmp.youtube.com/live2/password;


}

application hls {
live on;
hls on;
hls_path temp/hls;
hls_fragment 8s;
}
}
}

http {
server {
listen 8080;

location / {
root html;
}

location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}

location /stat.xsl {
root html;
}

location /hls {
#server hls fragments
types{
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
alias temp/hls;
expires -1;
}
}
}
 
Code:
events {
    worker_connections  1024;

}

Hello again, Tarumes,

Sorry that I didn´t notice the difference on the code you sent. Now, I inserted your code and updated Nginx rtmp to be exactly like yours. Unfortunately, the same problem, slowness, but we have a new stats. Look, what you think about it ? There´s a new line, on one push, the speed is correct, but we haven´t any output 0Kbps. Why ? In OBS, I´m sending to rtmp://127.0.0.1:1935/live ( Because if I use "localhost" it displays "Unable to connect to server" ).

Nginx3.jpg
 

Tarumes

Member
this is
Code:
...
push rtmp://127.0.0.1/view/stream;
...

with this you can monitor your stream with always the same rtmp-url
^^
 
when stream push to rtmp://127.0.0.1/view/stream is normal then
something is happen between the connection nginx to the externeral server

Yes. But what ? When I connect to YouTube using only OBS it's normal. Only when the server is trying to relay the problem happens. Would be something related to my router ? Port 1935 ? The YouTube URL and password is fine. Indeed it connects but with slow speed. I installed on two machines of the network with same results. Perhaps I'll have to test on another computer on another place, another internet connection....
 
I have no idea why this isn't working for you.
the only reason for this behavior could be slow upload
or too little performance on the server pc

Slow upload only when using the Nginx server ? My internet connection is 300Mbps. My PC is very good, 4 cores, 8 threads, at 5Ghz, 16GB ram, 3 SSD... Don't know what's causing. Would it be something on the router ? Like any door locked ?
 

Tomasz Góral

Active Member
Hi,
Remove push line, and use manual send stream.
2 stream who you see is normal, first is what you send and second is push stream.

Manual send stream from nginx:
use ffmpeg (prepare two batch file e.g. first youtube.bat and second facebook.bat).

ffmpeg -i rtmp://localhost/live/mymainstream -c copy -f flv rtmp://youtube.com/

ffmpeg -i rtmp://localhost/live/mymainstream -s 1280x720 -c:v libx264 -v:b 3000k -c:a copy -f flv rtmps://facebook.com/

facebook work with rtmps protocol.
 
Hi,
Remove push line, and use manual send stream.
2 stream who you see is normal, first is what you send and second is push stream.

Manual send stream from nginx:
use ffmpeg (prepare two batch file e.g. first youtube.bat and second facebook.bat).

ffmpeg -i rtmp://localhost/live/mymainstream -c copy -f flv rtmp://youtube.com/

ffmpeg -i rtmp://localhost/live/mymainstream -s 1280x720 -c:v libx264 -v:b 3000k -c:a copy -f flv rtmps://facebook.com/

facebook work with rtmps protocol.

Hello, Tomasz Góral, thank you for trying to help me. I have a doubt on your solution: Where do I put the passwords for youtube and facebook on those lines of the batch files ?

Thanks !
 
Top