Nginx-rtmp-module: Push rtmp stream dynamically to Facebook live (with query string as arguments)

Created on 3 Jan 2017  Â·  4Comments  Â·  Source: arut/nginx-rtmp-module

Hi, I'm trying to configure a live application command that will push OBS live stream (with Facebook live stream key) to Facebook Live dynamically (while streaming from OBS, for example).

When I configure the assigned url+key, for example:
application live {
live on;
record off;
push rtmp://rtmp-api.facebook.com:80/rtmp/12121212121?ds=1&s_l=1&a=daserewfwefew;
}
everything works well.

I understand that exec ffmpeg should be used in order to convert the stream-key query string into arguments, but I cannot get it to work.

Can you help with an example of how to convert an ingress rtmp stream (like: rtmp://live.myapp.com/live/[FB-STREAM-KEY]) into a push url with arguments?

Many thanks for your help!

Most helpful comment

id you figure out how to do it?

All 4 comments

wwwyaron, I see that you closed this issue. Did you figure out how to do it? If so, would you mind sharing your solution?

id you figure out how to do it?

Did anyone figure this out able to post it here please?

This is how I have accomplished it:

rtmp {
        server {
                listen 1935;
                chunk_size 4096;

                application live {
                        live on;
                        meta copy;
                        record off;
                        exec /usr/local/bin/ffmpeg -i rtmp://localhost/$app/$name -vcodec copy -acodec copy -f flv rtmps://live-api-s.facebook.com:443/rtmp/$name?$args;
                }
        }
}

In my streaming program, I just copy the stream key from Facebook and put it into the stream key parameter and that is what makes up the $name and $args variables in the RTMP configuration file.

Note however, that you can't use the base install of FFMPEG (that you might get via apt-get) with Facebook because Facebook now requires RTMPS. To compile FFMPEG for RTMPS you can follow these instructions: http://www.iiwnz.com/compile-ffmpeg-with-rtmps-for-facebook/

I also realize that this is not the most efficient solution because it utilizes FFMPEG to rebroadcast, however, in all my testing the CPU usage is very low due to the fact that FFMPEG is not re-encoding, but is copying the encoding of the video and audio it is receiving via the -vcodec copy -acodec copy parameters.

Was this page helpful?
0 / 5 - 0 ratings