hi
i try to stream hls link like (.ts/.m3u/m3u8) to rtmp using nginx+ffmpeg i try this conf but does not work
rtmp {
server {
listen 1935;
chunk_size 4096;
allow publish 127.0.0.1;
allow publish IP;
deny publish all;
application live {
live on;
record off;
exec_options on;
push_reconnect 1s;
session_relay on;
exec_pull ffmpeg -i #link#.ts -vb 360k -maxrate 360k -aspect "852:480" -s "852x480" -c:v libx264 -profile:v "Main" -level "3.1" -preset veryfast -r 30 -keyint_min 50 -x264opts "keyint=50:min-keyint=50:no-scenecut" -c:a aac -strict experimental -b:a 32000 -ar 32000 -ac 1 -f flv rtmp://IP:1935/live2/test;
}
application live2 {
live on;
record off;
pull rtmp://IP:1935/live2/test name=test1 static;
push rtmp:LINK;
}
}
}
Have you tried running the ffmpeg command to confirm it works?
yes it work perfectly
If there are no log entries indicating any errors, you could also install "htop" (a command-line level task viewer) on your system (or just use any other means to check this information) and see if there are ffmpeg child processes spawned when you start/restart your NGINX server.
I'm going to assume you're using the IP address of your server, in which case, have you checked that the Firewall ports are open? If you're running a linux distro with SE Linux (RHEL, Fedora, CentOS), you might need change the configuration to permit the port though it or set SE Linux to permissive. You could also try changing a couple of parameters if the NGINX server that you're pushing the "ffmpeg pull" to is the same as the one you're using to pull the source stream with.
in your 'exec_pull' config:
Change: -f flv rtmp://IP:1935/live2/test; to -f flv rtmp://127.0.0.1:1935/live2/test;
Also, I don't think you need to pull the stream if you're streaming to the stream application that you're trying to pull with. So you can probably remove or comment out: pull rtmp://IP:1935/live2/test name=test1 static;
If after all that it still doesn't work, you could try to stream directly to your destination with the 'on_exec' ffmpeg pull: -f flv rtmp://LINK;
thanks for replay friend always the same problem
https://pastebin.com/SU3mQgYR
also this
https://pastebin.com/tV6VgRKh
I'll see if I can replicate this later at home to see if I can find where the problem occurs. Can you also add the NGINX version that you're using (type: 'nginx -v' to find it out) and which version of the NGINX-RTMP module you're using (Master or some other branch).
nginx version: nginx/1.4.6 (Ubuntu)
help help please
help help please
Don't worry, I was only having trouble setting up my test environment for this, haven't forgotten about this.
I was able to replicate your problem - indeed the exec_pull is not starting the ffmpeg pull for some reason. In my case I used Ubuntu 17.04, installed ffmpeg from Ubuntu Official repos, and built NGINX from the source on Ubuntu official repos with the nginx-rtmp-module from Master branch on GitHub. I also tried to move the ffmpeg command into a separate Bash script so that it could be triggered with 'exec' but no luck with that. I'll try different NGINX version (probably one from nginx.org sources) and see if this is something related to any NGINX patches being applied during build process.
I'll also see if I can sneak in a quiet test or two during the maintenance period on a Debian 8 server to see if this works on that (it uses 'exec' push for re-streaming a couple streams and recording incoming streams 'on_publish').
One reason that came to mind why it may not be working is that it could be because of the quotation marks... but I need to try out stuff i said above first.
i am amateur can explain please
??????????????????????????????.........//////////////:
Over the weekend I set-up a couple different versions of NGINX with the NGINX RTMP module included, for some reason exec_pull doesn't seem to work. I think it's a bug, looking into other, similar, open issues seems to confirm this - https://github.com/arut/nginx-rtmp-module/issues?utf8=✓&q=is%3Aissue%20is%3Aopen%20exec
I'll fiddle around some more and see if I can find a workaround for this.
the exec is not at all working inside the rtmp module! there is a lot of issues open with its core problem only the nonfunctioning exec and its _comands
??????????????????????????????.........//////////////:
exec_pull will not work use exec_static
Most helpful comment
I was able to replicate your problem - indeed the
exec_pullis not starting the ffmpeg pull for some reason. In my case I used Ubuntu 17.04, installed ffmpeg from Ubuntu Official repos, and built NGINX from the source on Ubuntu official repos with the nginx-rtmp-module from Master branch on GitHub. I also tried to move the ffmpeg command into a separate Bash script so that it could be triggered with 'exec' but no luck with that. I'll try different NGINX version (probably one from nginx.org sources) and see if this is something related to any NGINX patches being applied during build process.I'll also see if I can sneak in a quiet test or two during the maintenance period on a Debian 8 server to see if this works on that (it uses 'exec' push for re-streaming a couple streams and recording incoming streams 'on_publish').
One reason that came to mind why it may not be working is that it could be because of the quotation marks... but I need to try out stuff i said above first.