Nginx-rtmp-module: authorization on push

Created on 21 Sep 2015  Â·  15Comments  Â·  Source: arut/nginx-rtmp-module

Is it possible to add login and password to push url?

I.e. to make something like:
application app00 {
live on;
push rtmp://user:pass@server:port/app/;
}

Most helpful comment

@renatosbc you are right, but cpu load was too low in real world scenario (around 1% in a virtual machine with very limited resources - tested for more than three months).
I made a small bash script to restart ffmpeg on errors (-xerror parameter):

#!/bin/bash

while true
do
    ffmpeg -i rtmp://127.0.0.1/live/test -threads 1 -vcodec copy -acodec copy -f flv rtmp://[username]:[password]@dacast.stream.target.url -xerror 2> /tmp/ffmpeg.log
    sleep 1
done

and updated the config file to run it:

application live {
                 live on;
                 record off;
                 exec /path/to/shell/script.sh;
}

@renatosbc @sgdc3 you are very welcome.

All 15 comments

Hello friend, you can use the HTTP callbacks, using the on_publish notify, you just need to stripe the arguments you pass on the connection string and validate them against a PHP

No, i need to authorize on remote rtmp server when doing push

Did you try solution you wrote in question? It should work with auth data
in rtmp url.

2015-09-21 21:11 GMT+02:00 ugenk [email protected]:

No, i need to authorize on remote rtmp server when doing push

—
Reply to this email directly or view it on GitHub
https://github.com/arut/nginx-rtmp-module/issues/688#issuecomment-142081196
.

root@gate:~# /usr/local/nginx/sbin/nginx -s reload
nginx: [emerg] invalid port in url "user:[email protected]:1935/live/" in /usr/local/nginx/conf/nginx.conf:26

part from config:
push rtmp://user:[email protected]:1935/live/;

rtmp://user:[email protected]:1935/live/

That syntax would be perfect, @arut any news?

@arut as @sgdc3 mentions people needing to leverage push rtmp://user:[email protected]:1935/live/; to external services that use authenticated rtmp, nginx-rtmp does not work. Can you help shed some light on how to accomplish rtmp://user:[email protected]:1935/live/ with out getting the "invalid port in url" error?

Thanks in Advance!

+1 We also need it to push to Wowza

Yeah, that's a feature that should be implemented

+1 That would be really helpful.

Is there any news on this issue?!

I tried executing ffmpeg instead of push and it worked like a charm (in config file):
ex:

application app00 {
live on;
exec ffmpeg -i rtmp://127.0.0.1/live/test -threads 1 -vcodec copy -acodec copy -f flv rtmp://[username]:[password]@dacast.stream.target.url;
}

@shahab1363 nice! thank you for sharing

+1. This would be really helpful. Another ffmpeg (in exec), even without reencode (a:copy v:copy) takes some cpu load, but works. Thanks @shahab1363 !

@renatosbc you are right, but cpu load was too low in real world scenario (around 1% in a virtual machine with very limited resources - tested for more than three months).
I made a small bash script to restart ffmpeg on errors (-xerror parameter):

#!/bin/bash

while true
do
    ffmpeg -i rtmp://127.0.0.1/live/test -threads 1 -vcodec copy -acodec copy -f flv rtmp://[username]:[password]@dacast.stream.target.url -xerror 2> /tmp/ffmpeg.log
    sleep 1
done

and updated the config file to run it:

application live {
                 live on;
                 record off;
                 exec /path/to/shell/script.sh;
}

@renatosbc @sgdc3 you are very welcome.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SmokE-PGF picture SmokE-PGF  Â·  6Comments

DaveZheng picture DaveZheng  Â·  3Comments

ama-ableton picture ama-ableton  Â·  6Comments

wwwyaron picture wwwyaron  Â·  4Comments

evgenibers picture evgenibers  Â·  4Comments