Control module is HTTP module which makes it possible to control rtmp module from outside using HTTP protocol. Here's an example of how to enable control.
http {
...
server {
listen 8080;
server_name localhost;
....
location /control {
rtmp_control all;
}
}
}
There are several sub-modules within control module each controlling a different feature.
This sub-module starts and stops recordings created with manual flag. Syntax:
http://server.com/control/record/start|stop?srv=SRV&app=APP&name=NAME&rec=REC
Example
rtmp {
server {
listen 1935;
application myapp {
live on;
recorder rec1 {
record all manual;
record_suffix all.flv;
record_path /tmp/rec;
record_unique on;
}
}
}
}
Publish the stream with the following command
$ ffmpeg -i http://someserver.com/mychannel.ts -c:v copy -c:a nellymoser -ar 44100 -ac 1 -f flv rtmp://localhost/myapp/mystream
Use the following commands to start and stop recording
$ curl "http://localhost:8080/control/record/start?app=myapp&name=mystream&rec=rec1"
§ curl "http://localhost:8080/control/record/stop?app=myapp&name=mystream&rec=rec1"
if the record start/stop request returns nothing sometimes, you should check if you use multi workers. one worker works great.
This sub-module provides a simple way to drop client connection. Syntax:
http://server.com/control/drop/publisher|subscriber|client?
srv=SRV&app=APP&name=NAME&addr=ADDR&clientid=CLIENTID
The first method drop/publisher
drops publisher connection. The second drop/client
drops every connection matching addr
argument or all clients (including publisher) if addr
is not specified.
Examples
$ curl http://localhost:8080/control/drop/publisher?app=myapp&name=mystream
$ curl http://localhost:8080/control/drop/client?app=myapp&name=mystream
$ curl http://localhost:8080/control/drop/client?app=myapp&name=mystream&addr=192.168.0.1
$ curl http://localhost:8080/control/drop/client?app=myapp&name=mystream&clientid=1
Redirect play/publish client to a new stream. Syntax:
http://server.com/control/redirect/publisher|subscriber|client?
srv=SRV&app=APP&name=NAME&addr=ADDR&clientid=CLIENTID&newname=NEWNAME
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。