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:

http://server/control/record/(start|stop)?ARGS


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

Advertisements
  1. #1 by Сергей Козлов on October 10, 2012 - 8:39 pm

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

  2. #2 by Mucahid on November 20, 2012 - 9:21 pm

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: