To enable nginx-rtmp control use the following directive within HTTP location
http {
...
server {
...
location control {
rtmp_control all;
}
}
}
That looks very much like
rtmp_stat
directive.At the moment only one control feature is implemented in control module - record control. With this you can manually start and stop recording at any moment of time.
Assume you have the following application within rtmp section of nginx.conf:
application myapp {
live on;
recorder rec {
record all manual;
record_path /var/rec;
}
}
Notice
manual
option in record
directive. That means the recorder will never be started automatically. Instead you should register rtmp control with HTTP section of nginx.conf (I'll use the above mentioned control configuration) and call control URL to start or stop recording. Recorder control methods return file path.Recorder URL format:
http://server/control/record/(start|stop)?ARGS
The following arguments are supported:
srv
- optional server number, default is 0 (first server)app
- required application namerec
- optional recorder name, default is empty (default recorder)name
- required stream name
If you have stream
mystream
active then the following command will start recording:
curl 'http://localhost:8080/control/record/start?app=myapp&name=mystream&rec=rec'
The call returns full path
/var/rec/mystream.flv
.Stopping is very much the same
curl 'http://localhost:8080/control/record/stop?app=myapp&name=mystream&rec=rec'
Project page
Что-то начинает прояснятся...
ReplyDeleteThis is really great functionality to control recording, thank you Rarut !
ReplyDeleteThis comment has been removed by the author.
ReplyDelete