Tuesday, October 9, 2012

HTTP Control module and recorder control

Until now nginx-rtmp had no control interface. Today I want to announce nginx-rtmp control module. It's plain HTTP module within nginx-rtmp package (like stat module) which makes it possible to change rtmp module behavior and toggle features on the fly.

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:


The following arguments are supported:

  • srv - optional server number, default is 0 (first server)

  • app - required application name

  • rec - 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


  1. Что-то начинает прояснятся...

  2. This is really great functionality to control recording, thank you Rarut !

  3. This comment has been removed by the author.