Open sameersbn opened 10 years ago
Please show your config. I think you misunderstood the way it works. All exec_pulls are started for each stream. That's exactly how the old exec
(exec_push
) works. There's no stream filter.
Please find my config here: http://pastebin.com/u1m3wiD1
I see two execs which are launched on each stream publish. That's exactly how it should work with the current implementation.
It would be nice to have stream filter but syntax would be complicated. Please feel free to suggest good syntax for that.
Maybe introduce a new command "exec_pull_static [option]" and check match the name and stream For example:
application bridge { live on; exec_pull_static feed01 /usr/bin/ffmpeg -re -i "http://example.com/video111.mp4" -vcodec copy -acodec copy -f flv rtmp://localhost:1935/bridge/$name; exec_pull_static feed02 /usr/bin/ffmpeg -re -i "http://example.com/video222.mp4" -vcodec copy -acodec copy -f flv rtmp://localhost:1935/bridge/$name; }
I apologize if this is a crazy idea, do not take it seriously :-)
I am not sure about the internals of the module. Here are my suggestions anyway...
So if a user connects to ${app}/${name} then we know exactly which exec_pull command needs to be executed if it is not already running (similar to the pull command). This makes the ${name} redundant, but might not interfere with other use cases.
name=
is a part of command line or directive argumentahhh... Now I get it.. I was thinking this was a trivial thing.
How about tagging the command itself eg. exec_pull cmd:'/usr/bin/ffmpeg -re -i "url" -vcodec copy -acodec copy -f flv rtmp://localhost:1935/bridge/feed01' name='feed01';
alternate suggestion could be something like
application bridge {
live on;
exec ${name} {
type pull; # or static
cmd /usr/bin/ffmpeg -re -i "url" -vcodec copy -acodec copy -f flv rtmp://localhost:1935/bridge/feed01;
}
}
This would if anything else, atleast make the config look cleaner
The last idea is good. However it breaks compatibility with the current exec
directive.
BTW all other execs (exec_play, exec_publish etc) should be supported as well.
Well we can support both ways of at the moment and try to detect the way the exec directive has been specified based on the braces maybe. At the same time you can mark the current exec format as deprecated and maybe remove it after 6/12 months (that is, if you are up for it).
Please try exec-pull-ext
branch. I have added optional exec filtering.
To make exec apply only to certain streams
Add exec_options on
Add name=STREAMNAME
to the end of exec line
exec_pull ffmpeg http://example.com/video.ts -c copy -f flv rtmp://localhost/$app/$name name=mystream;
Hi,
I added the following line to the bridge application
application bridge { live on; sync off; interleave on; exec_pull /usr/bin/ffmpeg -re -i "http://download.damagehead.com/samples/five.for.fighting.chances.mp4" vcodec copy -acodec copy -f flv rtmp://localhost:1935/bridge/chances name=chances; }
But the rtmp stream rtmp://localhost/bridge/chances does not work. I see that the ffmpeg command is launched and then repeatedly dies and relaunched.
Anything I am doing wrong here?
That's ffmpeg commandline issue
Build nginx in debug mode (--with-debug) Add stderr (stream 2) output to file
exec_pull /usr/bin/ffmpeg -re -i "http://download.damagehead.com/samples/five.for.fighting.chances.mp4" vcodec copy -acodec copy -f flv rtmp://localhost:1935/bridge/chances 2>>/tmp/log name=chances
Then watch /tmp/log
. The first line will be ffmpeg commandline after all substitutions.
FFMpeg says: "Unable to find a suitable output format for 'name=chances'"
The 'name=chances' part seems to get included in the ffmpeg command.
exec-pull-ext
branch, it's a new branch, not old exec-pull
exec_options on
directiveAfter adding exec_options on to the bridge {} block it is working. I had not understood what you had meant by add exec_options on in your original message. Sorry about that.
Testing now... Will let you know if I come across any problems. Thanks
Great! The new branch has rewritten and improved exec engine. I really need more feedback.
hi please give us the last conf
Hello,
I am testing the exec_pull function that has been added to the branch of the same name.
In my rtmp server configuration I have set up 2 streams in exec_pull mode. Please find paste of my sample config http://pastebin.com/u1m3wiD1
Using the sample config, If a user connects to rtmp://localhost:1935/bridge/feed02, the ffmpeg command for the stream is executed and the streaming begins. But at the same time, the ffmpeg command for the other stream (rtmp://localhost:1935/bridge/feed01) is also started even though there is no client viewing that stream.
So, If I add 10 streams like this and if only one user connects to one of the stream, the ffmpeg commands are started for each of the stream.