Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Facebook Streamkey Supported? #1514

Open
michaeltoohig opened this issue Apr 29, 2020 · 1 comment
Open

Dynamic Facebook Streamkey Supported? #1514

michaeltoohig opened this issue Apr 29, 2020 · 1 comment

Comments

@michaeltoohig
Copy link

There are some issues already about this very question but without an answer spanning back a few years.

#929
#1190
#1459
#1397 (the conversation turned into stunnel configuration. which already works for me if I statically place the FB streamkey into the exec command.)

The $name variable does not seem to contain all of the query args included in a Facebook live stream key. Example key 1234878994578373?s_bl=4&s_ps=2&s_sw=1&s_vt=api-s&a=ANk-6kdQfURTY3ss. In the Nginx logs I see the following:

nginx-rtmp_1  | 2020/04/29 04:21:00 [info] 10#10: *38 connect: app='facebook' args='' flashver='LNX 9,0,124,2' swf_url='' tc_url='rtmp://localhost:1935/facebook' page_url='' acodecs=4071 vcodecs=252 object_encoding=0, client: 127.0.0.1, server: 0.0.0.0:1935

This is my rtmp application block. If I put the full key in the place of $name at the end of the exec call then it does work but there is no dynamic key support.

application facebook {
            live on;
            record off;
            allow publish all;

            # Transcode and push the stream to stunnel for FB Live RMTPS requirements
            exec ffmpeg -i rtmp://localhost:1935/facebook/$name
              -c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 2500k -f flv -g 30 -r 30 -s 1280x720 -preset superfast -profile:v baseline -f flv rtmp://stunnel:19350/rtmp/$name;
        }

Thank you for clearing this up if possible.

@Devidian
Copy link

Devidian commented Jul 14, 2021

You might have found a solution until you asked, but for all others, maybe this woks (i dont stream to fb yet)

        application facebook {
            live on;
            record off;
            allow publish all;

            # Transcode and push the stream to stunnel for FB Live RMTPS requirements
            exec ffmpeg -i rtmp://localhost:1935/facebook/$name
              -c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 2500k -f flv -g 30 -r 30 -s 1280x720 -preset superfast -profile:v baseline -f flv rtmp://localhost:1935/fbpush/$name;
        }

        application fbpush {
                live on;
                on_publish http://myapi.host.com/fbpush; # response with 303 redirect to rtmp://stunnel:19350/rtmp/dynamic_key
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants