-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Way to redirect parameters from source to target with push #920
Comments
You can put them in your first RTMP request and It'll push them to your destination RTMP server. Just change it to
Either way if you want to give the destination RTMP server (which is rtmp://differentserver here) from Database of somewhere else just use on_publish and 3xx redirect. |
Through looking at the log file i found that just like there are $name and $app variables, there is an $args variable that I can use. However, it looks like the variables don't work when using the normal push directive. They work when using exec_push but not just push. Right now I am using a work around of using exec_push ffmpeg to redirect the stream so that I can use the $name and $args variables. |
It's not efficent then because FFMPEG needs some hardware stuff like CPU and RAM. Like I said you can use on_publish and call a HTTP rest service like this:
take a look at https://github.com/arut/nginx-rtmp-module/wiki/Directives#on_publish |
I guess I am not clear on what on_publish does. What is the http://localhost:8000/rtmp-redirect going to do? |
It's a callback that you can work on yours parameters there. http://localhost:8000/rtmp-redirect this is just an example. E.g imagine that I have a webservice on above URL. I can catch the parameters is first RTMP URL and then use a HTTP redirect in my webservice to tell the Nginx-rtmp what to do. All things are happend in here: http://localhost:8000/rtmp-redirect. |
@massoudAfrashteh But: How create push duplication with on_publish? i try push (clone) to many services (1 in X out) and push is really great directive for this: My encoder uri is:
but this not working, because args is not working in simple "push" directive (what is crazy)... Can you got me some advices to figure this out? Thank you. |
Hi just can use $args not any other parameters that are not listed in rtmp-module |
e.g rtmp://server/live/stream?t=123 >>> rtmp://otherserver/live/stream?t=123 I want to use $name and $args in push directive, but is not working... @massoudAfrashteh |
Hi $args will contain all arguments after "?" E.g "rtmp://server/live/stream?t=123&a=10&p=20&u=11" then $args will be "t=123&a=10&p=20&u=11". I suggest to run a bash file inside your application then send your variables there and check values. |
Thanks, but I use $name and $args in exec_publish directive to run a bash is work, but in push directive $name and $args can't parse variables, it just "$name" and "args" string. |
@czb1n could you please share your bash example with $name and $args? |
@massoudAfrashteh like i said, run a bash is work. but in the 'push' directive, $name and $args can't parse.
push rtmp://otherserver/live/$name?$args -> can't not parse variables. |
Did you ever find a way? Running into this exact issue. |
@gavalierm @czb1n @denniskrol In Origin Server(s)
Then in Target Server(s):
Note: Just read "on_publish" documentation. Choosing each of these depending on your architecture. If you still have problems please read wiki carefully. |
Does $arg_varname work? Have not tested it out yet. |
I am having the same problem: I want to push to youtube, which changes its secret from time to time. When I push to my nginx, I want to add a GET parameter like |
I feel like I have a similar situation. I would like to be able to receive streams on multiple addresses then push them to corresponding remote addresses. Eg: |
Has anyone managed to get the parameters? It is not clear how to do this with the on_publish method. rtpm url:
|
Has anyone found a way to deal with this? Essentially, I'm just trying to access request variables that were sent in rtmp url (rtmp://example.com/app?id=123&id2=abc). I understand you can hook into events like publish or play to access these parameters, but you can only return 1 url and status code, and I'm trying to push out to 3 different ingests. E.g.: Would appreciate any help. |
I couldn't find any easy ways. I did it by changing the source code in ngx_rtmp_relay_module.c in nginx-rtmp-module. I added a flag (forward_auth) for nginx.conf:
to make your nginx pass the arguments you should add forward_auth on; and here is my ngx_rtmp_relay_module.c : |
Hello guys! You can use this solution that works for me for Instagram live. For example you want to redirect "rtmp://source/app/name?p1=foo&p2=blah" to "rtmp://destination/app/name?p1=foo&p2=blah" Source RTMP block:
Inside webservice method, is up to you to write a webservice or simple callback method in any language.
Above method returns 301 redirect or move with destination url in response header. FYI for Facebook and Instagram you should use Stunnel to relay rtmp to rtmps. hope this helps. |
When utilizing the push directive is there a way to redirect any parameters passed in to the source url to the target url?
Example:
Publishing to application via rtmp://server/live/stream?parm1=1&parm2=2
config file:
The text was updated successfully, but these errors were encountered: